From c52874250ad455870b179a14af13d2cec5d6e3ba Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Wed, 28 Oct 2020 14:25:01 -0700 Subject: [PATCH] Fix a mistake in supervisor_discovery_test.go - Should not fail when the default TLS cert does not exist in the test cluster before the test started --- test/integration/supervisor_discovery_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/integration/supervisor_discovery_test.go b/test/integration/supervisor_discovery_test.go index 50a9f0069..4f60a6c13 100644 --- a/test/integration/supervisor_discovery_test.go +++ b/test/integration/supervisor_discovery_test.go @@ -311,9 +311,12 @@ func temporarilyRemoveAllOIDCProviderConfigsAndDefaultTLSCertSecret(ctx context. originalSecret, err := kubeClient.CoreV1().Secrets(ns).Get(ctx, specialNameForDefaultTLSCertSecret, metav1.GetOptions{}) notFound := k8serrors.IsNotFound(err) require.False(t, err != nil && !notFound, "unexpected error when getting %s", specialNameForDefaultTLSCertSecret) - err = kubeClient.CoreV1().Secrets(ns).Delete(ctx, specialNameForDefaultTLSCertSecret, metav1.DeleteOptions{}) - notFound = k8serrors.IsNotFound(err) - require.False(t, err != nil && !notFound, "unexpected error when deleting %s", specialNameForDefaultTLSCertSecret) + if notFound { + originalSecret = nil + } else { + err = kubeClient.CoreV1().Secrets(ns).Delete(ctx, specialNameForDefaultTLSCertSecret, metav1.DeleteOptions{}) + require.NoError(t, err) + } // When this test has finished, recreate any OIDCProviderConfigs and default secret that had existed on the cluster before this test. t.Cleanup(func() {