Skip to content

Commit

Permalink
apache/camel-k-runtime#224: refactor test to use cron component
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed May 28, 2020
1 parent 3f0014c commit 09d1d7b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
13 changes: 13 additions & 0 deletions e2e/common/cron_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})
*/
})
}
3 changes: 1 addition & 2 deletions e2e/common/files/cron-fallback.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
23 changes: 23 additions & 0 deletions e2e/common/files/cron-quartz.groovy
Original file line number Diff line number Diff line change
@@ -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')

0 comments on commit 09d1d7b

Please sign in to comment.