diff --git a/pkg/cache/cache_test.go b/pkg/cache/cache_test.go index b1ebe10c1d7..13fccddbf03 100644 --- a/pkg/cache/cache_test.go +++ b/pkg/cache/cache_test.go @@ -94,19 +94,19 @@ func TestCache(t *testing.T) { func TestCacheTimes(t *testing.T) { var found bool - tc := New(50*time.Millisecond, 1*time.Millisecond) + tc := New(100*time.Millisecond, 1*time.Millisecond) tc.Set("a", 1, DefaultExpiration) tc.Set("b", 2, NoExpiration) - tc.Set("c", 3, 20*time.Millisecond) - tc.Set("d", 4, 70*time.Millisecond) + tc.Set("c", 3, 40*time.Millisecond) + tc.Set("d", 4, 140*time.Millisecond) - <-time.After(25 * time.Millisecond) + <-time.After(50 * time.Millisecond) _, found = tc.Get("c") if found { t.Error("Found c when it should have been automatically deleted") } - <-time.After(30 * time.Millisecond) + <-time.After(80 * time.Millisecond) _, found = tc.Get("a") if found { t.Error("Found a when it should have been automatically deleted") @@ -122,7 +122,7 @@ func TestCacheTimes(t *testing.T) { t.Error("Did not find d even though it was set to expire later than the default") } - <-time.After(20 * time.Millisecond) + <-time.After(40 * time.Millisecond) _, found = tc.Get("d") if found { t.Error("Found d when it should have been automatically deleted (later than the default)")