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 2021/02/15 09:25:11 UTC

[camel-kamelets] branch master updated: chore: add CI configuration

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-kamelets.git


The following commit(s) were added to refs/heads/master by this push:
     new d8eea9f  chore: add CI configuration
     new eb542e5  Merge pull request #3 from nicolaferraro/test-ci
d8eea9f is described below

commit d8eea9fc9983a906a48c67a9b99bd39feb4158cc
Author: nicolaferraro <ni...@gmail.com>
AuthorDate: Fri Feb 12 17:47:57 2021 +0100

    chore: add CI configuration
---
 .github/workflows/test.yaml            | 86 ++++++++++++++++++++++++++++++++++
 test/timer-source/timer-source.feature | 23 +++++++++
 test/timer-source/yaks-config.yaml     | 27 +++++++++++
 timer-source.kamelet.yaml              | 18 +++++++
 4 files changed, 154 insertions(+)

diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
new file mode 100644
index 0000000..ec469ee
--- /dev/null
+++ b/.github/workflows/test.yaml
@@ -0,0 +1,86 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: test
+
+on:
+  pull_request:
+    branches:
+      - master
+    paths-ignore:
+      - '**.adoc'
+      - 'KEYS'
+      - 'LICENSE'
+      - 'NOTICE'
+  push:
+    branches:
+      - master
+    paths-ignore:
+      - '**.adoc'
+      - 'KEYS'
+      - 'LICENSE'
+      - 'NOTICE'
+
+env:
+  CAMEL_K_VERSION: 1.3.1
+  YAKS_VERSION: 0.2.0
+
+jobs:
+  test:
+
+    runs-on: ubuntu-latest
+
+    steps:
+    - name: Checkout code
+      uses: actions/checkout@v2
+    - name: Get Camel K CLI
+      run: |
+        curl -L --silent https://github.com/apache/camel-k/releases/download/v${CAMEL_K_VERSION}/camel-k-client-${CAMEL_K_VERSION}-linux-64bit.tar.gz -o kamel.tar.gz
+        mkdir -p _kamel
+        tar -zxf kamel.tar.gz --directory ./_kamel
+        sudo mv ./_kamel/kamel /usr/local/bin/
+        rm kamel.tar.gz
+        rm -r _kamel
+    - name: Get YAKS CLI
+      run: |
+        curl -L https://github.com/citrusframework/yaks/releases/download/v${YAKS_VERSION}/yaks-${YAKS_VERSION}-linux-64bit.tar.gz -o yaks.tar.gz
+        mkdir -p _yaks
+        tar -zxf yaks.tar.gz --directory ./_yaks
+        sudo mv ./_yaks/yaks /usr/local/bin/
+        rm yaks.tar.gz
+        rm -r _yaks
+    - name: Kubernetes KinD Cluster
+      uses: container-tools/kind-action@v1
+    - name: Info
+      run: |
+        kubectl cluster-info
+        kubectl describe nodes
+    - name: Run Tests
+      run: |
+        echo "Configuring Camel K"
+        kamel install --cluster-setup
+
+        # Configure install options
+        export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
+        export KAMEL_INSTALL_REGISTRY=$KIND_REGISTRY
+        export KAMEL_INSTALL_REGISTRY_INSECURE=true
+        
+        echo "Configuring Yaks"
+        yaks install
+
+        echo "Running tests"
+        yaks test ./test
diff --git a/test/timer-source/timer-source.feature b/test/timer-source/timer-source.feature
new file mode 100644
index 0000000..4284725
--- /dev/null
+++ b/test/timer-source/timer-source.feature
@@ -0,0 +1,23 @@
+Feature: Timer Source Kamelet
+
+  Background:
+    Given Disable auto removal of Kamelet resources
+    Given Disable auto removal of Kubernetes resources
+    Given Camel-K resource polling configuration
+      | maxAttempts          | 20   |
+      | delayBetweenAttempts | 1000 |
+
+  Scenario: Bind Kamelet to service
+    Given create Kubernetes service probe-service with target port 8080
+    And KameletBinding source properties
+      | message  | Hello World |
+    And bind Kamelet timer-source to uri http://probe-service.${YAKS_NAMESPACE}/events
+    When create KameletBinding timer-source-binding
+    Then KameletBinding timer-source-binding should be available
+
+  Scenario: Verify binding
+    Given HTTP server "probe-service"
+    And HTTP server timeout is 300000 ms
+    Then expect HTTP request body: Hello World
+    And receive POST /events
+    And delete KameletBinding timer-source-binding
diff --git a/test/timer-source/yaks-config.yaml b/test/timer-source/yaks-config.yaml
new file mode 100644
index 0000000..b6d4123
--- /dev/null
+++ b/test/timer-source/yaks-config.yaml
@@ -0,0 +1,27 @@
+# ---------------------------------------------------------------------------
+# 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: |
+    # Install required Kamelets (these steps may be done globally in future versions)
+
+    kamel install -n $YAKS_NAMESPACE
+    kubectl apply -f ../../timer-source.kamelet.yaml -n $YAKS_NAMESPACE
diff --git a/timer-source.kamelet.yaml b/timer-source.kamelet.yaml
index 29db68e..ebfc3f1 100644
--- a/timer-source.kamelet.yaml
+++ b/timer-source.kamelet.yaml
@@ -1,3 +1,20 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
 apiVersion: camel.apache.org/v1alpha1
 kind: Kamelet
 metadata:
@@ -6,6 +23,7 @@ metadata:
     camel.apache.org/kamelet.icon: data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gU3ZnIFZlY3RvciBJY29ucyA6IGh0dHA6Ly93d3cub25saW5ld2ViZm9udHMuY29tL2ljb24gLS0+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm9 [...]
   labels:
     camel.apache.org/kamelet.type: source
+    camel.apache.org/kamelet.verified: "true"
 spec:
   definition:
     title: Timer Source