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

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

commit 67f867144e52950eb93c664920c21dcd837b824f
Author: Pasquale Congiusti <pasquale.congiu...@gmail.com>
AuthorDate: Thu May 4 16:16:45 2023 +0200

    chore: bind with operator id
---
 e2e/knative/kamelet_test.go       | 35 ++++++++++++-----------------------
 e2e/native/native_binding_test.go | 18 ++++--------------
 2 files changed, 16 insertions(+), 37 deletions(-)

diff --git a/e2e/knative/kamelet_test.go b/e2e/knative/kamelet_test.go
index 218b997d7..a89835fd0 100644
--- a/e2e/knative/kamelet_test.go
+++ b/e2e/knative/kamelet_test.go
@@ -39,32 +39,21 @@ import (
 // Test that a Pipe can be changed and the changes are propagated to the 
Integration
 func TestKameletChange(t *testing.T) {
        RegisterTestingT(t)
+       timerPipe := "timer-binding"
 
        knChannel := "test-kamelet-messages"
+       knChannelConf := fmt.Sprintf("%s:InMemoryChannel:%s", 
messaging.SchemeGroupVersion.String(), knChannel)
        timerSource := "my-timer-source"
        Expect(CreateTimerKamelet(ns, timerSource)()).To(Succeed())
        Expect(CreateKnativeChannel(ns, knChannel)()).To(Succeed())
+       // Consumer route that will read from the KNative channel
        Expect(KamelRunWithID(operatorID, ns, 
"files/test-kamelet-display.groovy", "-w").Execute()).To(Succeed())
 
-       from := corev1.ObjectReference{
-               Kind:       "Kamelet",
-               APIVersion: v1.SchemeGroupVersion.String(),
-               Name:       timerSource,
-       }
-
-       to := corev1.ObjectReference{
-               Kind:       "InMemoryChannel",
-               Name:       knChannel,
-               APIVersion: messaging.SchemeGroupVersion.String(),
-       }
-
-       timerPipe := "timer-binding"
-
        // Create the Pipe
-       Expect(KamelBind(ns,
-               from.Name,
-               to.Name,
-               "-p", "source.message=message is Hello",
+       Expect(KamelBindWithID(operatorID, ns,
+               timerSource,
+               knChannelConf,
+               "-p", "source.message=HelloKNative!",
                "--annotation", "trait.camel.apache.org/health.enabled=true",
                "--annotation", 
"trait.camel.apache.org/health.readiness-initial-delay=10",
                "--name", timerPipe,
@@ -72,7 +61,7 @@ func TestKameletChange(t *testing.T) {
 
        Eventually(IntegrationPodPhase(ns, timerPipe), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
        Eventually(IntegrationConditionStatus(ns, timerPipe, 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-       Eventually(IntegrationLogs(ns, timerPipe), 
TestTimeoutShort).Should(ContainSubstring("message is Hello"))
+       Eventually(IntegrationLogs(ns, "test-kamelet-display"), 
TestTimeoutShort).Should(ContainSubstring("HelloKNative!"))
 
        Eventually(PipeCondition(ns, timerPipe, v1.PipeConditionReady), 
TestTimeoutMedium).Should(And(
                WithTransform(PipeConditionStatusExtract, 
Equal(corev1.ConditionTrue)),
@@ -81,9 +70,9 @@ func TestKameletChange(t *testing.T) {
        ))
 
        // Update the Pipe
-       Expect(KamelBind(ns,
-               from.Name,
-               to.Name,
+       Expect(KamelBindWithID(operatorID, ns,
+               timerSource,
+               knChannelConf,
                "-p", "source.message=message is Hi",
                "--annotation", "trait.camel.apache.org/health.enabled=true",
                "--annotation", 
"trait.camel.apache.org/health.readiness-initial-delay=10",
@@ -92,7 +81,7 @@ func TestKameletChange(t *testing.T) {
 
        Eventually(IntegrationPodPhase(ns, timerPipe), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
        Eventually(IntegrationConditionStatus(ns, timerPipe, 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-       Eventually(IntegrationLogs(ns, timerPipe), 
TestTimeoutShort).Should(ContainSubstring("message is Hi"))
+       Eventually(IntegrationLogs(ns, "test-kamelet-display"), 
TestTimeoutShort).Should(ContainSubstring("message is Hi"))
 
        Eventually(PipeCondition(ns, timerPipe, v1.PipeConditionReady), 
TestTimeoutMedium).
                Should(And(
diff --git a/e2e/native/native_binding_test.go 
b/e2e/native/native_binding_test.go
index 8207e4d12..57e3cf9c9 100644
--- a/e2e/native/native_binding_test.go
+++ b/e2e/native/native_binding_test.go
@@ -55,24 +55,14 @@ func TestNativeBinding(t *testing.T) {
                        },
                ))
 
-               from := corev1.ObjectReference{
-                       Kind:       "Kamelet",
-                       Name:       "timer-source",
-                       APIVersion: v1.SchemeGroupVersion.String(),
-               }
-               to := corev1.ObjectReference{
-                       Kind:       "Kamelet",
-                       Name:       "log-sink",
-                       APIVersion: v1.SchemeGroupVersion.String(),
-               }
                message := "Magicstring!"
 
                t.Run("binding with native build", func(t *testing.T) {
                        bindingName := "native-binding"
-                       Expect(KamelBind(ns,
-                               from.Name,
-                               to.Name,
-                               "-p", "source.message=message",
+                       Expect(KamelBindWithID(operatorID, ns,
+                               "timer-source",
+                               "log-sink",
+                               "-p", "source.message="+message,
                                "--annotation", 
"trait.camel.apache.org/quarkus.package-type=native",
                                "--name", bindingName,
                        ).Execute()).To(Succeed())

Reply via email to