This is an automated email from the ASF dual-hosted git repository.

tsato pushed a commit to branch release-1.8.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit c69879463e0cd50e0c6dbd5a5213817326f2c78b
Author: Jan Bouska <[email protected]>
AuthorDate: Wed Aug 10 09:57:13 2022 +0200

    Patch the Subscription to avoid conflicts with concurrent updates performed 
by OLM
---
 e2e/upgrade/olm_upgrade_test.go | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/e2e/upgrade/olm_upgrade_test.go b/e2e/upgrade/olm_upgrade_test.go
index 4404c388f..6a3fdc3dc 100644
--- a/e2e/upgrade/olm_upgrade_test.go
+++ b/e2e/upgrade/olm_upgrade_test.go
@@ -24,7 +24,9 @@ package common
 
 import (
        "fmt"
+       "k8s.io/apimachinery/pkg/types"
        "os"
+       ctrl "sigs.k8s.io/controller-runtime/pkg/client"
        "testing"
        "time"
 
@@ -120,13 +122,14 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
 
                        if crossChannelUpgrade {
                                t.Log("Updating Camel-K subscription OLM update 
channel.")
-                               s := ckSubscription(ns)()
-                               r, err := ctrlutil.CreateOrUpdate(TestContext, 
TestClient(), s, func() error {
-                                       s.Spec.Channel = newUpdateChannel
-                                       return nil
-                               })
-                               Expect(err).To(BeNil())
-                               
Expect(r).To(Equal(ctrlutil.OperationResultUpdated))
+                               subscription := ckSubscription(ns)()
+                               Expect(subscription).NotTo(BeNil())
+
+                               // Patch the Subscription to avoid conflicts 
with concurrent updates performed by OLM
+                               patch := 
fmt.Sprintf("{\"spec\":{\"channel\":%q}}", newUpdateChannel)
+                               Expect(TestClient().Patch(TestContext, 
subscription, ctrl.RawPatch(types.MergePatchType, []byte(patch)))).To(Succeed())
+                               // Assert the response back from the API server
+                               
Expect(subscription.Spec.Channel).To(Equal(newUpdateChannel))
                        }
                        // Check the previous CSV is being replaced
                        Eventually(clusterServiceVersionPhase(func(csv 
olm.ClusterServiceVersion) bool {

Reply via email to