Skip to content

Commit 10f9241

Browse files
committed
Fix a flaky CRD test.
In this test, a Subscription's channel is updated, then the same Subscription is immediately fetched. If this fetch happens before the Subscription's InstallPlanRef is updated, then subsequent assertions are made against the wrong InstallPlan.
1 parent 1e03acd commit 10f9241

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/e2e/crd_e2e_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,12 @@ var _ = Describe("CRD Versions", func() {
307307
_, err = crc.OperatorsV1alpha1().Subscriptions(testNamespace).Update(context.TODO(), sub, metav1.UpdateOptions{})
308308
Expect(err).ToNot(HaveOccurred(), "could not update subscription")
309309

310+
subscriptionAtLatestWithDifferentInstallPlan := func(v *operatorsv1alpha1.Subscription) bool {
311+
return subscriptionStateAtLatestChecker(v) && v.Status.InstallPlanRef != nil && v.Status.InstallPlanRef.Name != fetchedInstallPlan.Name
312+
}
313+
310314
// fetch new subscription
311-
s, err := fetchSubscription(crc, testNamespace, subscriptionName, subscriptionStateAtLatestChecker)
315+
s, err := fetchSubscription(crc, testNamespace, subscriptionName, subscriptionAtLatestWithDifferentInstallPlan)
312316
Expect(err).ToNot(HaveOccurred())
313317
Expect(s).ToNot(BeNil())
314318
Expect(s.Status.InstallPlanRef).ToNot(Equal(nil))

0 commit comments

Comments
 (0)