Skip to content

Commit

Permalink
fix(e2e): yaks tests missed explicit dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
squakez committed Oct 9, 2023
1 parent 03dedaa commit 70c4691
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 40 deletions.
42 changes: 21 additions & 21 deletions e2e/support/test_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -2473,6 +2473,27 @@ func CreateTimerKamelet(ns string, name string) func() error {
return CreateKamelet(ns, name, flow, props, nil, []string{"camel:core", "camel:timer", "camel:kamelet"})
}

func CreateLogKamelet(ns string, name string) func() error {
flow := map[string]interface{}{
"from": map[string]interface{}{
"uri": "kamelet:source",
"steps": []map[string]interface{}{
{
"to": "log:{{loggerName}}",
},
},
},
}

props := map[string]v1.JSONSchemaProp{
"loggerName": {
Type: "string",
},
}

return CreateKamelet(ns, name, flow, props, nil, []string{"camel:log", "camel:kamelet"})
}

func DeleteKamelet(ns string, name string) error {
kamelet := v1.Kamelet{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -2821,27 +2842,6 @@ func GetOutputStringAsync(cmd *cobra.Command) func() string {
}
}

func CreateLogKamelet(ns string, name string) func() error {
flow := map[string]interface{}{
"from": map[string]interface{}{
"uri": "kamelet:source",
"steps": []map[string]interface{}{
{
"to": "log:{{loggerName}}",
},
},
},
}

props := map[string]v1.JSONSchemaProp{
"loggerName": {
Type: "string",
},
}

return CreateKamelet(ns, name, flow, props, nil, []string{"camel:core", "camel:timer", "camel:kamelet"})
}

func GetCIProcessID() string {
id, err := os.ReadFile(ciPID)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ spec:
title: Message
description: The message to generate
type: string
dependencies:
- camel:core
- camel:timer
- camel:kamelet
template:
from:
uri: timer:tick
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ spec:
types:
text:
mediaType: text/plain
dependencies:
- camel:kamelet
- camel:log
template:
from:
uri: "kamelet:source"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ spec:
schema:
id: text.camel.apache.org
type: string
dependencies:
- camel:core
- camel:timer
- camel:kamelet
template:
from:
uri: timer:tick
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ spec:
schema:
id: text.camel.apache.org
type: string
dependencies:
- camel:core
- camel:timer
- camel:kamelet
template:
from:
uri: timer:tick
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ spec:
type: string
default: text/plain
dependencies:
- "camel:core"
- "camel:timer"
- "camel:kamelet"
- camel:core
- camel:timer
- camel:kamelet
template:
from:
uri: timer:tick
Expand Down
3 changes: 3 additions & 0 deletions e2e/yaks/common/kamelet-binding/logger-sink.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ spec:
types:
text:
mediaType: text/plain
dependencies:
- camel:kamelet
- camel:log
template:
from:
uri: "kamelet:source"
Expand Down
4 changes: 4 additions & 0 deletions e2e/yaks/common/kamelet-binding/timer-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ spec:
schema:
id: text.camel.apache.org
type: string
dependencies:
- camel:core
- camel:timer
- camel:kamelet
template:
from:
uri: timer:tick
Expand Down
4 changes: 2 additions & 2 deletions e2e/yaks/common/kamelet-data-types/event-sink.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ spec:
binary:
mediaType: application/octet-stream
dependencies:
- "camel:core"
- "camel:kamelet"
- camel:kamelet
- camel:log
template:
from:
uri: "kamelet:source"
Expand Down
5 changes: 3 additions & 2 deletions e2e/yaks/common/kamelet-data-types/event-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ spec:
binary:
mediaType: application/octet-stream
dependencies:
- "camel:core"
- "camel:kamelet"
- camel:core
- camel:timer
- camel:kamelet
template:
from:
uri: timer:tick
Expand Down
12 changes: 0 additions & 12 deletions e2e/yaks/common/kamelet-no-properties/kamelet-no-props.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@ Feature: Kamelet may have no properties
| maxAttempts | 40 |
| delayBetweenAttempts | 3000 |

Scenario: Create Kamelet
Given create Kamelet no-props-source with flow
"""
from:
uri: timer:tick
steps:
- set-body:
constant: "Hello World"
- to: "kamelet:sink"
"""
Then Kamelet no-props-source should be available

Scenario: Bind Kamelet to service
Given create Kubernetes service greeting-service with target port 8080
And bind Kamelet no-props-source to uri log:info
Expand Down
60 changes: 60 additions & 0 deletions e2e/yaks/common/kamelet-no-properties/timer-source.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# ---------------------------------------------------------------------------
# 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/v1
kind: Kamelet
metadata:
name: timer-source
labels:
camel.apache.org/kamelet.type: "source"
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
dataTypes:
out:
types:
json:
mediaType: application/json
schema:
id: text.camel.apache.org
type: string
dependencies:
- camel:core
- camel:timer
- camel:kamelet
template:
from:
uri: timer:tick
parameters:
period: "{{period}}"
steps:
- set-body:
constant: "{{message}}"
- to: "kamelet:sink"
5 changes: 5 additions & 0 deletions e2e/yaks/common/kamelet-no-properties/yaks-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
config:
namespace:
temporary: true
pre:
- name: installation
run: |
kubectl apply -f timer-source.kamelet.yaml -n $YAKS_NAMESPACE
kubectl wait kamelet timer-source --for=condition=Ready --timeout=2m -n $YAKS_NAMESPACE
post:
- name: print dump
if: env:CI=true && failure()
Expand Down
4 changes: 4 additions & 0 deletions e2e/yaks/common/kamelet-steps/timer-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ spec:
schema:
id: text.camel.apache.org
type: string
dependencies:
- camel:core
- camel:timer
- camel:kamelet
template:
from:
uri: timer:tick
Expand Down
4 changes: 4 additions & 0 deletions e2e/yaks/common/kamelet/timer-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ spec:
schema:
id: text.camel.apache.org
type: string
dependencies:
- camel:core
- camel:timer
- camel:kamelet
template:
from:
uri: timer:tick
Expand Down

0 comments on commit 70c4691

Please sign in to comment.