Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Improve YAKS tests #1486

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions test/earthquake-source/earthquake-source.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ 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"
When receive POST /test
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
29 changes: 29 additions & 0 deletions test/earthquake-source/earthquake-to-http.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions test/earthquake-source/yaks-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ config:
level: INFO
- name: INTEGRATION_LOGS
level: INFO
resources:
- earthquake-to-http.yaml
dump:
enabled: true
failedOnly: true
Expand Down
15 changes: 7 additions & 8 deletions test/timer-source/timer-source.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,25 @@
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
When receive POST /events
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
31 changes: 31 additions & 0 deletions test/timer-source/timer-to-http.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions test/timer-source/yaks-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ config:
level: INFO
- name: INTEGRATION_LOGS
level: INFO
resources:
- timer-to-http.yaml
dump:
enabled: true
failedOnly: true
Expand Down
Loading