@@ -348,8 +348,31 @@ var _ = Describe("Reconcile Test", func() {
348
348
Expect (err ).NotTo (HaveOccurred ())
349
349
})
350
350
351
+ It ("verify operator status when bundle deployment status is stale while being created" , func () {
352
+ res , err := reconciler .Reconcile (ctx , ctrl.Request {NamespacedName : opKey })
353
+ Expect (res ).To (Equal (ctrl.Result {}))
354
+ Expect (err ).NotTo (HaveOccurred ())
355
+
356
+ By ("fetching the updated operator after reconcile" )
357
+ op := & operatorsv1alpha1.Operator {}
358
+ err = cl .Get (ctx , opKey , op )
359
+ Expect (err ).NotTo (HaveOccurred ())
360
+
361
+ By ("checking the expected conditions" )
362
+ cond := apimeta .FindStatusCondition (op .Status .Conditions , operatorsv1alpha1 .TypeReady )
363
+ Expect (cond ).NotTo (BeNil ())
364
+ Expect (cond .Status ).To (Equal (metav1 .ConditionUnknown ))
365
+ Expect (cond .Reason ).To (Equal (operatorsv1alpha1 .ReasonInstallationStatusUnknown ))
366
+ Expect (cond .Message ).To (Equal (fmt .Sprintf ("waiting for bundleDeployment %q status to be updated. BundleDeployment conditions out of date." , bd .Name )))
367
+ })
368
+
351
369
It ("verify operator status when bundle deployment is waiting to be created" , func () {
352
370
By ("running reconcile" )
371
+ bd .Status .ObservedGeneration = bd .GetGeneration ()
372
+ By ("updating the status of bundleDeployment" )
373
+ err := cl .Status ().Update (ctx , bd )
374
+ Expect (err ).NotTo (HaveOccurred ())
375
+
353
376
res , err := reconciler .Reconcile (ctx , ctrl.Request {NamespacedName : opKey })
354
377
Expect (res ).To (Equal (ctrl.Result {}))
355
378
Expect (err ).NotTo (HaveOccurred ())
@@ -364,7 +387,7 @@ var _ = Describe("Reconcile Test", func() {
364
387
Expect (cond ).NotTo (BeNil ())
365
388
Expect (cond .Status ).To (Equal (metav1 .ConditionUnknown ))
366
389
Expect (cond .Reason ).To (Equal (operatorsv1alpha1 .ReasonInstallationStatusUnknown ))
367
- Expect (cond .Message ).To (ContainSubstring ( ` waiting for bundleDeployment` ))
390
+ Expect (cond .Message ).To (Equal ( fmt . Sprintf ( " waiting for bundleDeployment %q status to be updated" , bd . Name ) ))
368
391
})
369
392
370
393
It ("verify operator status when `HasValidBundle` condition of rukpak is false" , func () {
@@ -374,6 +397,7 @@ var _ = Describe("Reconcile Test", func() {
374
397
Message : "failed to unpack" ,
375
398
Reason : rukpakv1alpha1 .ReasonUnpackFailed ,
376
399
})
400
+ bd .Status .ObservedGeneration = bd .GetGeneration ()
377
401
378
402
By ("updating the status of bundleDeployment" )
379
403
err := cl .Status ().Update (ctx , bd )
@@ -404,6 +428,7 @@ var _ = Describe("Reconcile Test", func() {
404
428
Message : "failed to install" ,
405
429
Reason : rukpakv1alpha1 .ReasonInstallFailed ,
406
430
})
431
+ bd .Status .ObservedGeneration = bd .GetGeneration ()
407
432
408
433
By ("updating the status of bundleDeployment" )
409
434
err := cl .Status ().Update (ctx , bd )
@@ -434,6 +459,7 @@ var _ = Describe("Reconcile Test", func() {
434
459
Message : "operator installed successfully" ,
435
460
Reason : rukpakv1alpha1 .ReasonInstallationSucceeded ,
436
461
})
462
+ bd .Status .ObservedGeneration = bd .GetGeneration ()
437
463
438
464
By ("updating the status of bundleDeployment" )
439
465
err := cl .Status ().Update (ctx , bd )
@@ -471,6 +497,7 @@ var _ = Describe("Reconcile Test", func() {
471
497
Message : "installing" ,
472
498
Reason : rukpakv1alpha1 .ReasonInstallationSucceeded ,
473
499
})
500
+ bd .Status .ObservedGeneration = bd .GetGeneration ()
474
501
475
502
By ("updating the status of bundleDeployment" )
476
503
err := cl .Status ().Update (ctx , bd )
@@ -501,6 +528,7 @@ var _ = Describe("Reconcile Test", func() {
501
528
Message : "installing" ,
502
529
Reason : rukpakv1alpha1 .ReasonInstallationSucceeded ,
503
530
})
531
+ bd .Status .ObservedGeneration = bd .GetGeneration ()
504
532
505
533
By ("updating the status of bundleDeployment" )
506
534
err := cl .Status ().Update (ctx , bd )
0 commit comments