Skip to content

Commit

Permalink
fix(e2e): Using Eventually to check subscription state (#2396)
Browse files Browse the repository at this point in the history
Signed-off-by: Vu Dinh <vudinh@outlook.com>
  • Loading branch information
dinhxuanvu committed Oct 5, 2021
1 parent 1a6a03e commit a03dd0c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions test/e2e/subscription_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,20 @@ var _ = Describe("Subscription", func() {
cleanup, _ := createSubscription(GinkgoT(), crc, testNamespace, testSubscriptionName, testPackageName, betaChannel, operatorsv1alpha1.ApprovalAutomatic)
defer cleanup()

subscription, err := fetchSubscription(crc, testNamespace, testSubscriptionName, subscriptionStateAtLatestChecker)
require.NoError(GinkgoT(), err)
require.NotNil(GinkgoT(), subscription)
var currentCSV string
Eventually(func() bool {
fetched, err := crc.OperatorsV1alpha1().Subscriptions(testNamespace).Get(context.TODO(), testSubscriptionName, metav1.GetOptions{})
if err != nil {
return false
}
if fetched != nil {
currentCSV = fetched.Status.CurrentCSV
return fetched.Status.State == operatorsv1alpha1.SubscriptionStateAtLatest
}
return false
}, 5*time.Minute, 10*time.Second).Should(BeTrue())

csv, err := fetchCSV(crc, subscription.Status.CurrentCSV, testNamespace, buildCSVConditionChecker(operatorsv1alpha1.CSVPhaseSucceeded))
csv, err := fetchCSV(crc, currentCSV, testNamespace, buildCSVConditionChecker(operatorsv1alpha1.CSVPhaseSucceeded))
require.NoError(GinkgoT(), err)

// Check for the olm.package property as a proxy for
Expand Down

0 comments on commit a03dd0c

Please sign in to comment.