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/17 09:10:10 UTC

[camel-k] 15/21: Fix #1574: add e2e test for Kamelets

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 7e32e9445b297b8b9f6b23f73f2d4382dc261075
Author: nicolaferraro <ni...@gmail.com>
AuthorDate: Wed Aug 19 16:42:58 2020 +0200

    Fix #1574: add e2e test for Kamelets
---
 e2e/yaks/kamelets/kamelet.feature    |  5 +++++
 e2e/yaks/kamelets/timer.kamelet.yaml | 37 ++++++++++++++++++++++++++++++++++++
 e2e/yaks/kamelets/usage.groovy       | 21 ++++++++++++++++++++
 e2e/yaks/kamelets/yaks-config.yaml   | 28 +++++++++++++++++++++++++++
 4 files changed, 91 insertions(+)

diff --git a/e2e/yaks/kamelets/kamelet.feature b/e2e/yaks/kamelets/kamelet.feature
new file mode 100644
index 0000000..3f9e170
--- /dev/null
+++ b/e2e/yaks/kamelets/kamelet.feature
@@ -0,0 +1,5 @@
+Feature: Camel K can run Kamelets
+
+  Scenario: Running integration using a simple Kamelet
+    Given integration usage is running
+    Then integration usage should print Hello Kamelets
diff --git a/e2e/yaks/kamelets/timer.kamelet.yaml b/e2e/yaks/kamelets/timer.kamelet.yaml
new file mode 100644
index 0000000..554e15b
--- /dev/null
+++ b/e2e/yaks/kamelets/timer.kamelet.yaml
@@ -0,0 +1,37 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: timer
+  annotations:
+    camel.apache.org/kamelet.icon: timer
+spec:
+  definition:
+    title: "Timer"
+    description: "Produces periodic events with a custom payload"
+    required:
+      - message
+    properties:
+      period:
+        title: Period
+        description: The time interval between two events
+        type: integer
+        default: 1000
+      message:
+        title: Message
+        description: The message to generate
+        type: string
+  types:
+    out:
+      mediaType: application/json
+      schema:
+        id: text.camel.apache.org
+        type: string
+  flow:
+    from:
+      uri: timer:tick
+      parameters:
+        period: "{{period}}"
+      steps:
+        - set-body:
+            constant: "{{message}}"
+        - to: "direct:{{routeId}}"
diff --git a/e2e/yaks/kamelets/usage.groovy b/e2e/yaks/kamelets/usage.groovy
new file mode 100755
index 0000000..d4c5de8
--- /dev/null
+++ b/e2e/yaks/kamelets/usage.groovy
@@ -0,0 +1,21 @@
+// camel-k: language=groovy dependency=mvn:org.apache.camel.k:camel-kamelet:1.5.1-SNAPSHOT
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+from('kamelet:timer?message=Hello+Kamelets&period=1000')
+    .log('${body}')
diff --git a/e2e/yaks/kamelets/yaks-config.yaml b/e2e/yaks/kamelets/yaks-config.yaml
new file mode 100644
index 0000000..1df07fc
--- /dev/null
+++ b/e2e/yaks/kamelets/yaks-config.yaml
@@ -0,0 +1,28 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+config:
+  namespace:
+    temporary: true
+pre:
+- name: installation
+  run: |
+    kamel install -n $YAKS_NAMESPACE
+
+    kubectl apply -f timer.kamelet.yaml -n $YAKS_NAMESPACE
+
+    kamel run usage.groovy -w -n $YAKS_NAMESPACE