Skip to content

Commit

Permalink
Fix flaky auto_refresh_test (#5438)
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Su <[email protected]>
  • Loading branch information
pingsutw authored Jun 4, 2024
1 parent 5a81e76 commit fceb78f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions flytestdlib/cache/auto_refresh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ func TestCacheFour(t *testing.T) {
assert.NoError(t, err)
}

// Wait half a second for all resync periods to complete
time.Sleep(500 * time.Millisecond)
for i := 1; i <= 10; i++ {
item, err := cache.Get(fmt.Sprintf("%d", i))
assert.NoError(t, err)
assert.Equal(t, 10, item.(fakeCacheItem).val)
}
assert.EventuallyWithT(t, func(c *assert.CollectT) {
for i := 1; i <= 10; i++ {
item, err := cache.Get(fmt.Sprintf("%d", i))
assert.NoError(c, err)
assert.Equal(c, 10, item.(fakeCacheItem).val)
}
}, 3*time.Second, 100*time.Millisecond)
cancel()
})

Expand Down

0 comments on commit fceb78f

Please sign in to comment.