From 90ffa73704efc2a64fe16f674860168a8d757ac8 Mon Sep 17 00:00:00 2001 From: Nicola Ferraro Date: Thu, 28 May 2020 15:15:17 +0200 Subject: [PATCH] https://github.com/apache/camel-k-runtime/issues/224: refactor test to use cron component --- e2e/common/cron_test.go | 13 +++++++++++++ e2e/common/files/cron-fallback.groovy | 3 +-- e2e/common/files/cron-quartz.groovy | 23 +++++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 e2e/common/files/cron-quartz.groovy diff --git a/e2e/common/cron_test.go b/e2e/common/cron_test.go index d9c6f62e54..4a7d99850d 100644 --- a/e2e/common/cron_test.go +++ b/e2e/common/cron_test.go @@ -83,5 +83,18 @@ func TestRunCronExample(t *testing.T) { Eventually(IntegrationLogs(ns, "cron-fallback-quarkus"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) }) + + // Enable this test when https://github.com/apache/camel-k-runtime/issues/346 is fixed (Camel K Runtime 1.3.x) + /* + t.Run("cron-quartz-quarkus", func(t *testing.T) { + RegisterTestingT(t) + + Expect(Kamel("run", "--name", "cron-quartz-quarkus", "-n", ns, "files/cron-quartz.groovy", "-t", "quarkus.enabled=true").Execute()).Should(BeNil()) + Eventually(IntegrationPodPhase(ns, "cron-quartz-quarkus"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationCondition(ns, "cron-quartz-quarkus", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationLogs(ns, "cron-quartz-quarkus"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) + }) + */ }) } diff --git a/e2e/common/files/cron-fallback.groovy b/e2e/common/files/cron-fallback.groovy index 47980c55d3..ae2c5d94b1 100644 --- a/e2e/common/files/cron-fallback.groovy +++ b/e2e/common/files/cron-fallback.groovy @@ -15,8 +15,7 @@ * limitations under the License. */ -// TODO: replace the consumer URI with 'cron:tab?schedule=0/1+*+*+*+*+?' when camel-cron is available in Apache Camel -from('quartz:trigger?cron=0/1+*+*+*+*+?') +from('cron:tab?schedule=0/1+*+*+*+*+?') .routeId('groovy') .setHeader("m").constant("string!") .setBody() diff --git a/e2e/common/files/cron-quartz.groovy b/e2e/common/files/cron-quartz.groovy new file mode 100644 index 0000000000..f1c41bb0cb --- /dev/null +++ b/e2e/common/files/cron-quartz.groovy @@ -0,0 +1,23 @@ +/* + * 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('quartz:trigger?cron=0/1+*+*+*+*+?') + .routeId('groovy') + .setHeader("m").constant("string!") + .setBody() + .simple('Magic${header.m}') + .to('log:info?showAll=false')