Skip to content

Commit acf3db0

Browse files
authored
Mitigate flaky install plan e2e test (#2668)
Signed-off-by: perdasilva <[email protected]>
1 parent 515b3ae commit acf3db0

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

test/e2e/subscription_e2e_test.go

+20-3
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,7 @@ var _ = Describe("Subscription", func() {
10231023
// - Delete the referenced InstallPlan
10241024
// - Wait for sub to have status condition SubscriptionInstallPlanMissing true
10251025
// - 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() {
10281027
c := newKubeClient()
10291028
crc := newCRClient()
10301029

@@ -1117,7 +1116,25 @@ var _ = Describe("Subscription", func() {
11171116
// Wait for sub to have status condition SubscriptionInstallPlanPending true and reason Installing
11181117
sub, err = fetchSubscription(crc, generatedNamespace.GetName(), subName, func(s *operatorsv1alpha1.Subscription) bool {
11191118
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
11211138
})
11221139
Expect(err).ToNot(HaveOccurred())
11231140

0 commit comments

Comments
 (0)