This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 5ec35485ccefe26823d3cd084c1133b996652722 Author: Vladislav Sokolovskii <[email protected]> AuthorDate: Thu Mar 4 13:16:30 2021 +0100 rest_test integrations to YAML --- e2e/common/cron_test.go | 8 ++++---- e2e/common/files/rest-consumer.yaml | 30 ++++++++++++++++++++++++++++++ e2e/common/files/rest-producer.yaml | 24 ++++++++++++++++++++++++ e2e/common/rest_test.go | 8 ++++---- 4 files changed, 62 insertions(+), 8 deletions(-) diff --git a/e2e/common/cron_test.go b/e2e/common/cron_test.go index b04d7ee..950c52b 100644 --- a/e2e/common/cron_test.go +++ b/e2e/common/cron_test.go @@ -37,7 +37,7 @@ func TestRunCronExample(t *testing.T) { Expect(Kamel("install", "-n", ns).Execute()).To(Succeed()) t.Run("cron", func(t *testing.T) { - Expect(Kamel("run", "-n", ns, "files/cron.groovy").Execute()).To(Succeed()) + Expect(Kamel("run", "-n", ns, "files/cron.yaml").Execute()).To(Succeed()) Eventually(IntegrationCronJob(ns, "cron"), TestTimeoutMedium).ShouldNot(BeNil()) Eventually(IntegrationCondition(ns, "cron", camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) Eventually(IntegrationLogs(ns, "cron"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!")) @@ -53,7 +53,7 @@ func TestRunCronExample(t *testing.T) { }) t.Run("cron-timer", func(t *testing.T) { - Expect(Kamel("run", "-n", ns, "files/cron-timer.groovy").Execute()).To(Succeed()) + Expect(Kamel("run", "-n", ns, "files/cron-timer.yaml").Execute()).To(Succeed()) Eventually(IntegrationCronJob(ns, "cron-timer"), TestTimeoutMedium).ShouldNot(BeNil()) Eventually(IntegrationCondition(ns, "cron-timer", camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) Eventually(IntegrationLogs(ns, "cron-timer"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!")) @@ -61,7 +61,7 @@ func TestRunCronExample(t *testing.T) { }) t.Run("cron-fallback", func(t *testing.T) { - Expect(Kamel("run", "-n", ns, "files/cron-fallback.groovy").Execute()).To(Succeed()) + Expect(Kamel("run", "-n", ns, "files/cron-fallback.yaml").Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, "cron-fallback"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) Eventually(IntegrationCondition(ns, "cron-fallback", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) Eventually(IntegrationLogs(ns, "cron-fallback"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) @@ -69,7 +69,7 @@ func TestRunCronExample(t *testing.T) { }) t.Run("cron-quartz", func(t *testing.T) { - Expect(Kamel("run", "-n", ns, "files/cron-quartz.groovy").Execute()).To(Succeed()) + Expect(Kamel("run", "-n", ns, "files/cron-quartz.yaml").Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, "cron-quartz"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) Eventually(IntegrationCondition(ns, "cron-quartz", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) Eventually(IntegrationLogs(ns, "cron-quartz"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) diff --git a/e2e/common/files/rest-consumer.yaml b/e2e/common/files/rest-consumer.yaml new file mode 100644 index 0000000..2b01f13 --- /dev/null +++ b/e2e/common/files/rest-consumer.yaml @@ -0,0 +1,30 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +- rest: + verb: + - method: get + uri: "/customers/{name}" + to: "direct:start" + +- from: + uri: "direct:start" + steps: + - log: + message: "get ${header.name}" + - set-body: + simple: "${header.name} Doe" diff --git a/e2e/common/files/rest-producer.yaml b/e2e/common/files/rest-producer.yaml new file mode 100644 index 0000000..1693bee --- /dev/null +++ b/e2e/common/files/rest-producer.yaml @@ -0,0 +1,24 @@ +# --------------------------------------------------------------------------- +# 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: + uri: "timer:tick" + steps: + - to: + uri: "http:{{serviceName}}/customers/{{name}}" + - log: + message: "${body}" diff --git a/e2e/common/rest_test.go b/e2e/common/rest_test.go index e932dd9..fd7908a 100644 --- a/e2e/common/rest_test.go +++ b/e2e/common/rest_test.go @@ -48,17 +48,17 @@ func TestRunRest(t *testing.T) { } Expect(Kamel("install", "-n", ns, "--trait-profile", profile).Execute()).To(Succeed()) - Expect(Kamel("run", "-n", ns, "files/RestConsumer.java").Execute()).To(Succeed()) + Expect(Kamel("run", "-n", ns, "files/rest-consumer.yaml").Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, "rest-consumer"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) t.Run("Service works", func(t *testing.T) { name := "John" service := Service(ns, "rest-consumer") Eventually(service, TestTimeoutShort).ShouldNot(BeNil()) - Expect(Kamel("run", "-n", ns, "files/RestProducer.groovy", "-p", "serviceName=rest-consumer", "-p", "name="+name).Execute()).To(Succeed()) + Expect(Kamel("run", "-n", ns, "files/rest-producer.yaml", "-p", "serviceName=rest-consumer", "-p", "name="+name).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, "rest-producer"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationLogs(ns, "rest-consumer"), TestTimeoutShort).Should(ContainSubstring(fmt.Sprintf("get %s", name))) - Eventually(IntegrationLogs(ns, "rest-producer"), TestTimeoutShort).Should(ContainSubstring(fmt.Sprintf("%s Doe", name))) + Eventually(IntegrationLogs(ns, "rest-consumer"), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("get %s", name))) + Eventually(IntegrationLogs(ns, "rest-producer"), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("%s Doe", name))) }) if ocp {
