Skip to content

Commit b0f185b

Browse files
committed
fix(e2e): Using Evetually to check subscription state
Signed-off-by: Vu Dinh <[email protected]>
1 parent 6b39352 commit b0f185b

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Diff for: test/e2e/subscription_e2e_test.go

+16-4
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,23 @@ var _ = Describe("Subscription", func() {
138138
cleanup, _ := createSubscription(GinkgoT(), crc, testNamespace, testSubscriptionName, testPackageName, betaChannel, operatorsv1alpha1.ApprovalAutomatic)
139139
defer cleanup()
140140

141-
subscription, err := fetchSubscription(crc, testNamespace, testSubscriptionName, subscriptionStateAtLatestChecker)
142-
require.NoError(GinkgoT(), err)
143-
require.NotNil(GinkgoT(), subscription)
141+
var currentCSV string
142+
Eventually(func() bool {
143+
fetched, err := crc.OperatorsV1alpha1().Subscriptions(testNamespace).Get(context.TODO(), testSubscriptionName, metav1.GetOptions{})
144+
if err != nil {
145+
return false
146+
}
147+
if fetch == nil {
148+
return false
149+
}
150+
if fetched.Status != nil {
151+
currentCSV = fetched.Status.CurrentCSV
152+
return fetched.Status.State == operatorsv1alpha1.SubscriptionStateAtLatest
153+
}
154+
return false
155+
}, 5*time.Minute, 10*time.Second).Should(BeTrue())
144156

145-
csv, err := fetchCSV(crc, subscription.Status.CurrentCSV, testNamespace, buildCSVConditionChecker(operatorsv1alpha1.CSVPhaseSucceeded))
157+
csv, err := fetchCSV(crc, currentCSV, testNamespace, buildCSVConditionChecker(operatorsv1alpha1.CSVPhaseSucceeded))
146158
require.NoError(GinkgoT(), err)
147159

148160
// Check for the olm.package property as a proxy for

0 commit comments

Comments
 (0)