From dc8ffb78cf292fb3c9188d1ee4c1c82c6ce692bf Mon Sep 17 00:00:00 2001 From: Yosiah de Koeyer Date: Tue, 5 Dec 2023 23:10:45 +1100 Subject: [PATCH 1/2] Reduce chance of NS name clash Signed-off-by: Yosiah de Koeyer --- pkg/test/case.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/test/case.go b/pkg/test/case.go index bff89162..12ac7e18 100644 --- a/pkg/test/case.go +++ b/pkg/test/case.go @@ -385,7 +385,7 @@ func (t *Case) determineNamespace() *namespace { } // no preferred ns, means we auto-create with petnames if t.PreferredNamespace == "" { - ns.Name = fmt.Sprintf("kuttl-test-%s", petname.Generate(2, "-")) + ns.Name = fmt.Sprintf("kuttl-test-%s", petname.Generate(4, "-")) ns.AutoCreated = true } // if we have a preferred namespace, we do NOT auto-create From 1a78259a7b9210f013d93b7e051a30ef0dc0c2b0 Mon Sep 17 00:00:00 2001 From: Yosiah de Koeyer Date: Tue, 5 Dec 2023 23:13:05 +1100 Subject: [PATCH 2/2] Update tests Signed-off-by: Yosiah de Koeyer --- pkg/test/step_integration_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/test/step_integration_test.go b/pkg/test/step_integration_test.go index cf0d517d..1db3c0ce 100644 --- a/pkg/test/step_integration_test.go +++ b/pkg/test/step_integration_test.go @@ -232,7 +232,7 @@ func TestCheckResourceIntegration(t *testing.T) { } { test := test t.Run(test.testName, func(t *testing.T) { - namespace := fmt.Sprintf("kuttl-test-%s", petname.Generate(2, "-")) + namespace := fmt.Sprintf("kuttl-test-%s", petname.Generate(4, "-")) err := testenv.Client.Create(context.TODO(), testutils.NewResource("v1", "Namespace", namespace, "")) if !k8serrors.IsAlreadyExists(err) { @@ -423,7 +423,7 @@ func TestStepFailure(t *testing.T) { }, } - namespace := fmt.Sprintf("kuttl-test-%s", petname.Generate(2, "-")) + namespace := fmt.Sprintf("kuttl-test-%s", petname.Generate(4, "-")) err := testenv.Client.Create(context.TODO(), testutils.NewResource("v1", "Namespace", namespace, "")) if !k8serrors.IsAlreadyExists(err) {