From d1f27cac8f5b635d3d15c04a4735a17d01dda7f6 Mon Sep 17 00:00:00 2001 From: Christoph Deppisch Date: Wed, 24 May 2023 20:03:11 +0200 Subject: [PATCH] chore: Improve YAKS tests - Use KameletBinding yaml file resource instead of YAKS bind step --- .../earthquake-source.feature | 10 +++--- .../earthquake-source/earthquake-to-http.yaml | 29 +++++++++++++++++ test/earthquake-source/yaks-config.yaml | 2 ++ test/timer-source/timer-source.feature | 15 +++++---- test/timer-source/timer-to-http.yaml | 31 +++++++++++++++++++ test/timer-source/yaks-config.yaml | 2 ++ 6 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 test/earthquake-source/earthquake-to-http.yaml create mode 100644 test/timer-source/timer-to-http.yaml diff --git a/test/earthquake-source/earthquake-source.feature b/test/earthquake-source/earthquake-source.feature index 92ea68076..fdb6ef6f8 100644 --- a/test/earthquake-source/earthquake-source.feature +++ b/test/earthquake-source/earthquake-source.feature @@ -25,10 +25,10 @@ Feature: Kamelet earthquake-source Given create Kubernetes service test-service with target port 8080 Scenario: Create Kamelet binding - When bind Kamelet earthquake-source to uri yaks:resolveURL('test-service')/test - And create KameletBinding earthquake-source-uri - Then KameletBinding earthquake-source-uri should be available - Then Camel K integration earthquake-source-uri should be running + Given load KameletBinding earthquake-to-http.yaml + Then KameletBinding earthquake-to-http should be available + Then Camel K integration earthquake-to-http should be running + And Camel K integration earthquake-to-http should print Routes startup Scenario: Verify binding Given expect HTTP request header: Content-Type="application/json;charset=UTF-8" @@ -36,5 +36,5 @@ Feature: Kamelet earthquake-source Then send HTTP 200 OK Scenario: Remove Camel K resources - Given delete KameletBinding earthquake-source-uri + Given delete KameletBinding earthquake-to-http And delete Kubernetes service test-service diff --git a/test/earthquake-source/earthquake-to-http.yaml b/test/earthquake-source/earthquake-to-http.yaml new file mode 100644 index 000000000..d5baa578f --- /dev/null +++ b/test/earthquake-source/earthquake-to-http.yaml @@ -0,0 +1,29 @@ +# --------------------------------------------------------------------------- +# 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: KameletBinding +metadata: + name: earthquake-to-http +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: earthquake-source + sink: + uri: yaks:resolveURL('test-service')/test diff --git a/test/earthquake-source/yaks-config.yaml b/test/earthquake-source/yaks-config.yaml index 9977b154e..d54cb7ac7 100644 --- a/test/earthquake-source/yaks-config.yaml +++ b/test/earthquake-source/yaks-config.yaml @@ -32,6 +32,8 @@ config: level: INFO - name: INTEGRATION_LOGS level: INFO + resources: + - earthquake-to-http.yaml dump: enabled: true failedOnly: true diff --git a/test/timer-source/timer-source.feature b/test/timer-source/timer-source.feature index 50053518c..89f491bf0 100644 --- a/test/timer-source/timer-source.feature +++ b/test/timer-source/timer-source.feature @@ -18,20 +18,19 @@ Feature: Timer Source Kamelet Background: - Given HTTP server timeout is 15000 ms + Given HTTP server timeout is 150000 ms Given HTTP server "test-service" Scenario: Create Http server Given create Kubernetes service test-service with target port 8080 Scenario: Create Kamelet binding - And KameletBinding source properties + And variables | message | Hello World | - And bind Kamelet timer-source to uri yaks:resolveURL('test-service')/events - When create KameletBinding timer-source-binding - Then KameletBinding timer-source-binding should be available - Then Camel K integration timer-source-binding should be running - And Camel K integration timer-source-binding should print Routes startup + Given load KameletBinding timer-to-http.yaml + Then KameletBinding timer-to-http should be available + Then Camel K integration timer-to-http should be running + And Camel K integration timer-to-http should print Routes startup Scenario: Verify binding Given expect HTTP request body: Hello World @@ -39,5 +38,5 @@ Feature: Timer Source Kamelet Then send HTTP 200 OK Scenario: Remove Camel K resources - Given delete KameletBinding timer-source-binding + Given delete KameletBinding timer-to-http And delete Kubernetes service test-service diff --git a/test/timer-source/timer-to-http.yaml b/test/timer-source/timer-to-http.yaml new file mode 100644 index 000000000..35a15822b --- /dev/null +++ b/test/timer-source/timer-to-http.yaml @@ -0,0 +1,31 @@ +# --------------------------------------------------------------------------- +# 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: KameletBinding +metadata: + name: timer-to-http +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: timer-source + properties: + message: "${message}" + sink: + uri: yaks:resolveURL('test-service')/events diff --git a/test/timer-source/yaks-config.yaml b/test/timer-source/yaks-config.yaml index 9977b154e..dd0b980d2 100644 --- a/test/timer-source/yaks-config.yaml +++ b/test/timer-source/yaks-config.yaml @@ -32,6 +32,8 @@ config: level: INFO - name: INTEGRATION_LOGS level: INFO + resources: + - timer-to-http.yaml dump: enabled: true failedOnly: true