@@ -210,9 +210,40 @@ func testInit(t *testing.T) (*ocv1.ClusterExtension, *catalogd.ClusterCatalog, *
210210
211211 sa , err := createServiceAccount (context .Background (), name , clusterExtensionName )
212212 require .NoError (t , err )
213+
214+ validateCatalogUnpack (t )
215+
213216 return clusterExtension , extensionCatalog , sa , ns
214217}
215218
219+ func validateCatalogUnpack (t * testing.T ) {
220+ catalog := & catalogd.ClusterCatalog {}
221+ t .Log ("Ensuring ClusterCatalog has Status.Condition of Progressing with a status == True and reason == Succeeded" )
222+ require .EventuallyWithT (t , func (ct * assert.CollectT ) {
223+ err := c .Get (context .Background (), types.NamespacedName {Name : testCatalogName }, catalog )
224+ assert .NoError (ct , err )
225+ cond := apimeta .FindStatusCondition (catalog .Status .Conditions , catalogd .TypeProgressing )
226+ assert .NotNil (ct , cond )
227+ assert .Equal (ct , metav1 .ConditionTrue , cond .Status )
228+ assert .Equal (ct , catalogd .ReasonSucceeded , cond .Reason )
229+ }, pollDuration , pollInterval )
230+
231+ t .Log ("Checking that catalog has the expected metadata label" )
232+ assert .NotNil (t , catalog .ObjectMeta .Labels )
233+ assert .Contains (t , catalog .ObjectMeta .Labels , "olm.operatorframework.io/metadata.name" )
234+ assert .Equal (t , testCatalogName , catalog .ObjectMeta .Labels ["olm.operatorframework.io/metadata.name" ])
235+
236+ t .Log ("Ensuring ClusterCatalog has Status.Condition of Type = Serving with status == True" )
237+ require .EventuallyWithT (t , func (ct * assert.CollectT ) {
238+ err := c .Get (context .Background (), types.NamespacedName {Name : testCatalogName }, catalog )
239+ assert .NoError (ct , err )
240+ cond := apimeta .FindStatusCondition (catalog .Status .Conditions , catalogd .TypeServing )
241+ assert .NotNil (ct , cond )
242+ assert .Equal (ct , metav1 .ConditionTrue , cond .Status )
243+ assert .Equal (ct , catalogd .ReasonAvailable , cond .Reason )
244+ }, pollDuration , pollInterval )
245+ }
246+
216247func ensureNoExtensionResources (t * testing.T , clusterExtensionName string ) {
217248 ls := labels.Set {"olm.operatorframework.io/owner-name" : clusterExtensionName }
218249
0 commit comments