Skip to content

Commit 35b599e

Browse files
tmshortstevekuznetsov
authored andcommitted
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]> Upstream-repository: operator-lifecycle-manager Upstream-commit: fbd6f95305bc736c5988945f88a631e77d49379d
1 parent 86c2c2f commit 35b599e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

staging/operator-lifecycle-manager/test/e2e/subscription_e2e_test.go

Lines changed: 10 additions & 3 deletions
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)