@@ -298,6 +298,8 @@ var _ = Describe("Garbage collection for dependent resources", func() {
298
298
sourceName = "test-catalog"
299
299
imageName = "quay.io/olmtest/single-bundle-index:objects"
300
300
)
301
+ var installPlanRef string
302
+
301
303
// create catalog source
302
304
source := & v1alpha1.CatalogSource {
303
305
TypeMeta : metav1.TypeMeta {
@@ -322,10 +324,16 @@ var _ = Describe("Garbage collection for dependent resources", func() {
322
324
_ = createSubscriptionForCatalog (operatorClient , source .GetNamespace (), subName , source .GetName (), packageName , channelName , "" , v1alpha1 .ApprovalAutomatic )
323
325
324
326
// Wait for the Subscription to succeed
325
- Eventually (func () error {
326
- _ , err = fetchSubscription (operatorClient , testNamespace , subName , subscriptionStateAtLatestChecker )
327
- return err
328
- }).Should (BeNil ())
327
+ sub , err := fetchSubscription (operatorClient , testNamespace , subName , subscriptionStateAtLatestChecker )
328
+ Expect (err ).ToNot (HaveOccurred (), "could not get subscription at latest status" )
329
+
330
+ installPlanRef = sub .Status .InstallPlanRef .Name
331
+
332
+ // Wait for the installplan to complete (5 minute timeout)
333
+ _ , err = fetchInstallPlan (GinkgoT (), operatorClient , installPlanRef , buildInstallPlanPhaseCheckFunc (v1alpha1 .InstallPlanPhaseComplete ))
334
+ Expect (err ).ToNot (HaveOccurred (), "could not get installplan at complete phase" )
335
+
336
+ ctx .Ctx ().Logf ("install plan %s completed" , installPlanRef )
329
337
330
338
// confirm extra bundle objects (secret and configmap) are installed
331
339
Eventually (func () error {
@@ -393,6 +401,8 @@ var _ = Describe("Garbage collection for dependent resources", func() {
393
401
sourceName = "test-catalog"
394
402
imageName = "quay.io/olmtest/single-bundle-index:objects-upgrade-samename"
395
403
)
404
+
405
+ var installPlanRef string
396
406
// create catalog source
397
407
source := & v1alpha1.CatalogSource {
398
408
TypeMeta : metav1.TypeMeta {
@@ -417,10 +427,14 @@ var _ = Describe("Garbage collection for dependent resources", func() {
417
427
_ = createSubscriptionForCatalog (operatorClient , source .GetNamespace (), subName , source .GetName (), packageName , channelName , "" , v1alpha1 .ApprovalAutomatic )
418
428
419
429
// Wait for the Subscription to succeed
420
- Eventually (func () error {
421
- _ , err = fetchSubscription (operatorClient , testNamespace , subName , subscriptionStateAtLatestChecker )
422
- return err
423
- }).Should (BeNil ())
430
+ sub , err := fetchSubscription (operatorClient , testNamespace , subName , subscriptionStateAtLatestChecker )
431
+ Expect (err ).ToNot (HaveOccurred (), "could not get subscription at latest status" )
432
+
433
+ installPlanRef = sub .Status .InstallPlanRef .Name
434
+
435
+ // Wait for the installplan to complete (5 minute timeout)
436
+ _ , err = fetchInstallPlan (GinkgoT (), operatorClient , installPlanRef , buildInstallPlanPhaseCheckFunc (v1alpha1 .InstallPlanPhaseComplete ))
437
+ Expect (err ).ToNot (HaveOccurred (), "could not get installplan at complete phase" )
424
438
425
439
Eventually (func () error {
426
440
_ , err := kubeClient .GetConfigMap (testNamespace , configmapName )
@@ -433,6 +447,7 @@ var _ = Describe("Garbage collection for dependent resources", func() {
433
447
upgradeChannelName = "beta"
434
448
newCSVname = "busybox.v3.0.0"
435
449
)
450
+ var installPlanRef string
436
451
437
452
BeforeEach (func () {
438
453
// update subscription first
@@ -445,10 +460,14 @@ var _ = Describe("Garbage collection for dependent resources", func() {
445
460
Expect (err ).ToNot (HaveOccurred (), "could not update subscription" )
446
461
447
462
// Wait for the Subscription to succeed
448
- Eventually (func () error {
449
- _ , err = fetchSubscription (operatorClient , testNamespace , subName , subscriptionStateAtLatestChecker )
450
- return err
451
- }).Should (BeNil ())
463
+ sub , err = fetchSubscription (operatorClient , testNamespace , subName , subscriptionStateAtLatestChecker )
464
+ Expect (err ).ToNot (HaveOccurred (), "could not get subscription at latest status" )
465
+
466
+ installPlanRef = sub .Status .InstallPlanRef .Name
467
+
468
+ // Wait for the installplan to complete (5 minute timeout)
469
+ _ , err = fetchInstallPlan (GinkgoT (), operatorClient , installPlanRef , buildInstallPlanPhaseCheckFunc (v1alpha1 .InstallPlanPhaseComplete ))
470
+ Expect (err ).ToNot (HaveOccurred (), "could not get installplan at complete phase" )
452
471
453
472
// Ensure the new csv is installed
454
473
Eventually (func () error {
@@ -485,6 +504,8 @@ var _ = Describe("Garbage collection for dependent resources", func() {
485
504
sourceName = "test-catalog"
486
505
imageName = "quay.io/olmtest/single-bundle-index:objects-upgrade-diffname"
487
506
)
507
+
508
+ var installPlanRef string
488
509
// create catalog source
489
510
source := & v1alpha1.CatalogSource {
490
511
TypeMeta : metav1.TypeMeta {
@@ -509,10 +530,14 @@ var _ = Describe("Garbage collection for dependent resources", func() {
509
530
_ = createSubscriptionForCatalog (operatorClient , source .GetNamespace (), subName , source .GetName (), packageName , channelName , "" , v1alpha1 .ApprovalAutomatic )
510
531
511
532
// Wait for the Subscription to succeed
512
- Eventually (func () error {
513
- _ , err = fetchSubscription (operatorClient , testNamespace , subName , subscriptionStateAtLatestChecker )
514
- return err
515
- }).Should (BeNil ())
533
+ sub , err := fetchSubscription (operatorClient , testNamespace , subName , subscriptionStateAtLatestChecker )
534
+ Expect (err ).ToNot (HaveOccurred (), "could not get subscription at latest status" )
535
+
536
+ installPlanRef = sub .Status .InstallPlanRef .Name
537
+
538
+ // Wait for the installplan to complete (5 minute timeout)
539
+ _ , err = fetchInstallPlan (GinkgoT (), operatorClient , installPlanRef , buildInstallPlanPhaseCheckFunc (v1alpha1 .InstallPlanPhaseComplete ))
540
+ Expect (err ).ToNot (HaveOccurred (), "could not get installplan at complete phase" )
516
541
517
542
Eventually (func () error {
518
543
_ , err := kubeClient .GetConfigMap (testNamespace , configmapName )
@@ -526,6 +551,7 @@ var _ = Describe("Garbage collection for dependent resources", func() {
526
551
upgradedConfigMapName = "not-special-config"
527
552
newCSVname = "busybox.v3.0.0"
528
553
)
554
+ var installPlanRef string
529
555
530
556
BeforeEach (func () {
531
557
// update subscription first
@@ -538,10 +564,14 @@ var _ = Describe("Garbage collection for dependent resources", func() {
538
564
Expect (err ).ToNot (HaveOccurred (), "could not update subscription" )
539
565
540
566
// Wait for the Subscription to succeed
541
- Eventually (func () error {
542
- _ , err = fetchSubscription (operatorClient , testNamespace , subName , subscriptionStateAtLatestChecker )
543
- return err
544
- }).Should (BeNil ())
567
+ sub , err = fetchSubscription (operatorClient , testNamespace , subName , subscriptionStateAtLatestChecker )
568
+ Expect (err ).ToNot (HaveOccurred (), "could not get subscription at latest status" )
569
+
570
+ installPlanRef = sub .Status .InstallPlanRef .Name
571
+
572
+ // Wait for the installplan to complete (5 minute timeout)
573
+ _ , err = fetchInstallPlan (GinkgoT (), operatorClient , installPlanRef , buildInstallPlanPhaseCheckFunc (v1alpha1 .InstallPlanPhaseComplete ))
574
+ Expect (err ).ToNot (HaveOccurred (), "could not get installplan at complete phase" )
545
575
546
576
// Ensure the new csv is installed
547
577
Eventually (func () error {
0 commit comments