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/09/23 15:03:43 UTC

[camel-k] branch master updated: Fix #1709: add e2e tests about kamelets (#1711)

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


The following commit(s) were added to refs/heads/master by this push:
     new e564604  Fix #1709: add e2e tests about kamelets (#1711)
e564604 is described below

commit e5646044faac284f58b92f16335ab836f9bbf32d
Author: Nicola Ferraro <ni...@gmail.com>
AuthorDate: Wed Sep 23 17:02:59 2020 +0200

    Fix #1709: add e2e tests about kamelets (#1711)
---
 deploy/camel-catalog-1.5.1-SNAPSHOT-main.yaml      |  4 ++--
 deploy/camel-catalog-1.5.1-SNAPSHOT-quarkus.yaml   |  4 ++--
 ...el-k.v1.2.0-snapshot.clusterserviceversion.yaml |  2 +-
 deploy/resources.go                                |  4 ++--
 docs/modules/ROOT/pages/kamelets/kamelets.adoc     | 10 ++++----
 e2e/yaks/kamelets/echo-sink.kamelet.yaml           | 27 ++++++++++++++++++++++
 e2e/yaks/kamelets/kamelet.feature                  |  4 ++++
 .../yaks/kamelets/source-sink.groovy               |  9 +++++---
 ...timer-source.yaml => timer-source-binding.yaml} |  4 ++--
 ...imer.kamelet.yaml => timer-source.kamelet.yaml} |  6 ++---
 e2e/yaks/kamelets/yaks-config.yaml                 |  6 +++--
 examples/kamelets/timer-source.kamelet.yaml        |  2 +-
 examples/kamelets/usage.groovy                     |  2 +-
 13 files changed, 60 insertions(+), 24 deletions(-)

diff --git a/deploy/camel-catalog-1.5.1-SNAPSHOT-main.yaml b/deploy/camel-catalog-1.5.1-SNAPSHOT-main.yaml
index 4604b99..07b2070 100644
--- a/deploy/camel-catalog-1.5.1-SNAPSHOT-main.yaml
+++ b/deploy/camel-catalog-1.5.1-SNAPSHOT-main.yaml
@@ -3244,8 +3244,8 @@ spec:
       artifactId: camel-kamelet
       schemes:
       - id: kamelet
-        http: true
-        passive: false
+        http: false
+        passive: true
       dependencies:
       - groupId: org.apache.camel.k
         artifactId: camel-kamelet
diff --git a/deploy/camel-catalog-1.5.1-SNAPSHOT-quarkus.yaml b/deploy/camel-catalog-1.5.1-SNAPSHOT-quarkus.yaml
index ebd0118..a0e9fd7 100644
--- a/deploy/camel-catalog-1.5.1-SNAPSHOT-quarkus.yaml
+++ b/deploy/camel-catalog-1.5.1-SNAPSHOT-quarkus.yaml
@@ -2860,8 +2860,8 @@ spec:
       artifactId: camel-kamelet
       schemes:
       - id: kamelet
-        http: true
-        passive: false
+        http: false
+        passive: true
       dependencies:
       - groupId: org.apache.camel.k
         artifactId: camel-k-quarkus-kamelet
diff --git a/deploy/olm-catalog/camel-k-dev/1.2.0-snapshot/camel-k.v1.2.0-snapshot.clusterserviceversion.yaml b/deploy/olm-catalog/camel-k-dev/1.2.0-snapshot/camel-k.v1.2.0-snapshot.clusterserviceversion.yaml
index 554812f..274dc97 100644
--- a/deploy/olm-catalog/camel-k-dev/1.2.0-snapshot/camel-k.v1.2.0-snapshot.clusterserviceversion.yaml
+++ b/deploy/olm-catalog/camel-k-dev/1.2.0-snapshot/camel-k.v1.2.0-snapshot.clusterserviceversion.yaml
@@ -120,7 +120,7 @@ metadata:
                   }
                 },
                 {
-                  "to": "direct:#property:routeId"
+                  "to": "direct:{{routeId}}"
                 }
               ],
               "uri": "timer:tick"
