Skip to content

Commit fbd6f95

Browse files
committed
Fix e2e where subscription is updated
On occasion, the subscription resource that needs to be updated is stale (even though we just got it), so get the subscription before updating. Should resolve: > Operation cannot be fulfilled on subscriptions.operators.coreos.com "mysubscription": the object has been modified; please apply your changes to the latest version and try again Signed-off-by: Todd Short <[email protected]>
1 parent c9d8781 commit fbd6f95

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/e2e/subscription_e2e_test.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -763,10 +763,17 @@ var _ = Describe("Subscription", func() {
763763
Expect(err).NotTo(HaveOccurred())
764764
Expect(sub).ToNot(BeNil())
765765

766-
// Update sub to target an existing CatalogSource
767-
sub.Spec.CatalogSource = catalogSourceName
766+
By("updating the subscription to target an existing catsrc")
768767
Eventually(func() error {
769-
_, err := crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Update(context.Background(), sub, metav1.UpdateOptions{})
768+
sub, err := crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Get(context.Background(), testSubscriptionName, metav1.GetOptions{})
769+
if err != nil {
770+
return err
771+
}
772+
if sub == nil {
773+
return fmt.Errorf("subscription is nil")
774+
}
775+
sub.Spec.CatalogSource = catalogSourceName
776+
_, err = crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Update(context.Background(), sub, metav1.UpdateOptions{})
770777
return err
771778
}).Should(Succeed())
772779

0 commit comments

Comments
 (0)