From 0758ecfea8ca91cb59b011471c96f5d30c1eec08 Mon Sep 17 00:00:00 2001 From: Andrew Keesler Date: Tue, 15 Dec 2020 15:46:55 -0800 Subject: [PATCH] Tests wait for OIDCProvider secrets to be set Signed-off-by: aram price --- test/library/client.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/library/client.go b/test/library/client.go index 0f622b44..c68c0872 100644 --- a/test/library/client.go +++ b/test/library/client.go @@ -285,6 +285,22 @@ func CreateTestOIDCProvider(ctx context.Context, t *testing.T, issuer string, ce }, 60*time.Second, 1*time.Second, "expected the OIDCProvider to have status %q", expectStatus) require.Equal(t, expectStatus, result.Status.Status) + // If the expected status is success, also wait for the secrets to be created. + if expectStatus == configv1alpha1.SuccessOIDCProviderStatusCondition { + assert.Eventually(t, func() bool { + var err error + result, err = opcs.Get(ctx, opc.Name, metav1.GetOptions{}) + require.NoError(t, err) + return result.Status.Secrets.JWKS.Name != "" && + result.Status.Secrets.TokenSigningKey.Name != "" && + result.Status.Secrets.StateSigningKey.Name != "" && + result.Status.Secrets.StateEncryptionKey.Name != "" + }, 60*time.Second, 1*time.Second, "expected the OIDCProvider to have secrets populated") + require.NotEmpty(t, result.Status.Secrets.JWKS.Name) + require.NotEmpty(t, result.Status.Secrets.TokenSigningKey.Name) + require.NotEmpty(t, result.Status.Secrets.StateSigningKey.Name) + require.NotEmpty(t, result.Status.Secrets.StateEncryptionKey.Name) + } return opc }