diff --git a/deploy/resources.go b/deploy/resources.go
index 3992cd2..ece9623 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -93,14 +93,14 @@ var assets = func() http.FileSystem {
 			modTime:          time.Time{},
 			uncompressedSize: 91527,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\xbd\x5b\x77\xdb\x38\xb2\x2f\xfe\x9e\x4f\xc1\x35\x79\xd9\x7b\xfd\x47\x98\x6e\x67\x66\x7a\xef\xfe\x3f\xd9\x72\x9c\xd8\xb1\x1d\x77\xe8\x49\x32\xf3\xd2\x0b\x22\x21\x09\x16\x49\xd0\x00\x24\xcb\xfe\xf4\x67\xe1\xc2\xab\x20\x48\x64\x19\x3e\xeb\xf8\xc1\xa4\x88\xaa\x5f\xb1\x08\x12\x97\x42\xa1\xea\x7d\x34\x79\xbd\xbf\x77\xef\xa3\x6b\x9a\x90\x42\x90\x34\x92\x2c\x92\x4b\x12\x9d\x96\x38\x59\x92\x28\x66\x73\xf9\x84\x39\x89\x2e\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\x7d\xdd\x73\xdb\x38\xb2\xef\x7b\xfe\x0a\xd6\xe6\xe5\x9c\xba\x2b\xec\x8c\xb3\xbb\x73\xce\xdc\x27\x5b\x8e\x13\x3b\xb6\xe3\x09\xbd\x49\x76\x5f\xa6\x20\x12\x92\x60\x91\x04\x0d\x40\xb2\xec\xbf\xfe\x16\x3e\xf8\x29\x08\x12\xd9\x86\xab\xae\x1f\x4c\x8a\xe8\xfe\x35\x9b\x20\xf1\xd1\x68\x74\xbf\x8f\x26\xaf\xf7\xf7\xee\x7d\x74\x4d\x13\x52\x08\x92\x46\x92\x45\x72\x49\xa2\xd3\x12\x27\x4b\x12\xc5\x6c\x2e\x9f\x30\x27\xd1\x05\x5b\x [...]
 		},
 		"/camel-catalog-1.5.1-SNAPSHOT-quarkus.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel-catalog-1.5.1-SNAPSHOT-quarkus.yaml",
 			modTime:          time.Time{},
 			uncompressedSize: 87985,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x7d\x5d\x57\xdc\x38\xd2\xff\x7d\x3e\x85\xcf\xe4\xe6\x79\xce\x7f\xad\x9d\x21\xbb\x3b\x7b\xe6\x7f\x05\x4d\x48\x20\x40\x48\xcc\x26\xd9\xbd\x99\xa3\xb6\xd5\xdd\xa2\x6d\xcb\x48\xea\x06\xf2\xe9\x9f\xa3\x17\xbf\xb6\x29\xbf\x20\xb1\x5c\x60\xbb\x55\xfa\x95\x55\x92\xa5\x52\xa9\x54\x7a\x1b\x84\xee\xfe\xde\xbc\x0d\x2e\x69\x4c\x72\x41\x92\x40\xb2\x40\x6e\x48\x70\x5c\xe0\x78\x43\x82\x88\xad\xe4\x03\xe6\x24\x38\x63\xbb\x3c\xc1\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x7d\x5b\x57\xdc\x3a\xb2\xff\x7b\x3e\x85\xd7\xce\xcb\x39\xeb\x3f\xd6\xec\x4d\x66\x66\x9f\xb5\xff\x4f\xd0\x84\x04\x02\x84\xc4\x4c\x92\xd9\x2f\x7b\xa9\x6d\x75\xb7\x68\xdb\x32\x92\xba\x81\x7c\xfa\xb3\x74\xf1\xb5\x4d\xf9\x82\xc4\xe1\x01\xdb\xad\xd2\xaf\xac\x92\x2c\x95\x4a\xa5\xd2\xdb\x20\x74\xf7\xf7\xe6\x6d\x70\x49\x63\x92\x0b\x92\x04\x92\x05\x72\x43\x82\xe3\x02\xc7\x1b\x12\x44\x6c\x25\x1f\x30\x27\xc1\x19\xdb\xe5\x09\x [...]
 		},
 		"/cr-example.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "cr-example.yaml",
