@@ -196,6 +196,22 @@ func verifyNamespaceExists(t *testing.T, namespace string) {
196196 }
197197}
198198
199+ func verifyNamespaceHasLabel (t * testing.T , namespace , key , value string ) {
200+ t .Helper ()
201+
202+ cmd := exec .Command ("kubectl" , "get" , "namespace" , namespace ,
203+ "-o" , "jsonpath={.metadata.labels['" + key + "']}" )
204+ output , err := cmd .Output ()
205+ if err != nil {
206+ t .Fatalf ("Failed to get label %s from namespace %s: %v" , key , namespace , err )
207+ }
208+
209+ actualValue := strings .TrimSpace (string (output ))
210+ if actualValue != value {
211+ t .Fatalf ("Namespace %s has label %s=%s, expected %s" , namespace , key , actualValue , value )
212+ }
213+ }
214+
199215func doesDeploymentExist (t * testing.T , namespace string , name string ) bool {
200216 t .Helper ()
201217
@@ -272,12 +288,14 @@ func TestDeployCentralAndSecuredCluster(t *testing.T) {
272288 args = append ([]string {roxieBinary , "deploy" , "--early-readiness" , "secured-cluster" }, commonDeployArgsNoPortForward ... )
273289 runCommand (t , deployTimeout , envrcEnv , args ... )
274290
275- // Verify namespaces
291+ // Verify namespaces and labels
276292 t .Log ("Verifying namespace: acs-central" )
277293 verifyNamespaceExists (t , "acs-central" )
294+ verifyNamespaceHasLabel (t , "acs-central" , "app.kubernetes.io/managed-by" , "roxie" )
278295
279296 t .Log ("Verifying namespace: acs-sensor" )
280297 verifyNamespaceExists (t , "acs-sensor" )
298+ verifyNamespaceHasLabel (t , "acs-sensor" , "app.kubernetes.io/managed-by" , "roxie" )
281299
282300 // Brief pause before next test
283301 time .Sleep (5 * time .Second )
@@ -350,9 +368,11 @@ func TestDeployBothComponentsTogether(t *testing.T) {
350368
351369 t .Log ("Verifying namespace: acs-central" )
352370 verifyNamespaceExists (t , "acs-central" )
371+ verifyNamespaceHasLabel (t , "acs-central" , "app.kubernetes.io/managed-by" , "roxie" )
353372
354373 t .Log ("Verifying namespace: acs-sensor" )
355374 verifyNamespaceExists (t , "acs-sensor" )
375+ verifyNamespaceHasLabel (t , "acs-sensor" , "app.kubernetes.io/managed-by" , "roxie" )
356376
357377 // Verify Central has the pause-reconcile annotation.
358378 t .Log ("Verifying pause-reconcile annotation on Central CR" )
@@ -420,9 +440,11 @@ func TestDeployCentralAndSecuredClusterViaHelm(t *testing.T) {
420440
421441 t .Log ("Verifying namespace: acs-central" )
422442 verifyNamespaceExists (t , "acs-central" )
443+ verifyNamespaceHasLabel (t , "acs-central" , "app.kubernetes.io/managed-by" , "roxie" )
423444
424445 t .Log ("Verifying namespace: acs-sensor" )
425446 verifyNamespaceExists (t , "acs-sensor" )
447+ verifyNamespaceHasLabel (t , "acs-sensor" , "app.kubernetes.io/managed-by" , "roxie" )
426448}
427449
428450func verifyAnnotation (t * testing.T , resourceType , resourceName , namespace , annotationKey , expectedValue string ) {
0 commit comments