@@ -150,14 +150,12 @@ func TestClusterExtensionResolutionSuccessfulUnpackFails(t *testing.T) {
150
150
})
151
151
res , err := reconciler .Reconcile (ctx , ctrl.Request {NamespacedName : extKey })
152
152
require .Equal (t , ctrl.Result {}, res )
153
- require .Error (t , err )
154
153
155
154
t .Log ("By fetching updated cluster extension after reconcile" )
156
155
require .NoError (t , cl .Get (ctx , extKey , clusterExtension ))
157
156
158
157
t .Log ("By checking the status fields" )
159
- expectedBundleMetadata := ocv1alpha1.BundleMetadata {Name : "prometheus.v1.0.0" , Version : "1.0.0" }
160
- require .Equal (t , expectedBundleMetadata , clusterExtension .Status .Resolution .Bundle )
158
+ require .Equal (t , ocv1alpha1.BundleMetadata {Name : "prometheus.v1.0.0" , Version : "1.0.0" }, clusterExtension .Status .Resolution .Bundle )
161
159
require .Empty (t , clusterExtension .Status .Install )
162
160
163
161
t .Log ("By checking the expected conditions" )
@@ -167,18 +165,6 @@ func TestClusterExtensionResolutionSuccessfulUnpackFails(t *testing.T) {
167
165
require .Equal (t , ocv1alpha1 .ReasonSuccess , resolvedCond .Reason )
168
166
require .
Equal (
t ,
"resolved to \" quay.io/operatorhubio/[email protected] \" " ,
resolvedCond .
Message )
169
167
170
- t .Log ("By checking the expected unpacked conditions" )
171
- unpackedCond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1alpha1 .TypeUnpacked )
172
- require .NotNil (t , unpackedCond )
173
- require .Equal (t , metav1 .ConditionFalse , unpackedCond .Status )
174
- require .Equal (t , ocv1alpha1 .ReasonFailed , unpackedCond .Reason )
175
-
176
- progressingCond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1alpha1 .TypeProgressing )
177
- require .NotNil (t , progressingCond )
178
- require .Equal (t , metav1 .ConditionTrue , progressingCond .Status )
179
- require .Equal (t , ocv1alpha1 .ReasonRetrying , progressingCond .Reason )
180
- require .Contains (t , progressingCond .Message , fmt .Sprintf ("for resolved bundle %q with version %q" , expectedBundleMetadata .Name , expectedBundleMetadata .Version ))
181
-
182
168
require .NoError (t , cl .DeleteAllOf (ctx , & ocv1alpha1.ClusterExtension {}))
183
169
}
184
170
@@ -233,9 +219,12 @@ func TestClusterExtensionUnpackUnexpectedState(t *testing.T) {
233
219
Image :
"quay.io/operatorhubio/[email protected] " ,
234
220
}, & v , nil , nil
235
221
})
222
+
236
223
require .Panics (t , func () {
237
224
_ , _ = reconciler .Reconcile (ctx , ctrl.Request {NamespacedName : extKey })
238
225
}, "reconciliation should panic on unknown unpack state" )
226
+
227
+ require .NoError (t , cl .DeleteAllOf (ctx , & ocv1alpha1.ClusterExtension {}))
239
228
}
240
229
241
230
func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails (t * testing.T ) {
@@ -312,25 +301,6 @@ func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails(t *testing.T)
312
301
require .Equal (t , ocv1alpha1 .ReasonSuccess , resolvedCond .Reason )
313
302
require .
Equal (
t ,
"resolved to \" quay.io/operatorhubio/[email protected] \" " ,
resolvedCond .
Message )
314
303
315
- t .Log ("By checking the expected unpacked conditions" )
316
- unpackedCond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1alpha1 .TypeUnpacked )
317
- require .NotNil (t , unpackedCond )
318
- require .Equal (t , metav1 .ConditionTrue , unpackedCond .Status )
319
- require .Equal (t , ocv1alpha1 .ReasonSuccess , unpackedCond .Reason )
320
-
321
- t .Log ("By checking the expected installed conditions" )
322
- installedCond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1alpha1 .TypeInstalled )
323
- require .NotNil (t , installedCond )
324
- require .Equal (t , metav1 .ConditionFalse , installedCond .Status )
325
- require .Equal (t , ocv1alpha1 .ReasonFailed , installedCond .Reason )
326
-
327
- t .Log ("By checking the expected progressing conditions" )
328
- progressingCond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1alpha1 .TypeProgressing )
329
- require .NotNil (t , progressingCond )
330
- require .Equal (t , metav1 .ConditionTrue , progressingCond .Status )
331
- require .Equal (t , ocv1alpha1 .ReasonRetrying , progressingCond .Reason )
332
- require .Contains (t , progressingCond .Message , fmt .Sprintf ("for resolved bundle %q with version %q" , expectedBundleMetadata .Name , expectedBundleMetadata .Version ))
333
-
334
304
require .NoError (t , cl .DeleteAllOf (ctx , & ocv1alpha1.ClusterExtension {}))
335
305
}
336
306
@@ -410,12 +380,6 @@ func TestClusterExtensionManagerFailed(t *testing.T) {
410
380
require .Equal (t , ocv1alpha1 .ReasonSuccess , resolvedCond .Reason )
411
381
require .
Equal (
t ,
"resolved to \" quay.io/operatorhubio/[email protected] \" " ,
resolvedCond .
Message )
412
382
413
- t .Log ("By checking the expected unpacked conditions" )
414
- unpackedCond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1alpha1 .TypeUnpacked )
415
- require .NotNil (t , unpackedCond )
416
- require .Equal (t , metav1 .ConditionTrue , unpackedCond .Status )
417
- require .Equal (t , ocv1alpha1 .ReasonSuccess , unpackedCond .Reason )
418
-
419
383
t .Log ("By checking the expected installed conditions" )
420
384
installedCond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1alpha1 .TypeInstalled )
421
385
require .NotNil (t , installedCond )
@@ -510,12 +474,6 @@ func TestClusterExtensionManagedContentCacheWatchFail(t *testing.T) {
510
474
require .Equal (t , ocv1alpha1 .ReasonSuccess , resolvedCond .Reason )
511
475
require .
Equal (
t ,
"resolved to \" quay.io/operatorhubio/[email protected] \" " ,
resolvedCond .
Message )
512
476
513
- t .Log ("By checking the expected unpacked conditions" )
514
- unpackedCond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1alpha1 .TypeUnpacked )
515
- require .NotNil (t , unpackedCond )
516
- require .Equal (t , metav1 .ConditionTrue , unpackedCond .Status )
517
- require .Equal (t , ocv1alpha1 .ReasonSuccess , unpackedCond .Reason )
518
-
519
477
t .Log ("By checking the expected installed conditions" )
520
478
installedCond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1alpha1 .TypeInstalled )
521
479
require .NotNil (t , installedCond )
@@ -607,12 +565,6 @@ func TestClusterExtensionInstallationSucceeds(t *testing.T) {
607
565
require .Equal (t , ocv1alpha1 .ReasonSuccess , resolvedCond .Reason )
608
566
require .
Equal (
t ,
"resolved to \" quay.io/operatorhubio/[email protected] \" " ,
resolvedCond .
Message )
609
567
610
- t .Log ("By checking the expected unpacked conditions" )
611
- unpackedCond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1alpha1 .TypeUnpacked )
612
- require .NotNil (t , unpackedCond )
613
- require .Equal (t , metav1 .ConditionTrue , unpackedCond .Status )
614
- require .Equal (t , ocv1alpha1 .ReasonSuccess , unpackedCond .Reason )
615
-
616
568
t .Log ("By checking the expected installed conditions" )
617
569
installedCond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1alpha1 .TypeInstalled )
618
570
require .NotNil (t , installedCond )
0 commit comments