From 8c1d5a2cdcd4ad208d8122946a3f8b88c4255ed5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 22 Apr 2018 14:09:06 -0700 Subject: [PATCH] agent: resolve flaky test by checking cache hits increase, rather than exact --- agent/agent_endpoint_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/agent/agent_endpoint_test.go b/agent/agent_endpoint_test.go index 44dd029233..d6b1996ddc 100644 --- a/agent/agent_endpoint_test.go +++ b/agent/agent_endpoint_test.go @@ -2194,8 +2194,10 @@ func TestAgentConnectCARoots_list(t *testing.T) { // Should be a cache hit! The data should've updated in the cache // in the background so this should've been fetched directly from // the cache. - require.Equal(cacheHits+1, a.cache.Hits()) - cacheHits++ + if v := a.cache.Hits(); v < cacheHits+1 { + t.Fatalf("expected at least one more cache hit, still at %d", v) + } + cacheHits = a.cache.Hits() } }