Skip to content

Commit

Permalink
Fix apache#1574: add e2e test for Kamelets
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Sep 15, 2020
1 parent 969c86f commit 0488c5a
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
5 changes: 5 additions & 0 deletions e2e/yaks/kamelets/kamelet.feature
Original file line number Diff line number Diff line change
@@ -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
37 changes: 37 additions & 0 deletions e2e/yaks/kamelets/timer.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -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}}"
21 changes: 21 additions & 0 deletions e2e/yaks/kamelets/usage.groovy
Original file line number Diff line number Diff line change
@@ -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}')
28 changes: 28 additions & 0 deletions e2e/yaks/kamelets/yaks-config.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0488c5a

Please sign in to comment.