From 91ab8a5178cc58ad29462eeede8c1267daae190f Mon Sep 17 00:00:00 2001 From: Violet Hynes Date: Wed, 15 Nov 2023 10:33:27 -0500 Subject: [PATCH] Add a sleep to give the event system time to start (#24141) --- .../cache/static_secret_cache_updater_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/command/agentproxyshared/cache/static_secret_cache_updater_test.go b/command/agentproxyshared/cache/static_secret_cache_updater_test.go index 819405744f..d3a56fe169 100644 --- a/command/agentproxyshared/cache/static_secret_cache_updater_test.go +++ b/command/agentproxyshared/cache/static_secret_cache_updater_test.go @@ -424,6 +424,10 @@ func Test_StreamStaticSecretEvents_UpdatesCacheWithNewSecrets(t *testing.T) { t.Fatal(err) } + // Wait for the event stream to be fully up and running. Should be faster than this in reality, but + // we make it five seconds to protect against CI flakiness. + time.Sleep(5 * time.Second) + // Put a secret, which should trigger an event _, err = client.KVv2("secret-v2").Put(context.Background(), "foo", secretData) if err != nil { @@ -434,7 +438,7 @@ func Test_StreamStaticSecretEvents_UpdatesCacheWithNewSecrets(t *testing.T) { // than this, but we make it five seconds to protect against CI flakiness. time.Sleep(5 * time.Second) - // Then, do a GET to see if the event got updated + // Then, do a GET to see if the index got updated by the event newIndex, err := leaseCache.db.Get(cachememdb.IndexNameID, indexId) if err != nil { t.Fatal(err)