From 8d768f50eec7ca243049680cc3f53f84ef29ab53 Mon Sep 17 00:00:00 2001 From: Martin Gencur Date: Mon, 17 Jun 2024 12:12:13 +0200 Subject: [PATCH] Cert rotation test does not use specific ingress namespace (#15331) --- .../system_internal_tls_test.go | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/test/e2e/systeminternaltls/system_internal_tls_test.go b/test/e2e/systeminternaltls/system_internal_tls_test.go index 99b6e7ac02a3..c03da1c68db5 100644 --- a/test/e2e/systeminternaltls/system_internal_tls_test.go +++ b/test/e2e/systeminternaltls/system_internal_tls_test.go @@ -162,8 +162,6 @@ func TestTLSCertificateRotation(t *testing.T) { t.Log("Creating ConfigMap with old and new CA certs") systemNS := os.Getenv(system.NamespaceEnvKey) - ingressNS := os.Getenv(test.GatewayNamespaceOverride) - bundleNamespaces := []string{systemNS, ingressNS} // Create ConfigMap with networking.knative.dev/trust-bundle label in required namespaces cm := &corev1.ConfigMap{ @@ -178,22 +176,18 @@ func TestTLSCertificateRotation(t *testing.T) { "cert_renewed.pem": string(secretRenewed.Data[certificates.CertName]), }, } - for _, ns := range bundleNamespaces { - _, err := clients.KubeClient.CoreV1().ConfigMaps(ns). - Create(context.Background(), cm, v1.CreateOptions{}) - if err != nil { - t.Fatal("Failed to create configmap:", err) - } + _, err = clients.KubeClient.CoreV1().ConfigMaps(systemNS). + Create(context.Background(), cm, v1.CreateOptions{}) + if err != nil { + t.Fatal("Failed to create configmap:", err) } // Clean up on test failure or interrupt test.EnsureCleanup(t, func() { test.TearDown(clients, &names) - for _, ns := range bundleNamespaces { - if err := clients.KubeClient.CoreV1().ConfigMaps(ns). - Delete(context.Background(), cm.Name, v1.DeleteOptions{}); err != nil && !errors.IsNotFound(err) { - t.Fatal("Failed to delete configmap:", err) - } + if err := clients.KubeClient.CoreV1().ConfigMaps(systemNS). + Delete(context.Background(), cm.Name, v1.DeleteOptions{}); err != nil && !errors.IsNotFound(err) { + t.Fatal("Failed to delete configmap:", err) } }) @@ -225,12 +219,6 @@ func TestTLSCertificateRotation(t *testing.T) { t.Fatalf("Failed to delete secret %s in system namespace: %v", config.ServingRoutingCertName, err) } checkEndpointState(t, clients, url) - - t.Log("Deleting secret in ingress namespace") - if err := clients.KubeClient.CoreV1().Secrets(ingressNS).Delete(context.Background(), config.ServingRoutingCertName, v1.DeleteOptions{}); err != nil { - t.Fatalf("Failed to delete secret %s in ingress namespace: %v", config.ServingRoutingCertName, err) - } - checkEndpointState(t, clients, url) } func checkEndpointState(t *testing.T, clients *test.Clients, url *url.URL) {