From 7fe59a5b4ae83d170769a186653a4768257bf074 Mon Sep 17 00:00:00 2001 From: Vu Dinh Date: Mon, 4 Oct 2021 17:57:38 -0400 Subject: [PATCH] fix(e2e): Use Eventually for installplan status fetch operation Use `Eventually` to fetch installplan status to ensure the latest installplan being checked. Signed-off-by: Vu Dinh --- test/e2e/installplan_e2e_test.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/test/e2e/installplan_e2e_test.go b/test/e2e/installplan_e2e_test.go index 9286b6086b..b2a98d005d 100644 --- a/test/e2e/installplan_e2e_test.go +++ b/test/e2e/installplan_e2e_test.go @@ -3325,15 +3325,22 @@ var _ = Describe("Install Plan", func() { }) It("should clear clear up the condition in the InstallPlan status that contains an error message when a valid OperatorGroup is created", func() { - - // first check that a condition with a message exists - fetchedInstallPlan, err := fetchInstallPlanWithNamespace(GinkgoT(), crc, installPlanName, ns.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseInstalling)) - Expect(err).NotTo(HaveOccurred()) - Expect(fetchedInstallPlan).NotTo(BeNil()) cond := v1alpha1.InstallPlanCondition{Type: v1alpha1.InstallPlanInstalled, Status: corev1.ConditionFalse, Reason: v1alpha1.InstallPlanReasonInstallCheckFailed, Message: "no operator group found that is managing this namespace"} - Expect(fetchedInstallPlan.Status.Phase).To(Equal(v1alpha1.InstallPlanPhaseInstalling)) - Expect(hasCondition(fetchedInstallPlan, cond)).To(BeTrue()) + // first check that a condition with a message exists + Eventually(func() (bool, error) { + fetchedInstallPlan, err := fetchInstallPlanWithNamespace(GinkgoT(), crc, installPlanName, ns.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseInstalling)) + if err != nil { + return false, err + } + if fetchedInstallPlan == nil { + return false, err + } + if hasCondition(fetchedInstallPlan, cond) { + return true, nil + } + return false, nil + }).Should(BeTrue()) // Create an operatorgroup for the same namespace og := &operatorsv1.OperatorGroup{