Skip to content

Commit

Permalink
TESTING
Browse files Browse the repository at this point in the history
  • Loading branch information
ReToCode committed Sep 19, 2024
1 parent 4b6ed56 commit 6bf6a7a
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions test/e2e/systeminternaltls/system_internal_tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ func TestSystemInternalTLS(t *testing.T) {
// TestTLSCertificateRotation tests certificate rotation and automatic reloading of certs.
func TestTLSCertificateRotation(t *testing.T) {

t.Skip("RETO SKIPPED TESTING")

if !test.ServingFlags.EnableAlphaFeatures {
t.Skip("Alpha features not enabled")
}
Expand Down Expand Up @@ -165,6 +163,7 @@ func TestTLSCertificateRotation(t *testing.T) {

t.Log("Creating ConfigMap with old and new CA certs")
systemNS := os.Getenv(system.NamespaceEnvKey)
ingressNS := os.Getenv("SERVING_INGRESS_NAMESPACE")

// Create ConfigMap with networking.knative.dev/trust-bundle label in required namespaces
cm := &corev1.ConfigMap{
Expand All @@ -182,15 +181,30 @@ func TestTLSCertificateRotation(t *testing.T) {
_, err = clients.KubeClient.CoreV1().ConfigMaps(systemNS).
Create(context.Background(), cm, v1.CreateOptions{})
if err != nil {
t.Fatal("Failed to create configmap:", err)
t.Fatal("Failed to create configmap in "+systemNS, err)
}

if systemNS != ingressNS {
_, err = clients.KubeClient.CoreV1().ConfigMaps(ingressNS).
Create(context.Background(), cm, v1.CreateOptions{})
if err != nil {
t.Fatal("Failed to create configmap in "+ingressNS, err)
}
}

// Clean up on test failure or interrupt
test.EnsureCleanup(t, func() {
test.TearDown(clients, &names)
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)
t.Fatal("Failed to delete configmap in "+systemNS, err)
}

if systemNS != ingressNS {
if err := clients.KubeClient.CoreV1().ConfigMaps(ingressNS).
Delete(context.Background(), cm.Name, v1.DeleteOptions{}); err != nil && !errors.IsNotFound(err) {
t.Fatal("Failed to delete configmap in "+ingressNS, err)
}
}
})

Expand Down Expand Up @@ -221,6 +235,14 @@ func TestTLSCertificateRotation(t *testing.T) {
if err := clients.KubeClient.CoreV1().Secrets(systemNS).Delete(context.Background(), config.ServingRoutingCertName, v1.DeleteOptions{}); err != nil {
t.Fatalf("Failed to delete secret %s in system namespace: %v", config.ServingRoutingCertName, err)
}

if systemNS != ingressNS {
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)
}

Expand Down

0 comments on commit 6bf6a7a

Please sign in to comment.