Skip to content

Mitigate flaky install plan e2e test #2668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions test/e2e/subscription_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1023,8 +1023,7 @@ var _ = Describe("Subscription", func() {
// - Delete the referenced InstallPlan
// - Wait for sub to have status condition SubscriptionInstallPlanMissing true
// - Ensure original non-InstallPlan status conditions remain after InstallPlan transitions
// issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2645
It("[FLAKE] can reconcile InstallPlan status", func() {
It("can reconcile InstallPlan status", func() {
c := newKubeClient()
crc := newCRClient()

Expand Down Expand Up @@ -1117,7 +1116,25 @@ var _ = Describe("Subscription", func() {
// Wait for sub to have status condition SubscriptionInstallPlanPending true and reason Installing
sub, err = fetchSubscription(crc, generatedNamespace.GetName(), subName, func(s *operatorsv1alpha1.Subscription) bool {
cond := s.Status.GetCondition(operatorsv1alpha1.SubscriptionInstallPlanPending)
return cond.Status == corev1.ConditionTrue && cond.Reason == string(operatorsv1alpha1.InstallPlanPhaseInstalling)
isConditionPresent := cond.Status == corev1.ConditionTrue && cond.Reason == string(operatorsv1alpha1.InstallPlanPhaseInstalling)

if isConditionPresent {
return true
}

// Sometimes the transition from installing to complete can be so quick that the test does not capture
// the condition in the subscription before it is removed. To mitigate this, we check if the installplan
// has transitioned to complete and exit out the fetch subscription loop if so.
// This is a mitigation. We should probably fix this test appropriately.
// issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2667
ip, err := crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Get(context.TODO(), plan.Name, metav1.GetOptions{})
if err != nil {
// retry on failure
return false
}
isInstallPlanComplete := ip.Status.Phase == operatorsv1alpha1.InstallPlanPhaseComplete

return isInstallPlanComplete
})
Expect(err).ToNot(HaveOccurred())

Expand Down