@@ -338,20 +338,16 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace] OLMv1 ope
338338 }
339339
340340 // Ensure unique names per scenario
341- crdSuffix := rand .String (4 )
342- packageName := fmt .Sprintf ("singleown-operator-both-%s" , crdSuffix )
343- By (fmt .Sprintf ("building singleown operator assets for %s scenario: image=%s, CRD suffix=%s, package=%s" , sc .label , singleownImage , crdSuffix , packageName ))
341+ unique := rand .String (4 )
342+ packageName := fmt .Sprintf ("singleown-operator-both-%s" , unique )
343+ By (fmt .Sprintf ("building singleown operator assets for %s scenario: image=%s, CRD suffix=%s, package=%s" , sc .label , singleownImage , unique , packageName ))
344344
345345 replacements := map [string ]string {
346- "{{ TEST-BUNDLE }}" : "" ,
347- "{{ NAMESPACE }}" : "" ,
348- "{{ TEST-CONTROLLER }}" : singleownImage ,
349- "{{ CRD-SUFFIX }}" : crdSuffix , // Unique CRD suffix per scenario
350- "{{ PACKAGE-NAME }}" : packageName ,
351- "webhook-operator-webhooktest-admin-role" : fmt .Sprintf ("webhook-operator-webhooktest-admin-role-%s" , crdSuffix ),
352- "webhook-operator-webhooktest-editor-role" : fmt .Sprintf ("webhook-operator-webhooktest-editor-role-%s" , crdSuffix ),
353- "webhook-operator-webhooktest-viewer-role" : fmt .Sprintf ("webhook-operator-webhooktest-viewer-role-%s" , crdSuffix ),
354- "webhook-operator-metrics-reader" : fmt .Sprintf ("webhook-operator-metrics-reader-%s" , crdSuffix ),
346+ "{{ TEST-BUNDLE }}" : "" ,
347+ "{{ NAMESPACE }}" : "" ,
348+ "{{ TEST-CONTROLLER }}" : singleownImage ,
349+ "{{ CRD-SUFFIX }}" : unique , // Unique CRD suffix per scenario
350+ "{{ PACKAGE-NAME }}" : packageName ,
355351 }
356352
357353 _ , nsName , catalogName , opName := helpers .NewCatalogAndClusterBundles (ctx , replacements ,
@@ -361,7 +357,7 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace] OLMv1 ope
361357 By (fmt .Sprintf ("singleown bundle %q and catalog %q built successfully in namespace %q for %s scenario" , opName , catalogName , nsName , sc .label ))
362358
363359 By (fmt .Sprintf ("ensuring no ClusterExtension for %s before %s scenario" , packageName , sc .label ))
364- crdName := fmt .Sprintf ("webhooktests-%s.webhook.operators.coreos.io" , crdSuffix )
360+ crdName := fmt .Sprintf ("webhooktests-%s.webhook.operators.coreos.io" , unique )
365361 helpers .EnsureCleanupClusterExtension (context .Background (), packageName , crdName )
366362
367363 By (fmt .Sprintf ("creating namespace %s for %s tests" , installNamespace , sc .label ))
@@ -433,13 +429,7 @@ var _ = Describe("[sig-olmv1][OCPFeatureGate:NewOLMOwnSingleNamespace] OLMv1 ope
433429 DeferCleanup (func () {
434430 By (fmt .Sprintf ("cleanup: deleting ClusterExtension %s" , ce .Name ))
435431 _ = k8sClient .Delete (context .Background (), ce , client .PropagationPolicy (metav1 .DeletePropagationForeground ))
436- if crdName != "" {
437- crd := & apiextensionsv1.CustomResourceDefinition {}
438- if err := k8sClient .Get (context .Background (), client.ObjectKey {Name : crdName }, crd ); err == nil {
439- By (fmt .Sprintf ("cleanup: deleting CRD %s" , crdName ))
440- _ = k8sClient .Delete (context .Background (), crd )
441- }
442- }
432+ helpers .EnsureCleanupClusterExtension (context .Background (), ceName , nsName )
443433 })
444434
445435 By (fmt .Sprintf ("waiting for the ClusterExtension %s to be installed for %s scenario" , ceName , sc .label ))
0 commit comments