diff --git a/docs/modules/ROOT/pages/kamelets/kamelets.adoc b/docs/modules/ROOT/pages/kamelets/kamelets.adoc
index fb87130..7b9bf17 100644
--- a/docs/modules/ROOT/pages/kamelets/kamelets.adoc
+++ b/docs/modules/ROOT/pages/kamelets/kamelets.adoc
@@ -88,7 +88,7 @@ spec:
         - filter:
             simple: "${body} != null"
         - log: "${body}"
-        - to: "direct:#property:routeId"
+        - to: "direct:{{routeId}}"
 ----
 <1> The Kamelet ID, to be used in integrations that want to leverage the Kamelet
 <2> Annotations such as icon provide additional display features to the Kamelet
@@ -493,12 +493,12 @@ spec:
         - filter:
             simple: "${body} != null"
         - log: "${body}"
-        - to: "direct:#property:routeId"
+        - to: "direct:{{routeId}}"
 ----
 
-Source and sink flows will connect to the outside route via the `direct:#property:routeId` endpoint:
-- A source Kamelet must start **from** `direct:#property:routeId`
-- A sink Kamelet must contain a call **to** `direct:#property:routeId`
+Source and sink flows will connect to the outside route via the `direct:{{routeId}}` endpoint:
+- A source Kamelet must start **from** `direct:{{routeId}}`
+- A sink Kamelet must contain a call **to** `direct:{{routeId}}`
 
 Kamelets contain a **single route template** written in YAML DSL, as in the previous example.
 
diff --git a/e2e/yaks/kamelets/echo-sink.kamelet.yaml b/e2e/yaks/kamelets/echo-sink.kamelet.yaml
new file mode 100644
index 0000000..c21ea6b
--- /dev/null
+++ b/e2e/yaks/kamelets/echo-sink.kamelet.yaml
@@ -0,0 +1,27 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: echo-sink
+  label:
+    camel.apache.org/kamelet.type: "sink"
+spec:
+  definition:
+    title: "Echo"
+    description: "Replies with an echo message to each incoming event"
+    properties:
+      prefix:
+        title: Prefix
+        description: The prefix to prepend to the incoming event
+        type: string
+        default: "echo: "
+  types:
+    in:
+      mediaType: text/plain
+    out:
+      mediaType: text/plain
+  flow:
+    from:
+      uri: "direct:{{routeId}}"
+      steps:
+        - set-body:
+            simple: "{{prefix}}${body}"
diff --git a/e2e/yaks/kamelets/kamelet.feature b/e2e/yaks/kamelets/kamelet.feature
index edae8bc..2a4d932 100644
--- a/e2e/yaks/kamelets/kamelet.feature
+++ b/e2e/yaks/kamelets/kamelet.feature
@@ -3,3 +3,7 @@ Feature: Camel K can run Kamelets and bind them
   Scenario: Running integration using a simple Kamelet with KameletBinding
     Given integration logger is running
     Then integration logger should print Hello Kamelets
+
+  Scenario: Integrations can use multiple kamelets
+    Given integration source-sink is running
+    Then integration source-sink should print nice echo: Camel K
diff --git a/examples/kamelets/usage.groovy b/e2e/yaks/kamelets/source-sink.groovy
similarity index 82%
copy from examples/kamelets/usage.groovy
copy to e2e/yaks/kamelets/source-sink.groovy
index d4c5de8..3666bad 100755
--- a/examples/kamelets/usage.groovy
+++ b/e2e/yaks/kamelets/source-sink.groovy
@@ -1,4 +1,4 @@
-// camel-k: language=groovy dependency=mvn:org.apache.camel.k:camel-kamelet:1.5.1-SNAPSHOT
+// camel-k: language=groovy
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,5 +17,8 @@
  * limitations under the License.
  */
 
