Skip to content

Commit c240fdf

Browse files
authored
*: avoid flaky test with high load scenario (#57016)
1 parent b314a9c commit c240fdf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/statistics/handle/cache/internal/lfu/lfu_cache_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ func TestMemoryControlWithUpdate(t *testing.T) {
310310
t1 := testutil.NewMockStatisticsTable(i, 1, true, false, false)
311311
lfu.Put(1, t1)
312312
}
313-
time.Sleep(1 * time.Second)
314-
require.Equal(t, int64(0), lfu.Cost())
313+
require.Eventually(t, func() bool {
314+
return int64(0) == lfu.Cost()
315+
}, 5*time.Second, 100*time.Millisecond)
315316
}

0 commit comments

Comments
 (0)