Add truncindex for filter in List and Stat

fix #344
Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
This commit is contained in:
yanxuean
2017-11-06 16:47:43 +08:00
parent 4a4a860dfa
commit 6234337459
4 changed files with 50 additions and 0 deletions

View File

@@ -296,6 +296,29 @@ func TestContainerListStatsWithIdSandboxIdFilter(t *testing.T) {
testStats(t, s, config)
}
}
t.Logf("Fetch container stats for sandbox truncID and container truncID filter ")
for id, config := range containerConfigMap {
require.NoError(t, Eventually(func() (bool, error) {
stats, err = runtimeService.ListContainerStats(
&runtime.ContainerStatsFilter{Id: id[:3], PodSandboxId: sb[:3]})
if err != nil {
return false, err
}
if len(stats) != 1 {
return false, fmt.Errorf("Unexpected stats length")
}
if stats[0].GetWritableLayer().GetUsedBytes().GetValue() != 0 &&
stats[0].GetWritableLayer().GetInodesUsed().GetValue() != 0 {
return true, nil
}
return false, nil
}, time.Second, 30*time.Second))
t.Logf("Verify container stats for sandbox %q and container %q filter", sb, id)
for _, s := range stats {
testStats(t, s, config)
}
}
}
// TODO make this as options to use for dead container tests