@@ -1023,8 +1023,7 @@ var _ = Describe("Subscription", func() {
1023
1023
// - Delete the referenced InstallPlan
1024
1024
// - Wait for sub to have status condition SubscriptionInstallPlanMissing true
1025
1025
// - Ensure original non-InstallPlan status conditions remain after InstallPlan transitions
1026
- // issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2645
1027
- It ("[FLAKE] can reconcile InstallPlan status" , func () {
1026
+ It ("can reconcile InstallPlan status" , func () {
1028
1027
c := newKubeClient ()
1029
1028
crc := newCRClient ()
1030
1029
@@ -1117,7 +1116,25 @@ var _ = Describe("Subscription", func() {
1117
1116
// Wait for sub to have status condition SubscriptionInstallPlanPending true and reason Installing
1118
1117
sub , err = fetchSubscription (crc , generatedNamespace .GetName (), subName , func (s * operatorsv1alpha1.Subscription ) bool {
1119
1118
cond := s .Status .GetCondition (operatorsv1alpha1 .SubscriptionInstallPlanPending )
1120
- return cond .Status == corev1 .ConditionTrue && cond .Reason == string (operatorsv1alpha1 .InstallPlanPhaseInstalling )
1119
+ isConditionPresent := cond .Status == corev1 .ConditionTrue && cond .Reason == string (operatorsv1alpha1 .InstallPlanPhaseInstalling )
1120
+
1121
+ if isConditionPresent {
1122
+ return true
1123
+ }
1124
+
1125
+ // Sometimes the transition from installing to complete can be so quick that the test does not capture
1126
+ // the condition in the subscription before it is removed. To mitigate this, we check if the installplan
1127
+ // has transitioned to complete and exit out the fetch subscription loop if so.
1128
+ // This is a mitigation. We should probably fix this test appropriately.
1129
+ // issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2667
1130
+ ip , err := crc .OperatorsV1alpha1 ().InstallPlans (generatedNamespace .GetName ()).Get (context .TODO (), plan .Name , metav1.GetOptions {})
1131
+ if err != nil {
1132
+ // retry on failure
1133
+ return false
1134
+ }
1135
+ isInstallPlanComplete := ip .Status .Phase == operatorsv1alpha1 .InstallPlanPhaseComplete
1136
+
1137
+ return isInstallPlanComplete
1121
1138
})
1122
1139
Expect (err ).ToNot (HaveOccurred ())
1123
1140
0 commit comments