-from('kamelet:timer?message=Hello+Kamelets&period=1000')
-    .log('${body}')
+from('timer:tick')
+  .setBody().constant('Camel K')
+  .to("kamelet:echo-sink")
+  .to("kamelet:echo-sink?prefix=nice+")
+  .log('${body}')
diff --git a/e2e/yaks/kamelets/timer-source.yaml b/e2e/yaks/kamelets/timer-source-binding.yaml
similarity index 86%
rename from e2e/yaks/kamelets/timer-source.yaml
rename to e2e/yaks/kamelets/timer-source-binding.yaml
index 0b48886..32aeefb 100644
--- a/e2e/yaks/kamelets/timer-source.yaml
+++ b/e2e/yaks/kamelets/timer-source-binding.yaml
@@ -1,13 +1,13 @@
 apiVersion: camel.apache.org/v1alpha1
 kind: KameletBinding
 metadata:
-  name: timer-source
+  name: timer-source-binding
 spec:
   source:
     ref:
       kind: Kamelet
       apiVersion: camel.apache.org/v1alpha1
-      name: timer
+      name: timer-source
     properties:
       message: Hello Kamelets
       period: 1000
diff --git a/e2e/yaks/kamelets/timer.kamelet.yaml b/e2e/yaks/kamelets/timer-source.kamelet.yaml
similarity index 91%
rename from e2e/yaks/kamelets/timer.kamelet.yaml
rename to e2e/yaks/kamelets/timer-source.kamelet.yaml
index 554e15b..a521e07 100644
--- a/e2e/yaks/kamelets/timer.kamelet.yaml
+++ b/e2e/yaks/kamelets/timer-source.kamelet.yaml
@@ -1,9 +1,9 @@
 apiVersion: camel.apache.org/v1alpha1
 kind: Kamelet
 metadata:
-  name: timer
-  annotations:
-    camel.apache.org/kamelet.icon: timer
+  name: timer-source
+  label:
+    camel.apache.org/kamelet.type: "source"
 spec:
   definition:
     title: "Timer"
diff --git a/e2e/yaks/kamelets/yaks-config.yaml b/e2e/yaks/kamelets/yaks-config.yaml
index 947d1c1..40f19ba 100644
--- a/e2e/yaks/kamelets/yaks-config.yaml
+++ b/e2e/yaks/kamelets/yaks-config.yaml
@@ -25,9 +25,11 @@ pre:
 
     kubectl apply -f messages-channel.yaml -n $YAKS_NAMESPACE
 
-    kubectl apply -f timer.kamelet.yaml -n $YAKS_NAMESPACE
+    kubectl apply -f timer-source.kamelet.yaml -n $YAKS_NAMESPACE
+    kubectl apply -f echo-sink.kamelet.yaml -n $YAKS_NAMESPACE
 
-    kubectl apply -f timer-source.yaml -n $YAKS_NAMESPACE
+    kubectl apply -f timer-source-binding.yaml -n $YAKS_NAMESPACE
     kubectl wait kameletbinding timer-source --for=condition=Ready --timeout=10m -n $YAKS_NAMESPACE
 
     kamel run logger.groovy -w -n $YAKS_NAMESPACE
+    kamel run source-sink.groovy -w -n $YAKS_NAMESPACE
diff --git a/examples/kamelets/timer-source.kamelet.yaml b/examples/kamelets/timer-source.kamelet.yaml
index 983a948..17e4826 100644
--- a/examples/kamelets/timer-source.kamelet.yaml
+++ b/examples/kamelets/timer-source.kamelet.yaml
@@ -34,4 +34,4 @@ spec:
       steps:
       - set-body:
           constant: "#property:message"
-      - to: "direct:#property:routeId"
+      - to: "direct:{{routeId}}"
diff --git a/examples/kamelets/usage.groovy b/examples/kamelets/usage.groovy
index d4c5de8..1c8396d 100755
--- a/examples/kamelets/usage.groovy
+++ b/examples/kamelets/usage.groovy
@@ -1,4 +1,4 @@
-// camel-k: language=groovy dependency=mvn:org.apache.camel.k:camel-kamelet:1.5.1-SNAPSHOT
+// camel-k: language=groovy
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more