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

astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit eac1eeaf78300c235aa91e1f3227171af66c3d8d
Author: nicolaferraro <[email protected]>
AuthorDate: Fri Aug 20 09:24:57 2021 +0200

    Fix #2486: use merge patch in tests
---
 e2e/support/test_support.go | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 50ac60c..f883844 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -36,9 +36,11 @@ import (
        "testing"
        "time"
 
+       "github.com/apache/camel-k/pkg/util/patch"
        "github.com/google/uuid"
        "github.com/onsi/gomega"
        "github.com/spf13/cobra"
+       "k8s.io/apimachinery/pkg/types"
 
        appsv1 "k8s.io/api/apps/v1"
        "k8s.io/api/batch/v1beta1"
@@ -637,8 +639,16 @@ func UpdateKameletBinding(ns string, name string, upd 
func(it *v1alpha1.KameletB
        if klb == nil {
                return fmt.Errorf("no kamelet binding named %s found", name)
        }
-       upd(klb)
-       return TestClient().Update(TestContext, klb)
+       target := klb.DeepCopy()
+       upd(target)
+       // For some reasons, full patch fails on some clusters
+       p, err := patch.PositiveMergePatch(klb, target)
+       if err != nil {
+               return err
+       } else if len(p) == 0 {
+               return nil
+       }
+       return TestClient().Patch(TestContext, target, 
ctrl.RawPatch(types.MergePatchType, p))
 }
 
 func ScaleKameletBinding(ns string, name string, replicas int32) error {

Reply via email to