Skip to content

Commit

Permalink
Fix e2e where subscription is updated
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tmshort committed Oct 25, 2023
1 parent c9d8781 commit fbd6f95
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/e2e/subscription_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,10 +763,17 @@ var _ = Describe("Subscription", func() {
Expect(err).NotTo(HaveOccurred())
Expect(sub).ToNot(BeNil())

// Update sub to target an existing CatalogSource
sub.Spec.CatalogSource = catalogSourceName
By("updating the subscription to target an existing catsrc")
Eventually(func() error {
_, err := crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Update(context.Background(), sub, metav1.UpdateOptions{})
sub, err := crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Get(context.Background(), testSubscriptionName, metav1.GetOptions{})
if err != nil {
return err
}
if sub == nil {
return fmt.Errorf("subscription is nil")
}
sub.Spec.CatalogSource = catalogSourceName
_, err = crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Update(context.Background(), sub, metav1.UpdateOptions{})
return err
}).Should(Succeed())

Expand Down

0 comments on commit fbd6f95

Please sign in to comment.