From d09ab304e5e2f29cedb74b5976f864d80aaf6a61 Mon Sep 17 00:00:00 2001 From: Ibrahim Jarif Date: Tue, 30 Jun 2020 12:20:30 +0530 Subject: [PATCH] Fix flaky TestCacheDel test --- cache_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cache_test.go b/cache_test.go index c1dc7456..0b6bf903 100644 --- a/cache_test.go +++ b/cache_test.go @@ -431,6 +431,10 @@ func TestCacheDel(t *testing.T) { c.Set(1, 1, 1) c.Del(1) + // The deletes and sets are pushed through the setbuf. It might be possible + // that the delete is not processed before the following get is called. So + // wait for a millisecond for things to be processed. + time.Sleep(time.Millisecond) val, ok := c.Get(1) require.False(t, ok) require.Nil(t, val)