@@ -210,9 +210,40 @@ func testInit(t *testing.T) (*ocv1.ClusterExtension, *catalogd.ClusterCatalog, *
210
210
211
211
sa , err := createServiceAccount (context .Background (), name , clusterExtensionName )
212
212
require .NoError (t , err )
213
+
214
+ validateCatalogUnpack (t )
215
+
213
216
return clusterExtension , extensionCatalog , sa , ns
214
217
}
215
218
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
+
216
247
func ensureNoExtensionResources (t * testing.T , clusterExtensionName string ) {
217
248
ls := labels.Set {"olm.operatorframework.io/owner-name" : clusterExtensionName }
218
249
0 commit comments