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

Fix #1709: add e2e tests about kamelets #1711

Merged
merged 1 commit into from
Sep 23, 2020
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
4 changes: 2 additions & 2 deletions deploy/camel-catalog-1.5.1-SNAPSHOT-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions deploy/camel-catalog-1.5.1-SNAPSHOT-quarkus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ metadata:
}
},
{
"to": "direct:#property:routeId"
"to": "direct:{{routeId}}"
}
],
"uri": "timer:tick"
Expand Down
4 changes: 2 additions & 2 deletions deploy/resources.go

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/modules/ROOT/pages/kamelets/kamelets.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down
27 changes: 27 additions & 0 deletions e2e/yaks/kamelets/echo-sink.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -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}"
4 changes: 4 additions & 0 deletions e2e/yaks/kamelets/kamelet.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 24 additions & 0 deletions e2e/yaks/kamelets/source-sink.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// camel-k: language=groovy

/*
* 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('timer:tick')
.setBody().constant('Camel K')
.to("kamelet:echo-sink")
.to("kamelet:echo-sink?prefix=nice+")
.log('${body}')
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
6 changes: 4 additions & 2 deletions e2e/yaks/kamelets/yaks-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion examples/kamelets/timer-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ spec:
steps:
- set-body:
constant: "#property:message"
- to: "direct:#property:routeId"
- to: "direct:{{routeId}}"
2 changes: 1 addition & 1 deletion examples/kamelets/usage.groovy
Original file line number Diff line number Diff line change
@@ -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
Expand Down