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
This commit is contained in:
Ryan Richard 2020-10-28 14:25:01 -07:00
parent 01dddd3cae
commit c52874250a

View File

@ -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)
if notFound {
originalSecret = nil
} else {
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)
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() {