You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2020/05/29 09:52:35 UTC

[camel-k] 02/03: Fix #1470: fix knative source update test

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

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

commit 00f8ec750a8a222547fee2946df8f3df017d7a86
Author: Nicola Ferraro <ni...@gmail.com>
AuthorDate: Wed May 27 15:46:10 2020 +0200

    Fix #1470: fix knative source update test
---
 e2e/knative/knative_platform_test.go | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/e2e/knative/knative_platform_test.go b/e2e/knative/knative_platform_test.go
index ad9f82e..37a7a4a 100644
--- a/e2e/knative/knative_platform_test.go
+++ b/e2e/knative/knative_platform_test.go
@@ -27,8 +27,10 @@ import (
 
 	. "github.com/apache/camel-k/e2e/support"
 	"github.com/apache/camel-k/pkg/apis/camel/v1"
+	"github.com/apache/camel-k/pkg/util/flows"
 	"github.com/apache/camel-k/pkg/util/knative"
 	. "github.com/onsi/gomega"
+	"github.com/stretchr/testify/assert"
 	corev1 "k8s.io/api/core/v1"
 )
 
@@ -52,8 +54,13 @@ func TestKnativePlatformTest(t *testing.T) {
 			Eventually(IntegrationProfile(ns, "yaml"), TestTimeoutShort).Should(Equal(v1.TraitProfile(string(cluster))))
 			// Change something in the integration to produce a redeploy
 			Expect(UpdateIntegration(ns, "yaml", func(it *v1.Integration) {
-				it.Spec.Profile = v1.TraitProfile("")
-				it.Spec.Sources[0].Content = strings.ReplaceAll(it.Spec.Sources[0].Content, "string!", "string!!!")
+				it.Spec.Profile = ""
+				content, err := flows.Marshal(it.Spec.Flows)
+				assert.NoError(t, err)
+				newData := strings.ReplaceAll(string(content), "string!", "string!!!")
+				newFlows, err := flows.UnmarshalString(newData)
+				assert.NoError(t, err)
+				it.Spec.Flows = newFlows
 			})).To(BeNil())
 			// Spec profile should be reset by "kamel run"
 			Eventually(IntegrationSpecProfile(ns, "yaml")).Should(Equal(v1.TraitProfile("")))