@@ -218,17 +218,18 @@ func TestInit(t *testing.T) (*ocv1.ClusterExtension, *ocv1.ClusterCatalog, *core
218218
219219func TestInitClusterExtensionClusterCatalog (t * testing.T ) (* ocv1.ClusterExtension , * ocv1.ClusterCatalog ) {
220220 ceName := fmt .Sprintf ("clusterextension-%s" , rand .String (8 ))
221+ catalogName := fmt .Sprintf ("test-catalog-%s" , rand .String (8 ))
221222
222223 ce := & ocv1.ClusterExtension {
223224 ObjectMeta : metav1.ObjectMeta {
224225 Name : ceName ,
225226 },
226227 }
227228
228- cc , err := CreateTestCatalog (context .Background (), testCatalogName , os .Getenv (testCatalogRefEnvVar ))
229+ cc , err := CreateTestCatalog (context .Background (), catalogName , os .Getenv (testCatalogRefEnvVar ))
229230 require .NoError (t , err )
230231
231- ValidateCatalogUnpack ( t )
232+ ValidateCatalogUnpackWithName ( t , catalogName )
232233
233234 return ce , cc
234235}
@@ -250,11 +251,18 @@ func TestInitServiceAccountNamespace(t *testing.T, clusterExtensionName string)
250251 return sa , ns
251252}
252253
254+ // ValidateCatalogUnpack validates that the test catalog with the default name has unpacked successfully.
255+ // Deprecated: Use ValidateCatalogUnpackWithName for tests that use unique catalog names.
253256func ValidateCatalogUnpack (t * testing.T ) {
257+ ValidateCatalogUnpackWithName (t , testCatalogName )
258+ }
259+
260+ // ValidateCatalogUnpackWithName validates that a catalog with the given name has unpacked successfully.
261+ func ValidateCatalogUnpackWithName (t * testing.T , catalogName string ) {
254262 catalog := & ocv1.ClusterCatalog {}
255263 t .Log ("Ensuring ClusterCatalog has Status.Condition of Progressing with a status == True and reason == Succeeded" )
256264 require .EventuallyWithT (t , func (ct * assert.CollectT ) {
257- err := c .Get (context .Background (), types.NamespacedName {Name : testCatalogName }, catalog )
265+ err := c .Get (context .Background (), types.NamespacedName {Name : catalogName }, catalog )
258266 require .NoError (ct , err )
259267 cond := apimeta .FindStatusCondition (catalog .Status .Conditions , ocv1 .TypeProgressing )
260268 require .NotNil (ct , cond )
@@ -265,11 +273,11 @@ func ValidateCatalogUnpack(t *testing.T) {
265273 t .Log ("Checking that catalog has the expected metadata label" )
266274 require .NotNil (t , catalog .Labels )
267275 require .Contains (t , catalog .Labels , "olm.operatorframework.io/metadata.name" )
268- require .Equal (t , testCatalogName , catalog .Labels ["olm.operatorframework.io/metadata.name" ])
276+ require .Equal (t , catalogName , catalog .Labels ["olm.operatorframework.io/metadata.name" ])
269277
270278 t .Log ("Ensuring ClusterCatalog has Status.Condition of Type = Serving with status == True" )
271279 require .EventuallyWithT (t , func (ct * assert.CollectT ) {
272- err := c .Get (context .Background (), types.NamespacedName {Name : testCatalogName }, catalog )
280+ err := c .Get (context .Background (), types.NamespacedName {Name : catalogName }, catalog )
273281 require .NoError (ct , err )
274282 cond := apimeta .FindStatusCondition (catalog .Status .Conditions , ocv1 .TypeServing )
275283 require .NotNil (ct , cond )
0 commit comments