Skip to content

Commit a03dd0c

Browse files
authored
fix(e2e): Using Eventually to check subscription state (#2396)
Signed-off-by: Vu Dinh <[email protected]>
1 parent 1a6a03e commit a03dd0c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test/e2e/subscription_e2e_test.go

+13-4
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,20 @@ 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 fetched != nil {
148+
currentCSV = fetched.Status.CurrentCSV
149+
return fetched.Status.State == operatorsv1alpha1.SubscriptionStateAtLatest
150+
}
151+
return false
152+
}, 5*time.Minute, 10*time.Second).Should(BeTrue())
144153

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

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

0 commit comments

Comments
 (0)