From 4ebd0f5f127a1ffce0e02492a9adaa609452af3f Mon Sep 17 00:00:00 2001 From: Matt Moyer Date: Tue, 30 Mar 2021 13:47:25 -0500 Subject: [PATCH] Deflake TestImpersonationProxy (especially on EKS). This test could flake if the load balancer hostname was provisioned but is not yet resolving in DNS from the test process. The fix is to retry this step for up to 5 minutes. Signed-off-by: Matt Moyer --- test/integration/concierge_impersonation_proxy_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/integration/concierge_impersonation_proxy_test.go b/test/integration/concierge_impersonation_proxy_test.go index fee7e4df..529754a7 100644 --- a/test/integration/concierge_impersonation_proxy_test.go +++ b/test/integration/concierge_impersonation_proxy_test.go @@ -133,8 +133,14 @@ func TestImpersonationProxy(t *testing.T) { //nolint:gocyclo // yeah, it's compl // so it more closely simulates the normal use case, and also because we want this to work on AKS clusters // which do not allow anonymous requests. client := newAnonymousImpersonationProxyClient(impersonationProxyURL, impersonationProxyCACertPEM, "").PinnipedConcierge - mostRecentTokenCredentialRequestResponse, err = createTokenCredentialRequest(credentialRequestSpecWithWorkingCredentials, client) - require.NoError(t, err, library.Sdump(err)) + require.Eventually(t, func() bool { + mostRecentTokenCredentialRequestResponse, err = createTokenCredentialRequest(credentialRequestSpecWithWorkingCredentials, client) + if err != nil { + t.Logf("failed to make TokenCredentialRequest: %s", library.Sdump(err)) + return false + } + return true + }, 5*time.Minute, 5*time.Second) require.Nil(t, mostRecentTokenCredentialRequestResponse.Status.Message, "expected no error message but got: %s", library.Sdump(mostRecentTokenCredentialRequestResponse.Status.Message))