From aadae6d50b0a2380c9e7b0aeba4908cc98841bcf Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Fri, 17 Dec 2021 17:36:11 +0200 Subject: [PATCH] Fix flakiness on Windows for list stats This change fixes flakiness on Windows for TestContainerListStatsWithSandboxIdFilter Signed-off-by: Gabriel Adrian Samfira --- integration/container_stats_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/integration/container_stats_test.go b/integration/container_stats_test.go index 3533631cc..309f5c14c 100644 --- a/integration/container_stats_test.go +++ b/integration/container_stats_test.go @@ -292,10 +292,14 @@ func TestContainerListStatsWithSandboxIdFilter(t *testing.T) { if len(stats) != 3 { return false, errors.New("unexpected stats length") } - if stats[0].GetWritableLayer().GetUsedBytes().GetValue() != 0 { - return true, nil + + for _, containerStats := range stats { + // Wait for stats on all containers, not just the first one in the list. + if containerStats.GetWritableLayer().GetUsedBytes().GetValue() == 0 { + return false, nil + } } - return false, nil + return true, nil }, time.Second, 45*time.Second)) // TODO(claudiub): Reduce the timer above to 30 seconds once Windows flakiness has been addressed. t.Logf("Verify container stats for sandbox %q", sb)