This is an automated email from the ASF dual-hosted git repository. nferraro pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/master by this push: new 9234975 Split tests by language 9234975 is described below commit 9234975a7c3202de81fac66361194356a1ba2428 Author: Jan <jbou...@redhat.com> AuthorDate: Mon Nov 23 12:47:45 2020 +0100 Split tests by language --- .../{init_test.go => languages/groovy_test.go} | 42 ++++------ .../init_test_support.go} | 32 +++----- e2e/common/languages/java_test.go | 60 ++++++++++++++ e2e/common/{init_test.go => languages/js_test.go} | 43 ++++------ .../{init_test.go => languages/kotlin_test.go} | 43 ++++------ .../{init_test.go => languages/polyglot_test.go} | 40 ++++------ e2e/common/{init_test.go => languages/xml_test.go} | 42 ++++------ e2e/common/languages/yaml_test.go | 61 +++++++++++++++ e2e/common/run_test.go | 91 ---------------------- script/Makefile | 2 +- 10 files changed, 209 insertions(+), 247 deletions(-) diff --git a/e2e/common/init_test.go b/e2e/common/languages/groovy_test.go similarity index 52% copy from e2e/common/init_test.go copy to e2e/common/languages/groovy_test.go index 984d8a4..1923e21 100644 --- a/e2e/common/init_test.go +++ b/e2e/common/languages/groovy_test.go @@ -19,45 +19,33 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package languages import ( - "fmt" - "path" "testing" . "github.com/apache/camel-k/e2e/support" - "github.com/apache/camel-k/e2e/support/util" camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" . "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" ) -func TestRunInitGeneratedExamples(t *testing.T) { +func TestRunSimpleGroovyExamples(t *testing.T) { + WithNewTestNamespace(t, func(ns string) { Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil()) - for _, lang := range camelv1.Languages { - t.Run("init run "+string(lang), func(t *testing.T) { - RegisterTestingT(t) - dir := util.MakeTempDir(t) - itName := fmt.Sprintf("init%s", string(lang)) // e.g. initjava - fileName := fmt.Sprintf("%s.%s", itName, string(lang)) // e.g. initjava.java - file := path.Join(dir, fileName) - Expect(Kamel("init", file).Execute()).Should(BeNil()) - Expect(Kamel("run", "-n", ns, file).Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, itName), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationLogs(ns, itName), TestTimeoutShort).Should(ContainSubstring(languageInitExpectedString(lang))) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - } + t.Run("run groovy", func(t *testing.T) { + RegisterTestingT(t) + Expect(Kamel("run", "-n", ns, "../files/groovy.groovy").Execute()).Should(BeNil()) + Eventually(IntegrationPodPhase(ns, "groovy"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationCondition(ns, "groovy", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationLogs(ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) + }) + + t.Run("init run groovy", func(t *testing.T) { + RunInitGeneratedExample(camelv1.LanguageGroovy, ns, t) + }) }) } - -func languageInitExpectedString(lang camelv1.Language) string { - langDesc := string(lang) - if lang == camelv1.LanguageKotlin { - langDesc = "kotlin" - } - return fmt.Sprintf(" Hello Camel K from %s", langDesc) -} diff --git a/e2e/common/init_test.go b/e2e/common/languages/init_test_support.go similarity index 59% copy from e2e/common/init_test.go copy to e2e/common/languages/init_test_support.go index 984d8a4..0dcb841 100644 --- a/e2e/common/init_test.go +++ b/e2e/common/languages/init_test_support.go @@ -19,7 +19,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package languages import ( "fmt" @@ -33,25 +33,17 @@ import ( v1 "k8s.io/api/core/v1" ) -func TestRunInitGeneratedExamples(t *testing.T) { - WithNewTestNamespace(t, func(ns string) { - Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil()) - - for _, lang := range camelv1.Languages { - t.Run("init run "+string(lang), func(t *testing.T) { - RegisterTestingT(t) - dir := util.MakeTempDir(t) - itName := fmt.Sprintf("init%s", string(lang)) // e.g. initjava - fileName := fmt.Sprintf("%s.%s", itName, string(lang)) // e.g. initjava.java - file := path.Join(dir, fileName) - Expect(Kamel("init", file).Execute()).Should(BeNil()) - Expect(Kamel("run", "-n", ns, file).Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, itName), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationLogs(ns, itName), TestTimeoutShort).Should(ContainSubstring(languageInitExpectedString(lang))) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - } - }) +func RunInitGeneratedExample(lang camelv1.Language, ns string, t *testing.T) { + RegisterTestingT(t) + dir := util.MakeTempDir(t) + itName := fmt.Sprintf("init%s", string(lang)) // e.g. initjava + fileName := fmt.Sprintf("%s.%s", itName, string(lang)) // e.g. initjava.java + file := path.Join(dir, fileName) + Expect(Kamel("init", file).Execute()).Should(BeNil()) + Expect(Kamel("run", "-n", ns, file).Execute()).Should(BeNil()) + Eventually(IntegrationPodPhase(ns, itName), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationLogs(ns, itName), TestTimeoutShort).Should(ContainSubstring(languageInitExpectedString(lang))) + Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) } func languageInitExpectedString(lang camelv1.Language) string { diff --git a/e2e/common/languages/java_test.go b/e2e/common/languages/java_test.go new file mode 100644 index 0000000..1571060 --- /dev/null +++ b/e2e/common/languages/java_test.go @@ -0,0 +1,60 @@ +// +build integration + +// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" + +/* +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. +*/ + +package languages + +import ( + "testing" + + . "github.com/apache/camel-k/e2e/support" + camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" + . "github.com/onsi/gomega" + v1 "k8s.io/api/core/v1" +) + +func TestRunSimpleJavaExamples(t *testing.T) { + + WithNewTestNamespace(t, func(ns string) { + Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil()) + + t.Run("run java", func(t *testing.T) { + RegisterTestingT(t) + Expect(Kamel("run", "-n", ns, "../files/Java.java").Execute()).Should(BeNil()) + Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) + }) + + t.Run("run java with properties", func(t *testing.T) { + RegisterTestingT(t) + Expect(Kamel("run", "-n", ns, "../files/Prop.java", "--property-file", "../files/prop.properties").Execute()).Should(BeNil()) + Eventually(IntegrationPodPhase(ns, "prop"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationCondition(ns, "prop", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationLogs(ns, "prop"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) + }) + + t.Run("init run java", func(t *testing.T) { + RunInitGeneratedExample(camelv1.LanguageJavaSource, ns, t) + }) + }) +} diff --git a/e2e/common/init_test.go b/e2e/common/languages/js_test.go similarity index 52% copy from e2e/common/init_test.go copy to e2e/common/languages/js_test.go index 984d8a4..052ba50 100644 --- a/e2e/common/init_test.go +++ b/e2e/common/languages/js_test.go @@ -19,45 +19,34 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package languages import ( - "fmt" - "path" "testing" . "github.com/apache/camel-k/e2e/support" - "github.com/apache/camel-k/e2e/support/util" camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" . "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" ) -func TestRunInitGeneratedExamples(t *testing.T) { +func TestRunSimpleJavaScriptExamples(t *testing.T) { + WithNewTestNamespace(t, func(ns string) { Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil()) - for _, lang := range camelv1.Languages { - t.Run("init run "+string(lang), func(t *testing.T) { - RegisterTestingT(t) - dir := util.MakeTempDir(t) - itName := fmt.Sprintf("init%s", string(lang)) // e.g. initjava - fileName := fmt.Sprintf("%s.%s", itName, string(lang)) // e.g. initjava.java - file := path.Join(dir, fileName) - Expect(Kamel("init", file).Execute()).Should(BeNil()) - Expect(Kamel("run", "-n", ns, file).Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, itName), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationLogs(ns, itName), TestTimeoutShort).Should(ContainSubstring(languageInitExpectedString(lang))) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - } - }) -} + t.Run("run js", func(t *testing.T) { + RegisterTestingT(t) + Expect(Kamel("run", "-n", ns, "../files/js.js").Execute()).Should(BeNil()) + Eventually(IntegrationPodPhase(ns, "js"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationCondition(ns, "js", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationLogs(ns, "js"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) + }) -func languageInitExpectedString(lang camelv1.Language) string { - langDesc := string(lang) - if lang == camelv1.LanguageKotlin { - langDesc = "kotlin" - } - return fmt.Sprintf(" Hello Camel K from %s", langDesc) + t.Run("init run JavaScript", func(t *testing.T) { + RunInitGeneratedExample(camelv1.LanguageJavaScript, ns, t) + }) + + }) } diff --git a/e2e/common/init_test.go b/e2e/common/languages/kotlin_test.go similarity index 52% copy from e2e/common/init_test.go copy to e2e/common/languages/kotlin_test.go index 984d8a4..d1c5c7f 100644 --- a/e2e/common/init_test.go +++ b/e2e/common/languages/kotlin_test.go @@ -19,45 +19,34 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package languages import ( - "fmt" - "path" "testing" . "github.com/apache/camel-k/e2e/support" - "github.com/apache/camel-k/e2e/support/util" camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" . "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" ) -func TestRunInitGeneratedExamples(t *testing.T) { +func TestRunSimpleKotlinExamples(t *testing.T) { + WithNewTestNamespace(t, func(ns string) { Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil()) - for _, lang := range camelv1.Languages { - t.Run("init run "+string(lang), func(t *testing.T) { - RegisterTestingT(t) - dir := util.MakeTempDir(t) - itName := fmt.Sprintf("init%s", string(lang)) // e.g. initjava - fileName := fmt.Sprintf("%s.%s", itName, string(lang)) // e.g. initjava.java - file := path.Join(dir, fileName) - Expect(Kamel("init", file).Execute()).Should(BeNil()) - Expect(Kamel("run", "-n", ns, file).Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, itName), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationLogs(ns, itName), TestTimeoutShort).Should(ContainSubstring(languageInitExpectedString(lang))) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - } - }) -} + t.Run("run kotlin", func(t *testing.T) { + RegisterTestingT(t) + Expect(Kamel("run", "-n", ns, "../files/kotlin.kts").Execute()).Should(BeNil()) + Eventually(IntegrationPodPhase(ns, "kotlin"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationCondition(ns, "kotlin", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationLogs(ns, "kotlin"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) + }) -func languageInitExpectedString(lang camelv1.Language) string { - langDesc := string(lang) - if lang == camelv1.LanguageKotlin { - langDesc = "kotlin" - } - return fmt.Sprintf(" Hello Camel K from %s", langDesc) + t.Run("init run Kotlin", func(t *testing.T) { + RunInitGeneratedExample(camelv1.LanguageKotlin, ns, t) + }) + + }) } diff --git a/e2e/common/init_test.go b/e2e/common/languages/polyglot_test.go similarity index 52% copy from e2e/common/init_test.go copy to e2e/common/languages/polyglot_test.go index 984d8a4..e1c439f 100644 --- a/e2e/common/init_test.go +++ b/e2e/common/languages/polyglot_test.go @@ -19,45 +19,31 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package languages import ( - "fmt" - "path" "testing" . "github.com/apache/camel-k/e2e/support" - "github.com/apache/camel-k/e2e/support/util" camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" . "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" ) -func TestRunInitGeneratedExamples(t *testing.T) { +func TestRunPolyglotExamples(t *testing.T) { + WithNewTestNamespace(t, func(ns string) { Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil()) - for _, lang := range camelv1.Languages { - t.Run("init run "+string(lang), func(t *testing.T) { - RegisterTestingT(t) - dir := util.MakeTempDir(t) - itName := fmt.Sprintf("init%s", string(lang)) // e.g. initjava - fileName := fmt.Sprintf("%s.%s", itName, string(lang)) // e.g. initjava.java - file := path.Join(dir, fileName) - Expect(Kamel("init", file).Execute()).Should(BeNil()) - Expect(Kamel("run", "-n", ns, file).Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, itName), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationLogs(ns, itName), TestTimeoutShort).Should(ContainSubstring(languageInitExpectedString(lang))) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - } - }) -} + t.Run("run polyglot", func(t *testing.T) { + RegisterTestingT(t) + Expect(Kamel("run", "-n", ns, "--name", "polyglot", "../files/js-polyglot.js", "../files/yaml-polyglot.yaml").Execute()).Should(BeNil()) + Eventually(IntegrationPodPhase(ns, "polyglot"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationCondition(ns, "polyglot", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationLogs(ns, "polyglot"), TestTimeoutShort).Should(ContainSubstring("Magicpolyglot-yaml")) + Eventually(IntegrationLogs(ns, "polyglot"), TestTimeoutShort).Should(ContainSubstring("Magicpolyglot-js")) + Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) + }) -func languageInitExpectedString(lang camelv1.Language) string { - langDesc := string(lang) - if lang == camelv1.LanguageKotlin { - langDesc = "kotlin" - } - return fmt.Sprintf(" Hello Camel K from %s", langDesc) + }) } diff --git a/e2e/common/init_test.go b/e2e/common/languages/xml_test.go similarity index 52% rename from e2e/common/init_test.go rename to e2e/common/languages/xml_test.go index 984d8a4..d8e4f9a 100644 --- a/e2e/common/init_test.go +++ b/e2e/common/languages/xml_test.go @@ -19,45 +19,33 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package languages import ( - "fmt" - "path" "testing" . "github.com/apache/camel-k/e2e/support" - "github.com/apache/camel-k/e2e/support/util" camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" . "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" ) -func TestRunInitGeneratedExamples(t *testing.T) { +func TestRunSimpleXmlExamples(t *testing.T) { + WithNewTestNamespace(t, func(ns string) { Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil()) - for _, lang := range camelv1.Languages { - t.Run("init run "+string(lang), func(t *testing.T) { - RegisterTestingT(t) - dir := util.MakeTempDir(t) - itName := fmt.Sprintf("init%s", string(lang)) // e.g. initjava - fileName := fmt.Sprintf("%s.%s", itName, string(lang)) // e.g. initjava.java - file := path.Join(dir, fileName) - Expect(Kamel("init", file).Execute()).Should(BeNil()) - Expect(Kamel("run", "-n", ns, file).Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, itName), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationLogs(ns, itName), TestTimeoutShort).Should(ContainSubstring(languageInitExpectedString(lang))) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - } + t.Run("run xml", func(t *testing.T) { + RegisterTestingT(t) + Expect(Kamel("run", "-n", ns, "../files/xml.xml").Execute()).Should(BeNil()) + Eventually(IntegrationPodPhase(ns, "xml"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationCondition(ns, "xml", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationLogs(ns, "xml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) + }) + + t.Run("init run xml", func(t *testing.T) { + RunInitGeneratedExample(camelv1.LanguageXML, ns, t) + }) }) } - -func languageInitExpectedString(lang camelv1.Language) string { - langDesc := string(lang) - if lang == camelv1.LanguageKotlin { - langDesc = "kotlin" - } - return fmt.Sprintf(" Hello Camel K from %s", langDesc) -} diff --git a/e2e/common/languages/yaml_test.go b/e2e/common/languages/yaml_test.go new file mode 100644 index 0000000..2864557 --- /dev/null +++ b/e2e/common/languages/yaml_test.go @@ -0,0 +1,61 @@ +// +build integration + +// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" + +/* +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. +*/ + +package languages + +import ( + "testing" + + . "github.com/apache/camel-k/e2e/support" + camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" + . "github.com/onsi/gomega" + v1 "k8s.io/api/core/v1" +) + +func TestRunSimpleYamlExamples(t *testing.T) { + + WithNewTestNamespace(t, func(ns string) { + Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil()) + + t.Run("run yaml", func(t *testing.T) { + RegisterTestingT(t) + Expect(Kamel("run", "-n", ns, "../files/yaml.yaml").Execute()).Should(BeNil()) + Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationCondition(ns, "yaml", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationLogs(ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) + }) + + t.Run("run yaml Quarkus", func(t *testing.T) { + RegisterTestingT(t) + Expect(Kamel("run", "-n", ns, "--name", "yaml-quarkus", "../files/yaml.yaml", "-t", "quarkus.enabled=true").Execute()).Should(BeNil()) + Eventually(IntegrationPodPhase(ns, "yaml-quarkus"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationCondition(ns, "yaml-quarkus", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationLogs(ns, "yaml-quarkus"), TestTimeoutShort).Should(ContainSubstring("powered by Quarkus")) + Eventually(IntegrationLogs(ns, "yaml-quarkus"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) + }) + + t.Run("init run yaml", func(t *testing.T) { + RunInitGeneratedExample(camelv1.LanguageYaml, ns, t) + }) + }) +} diff --git a/e2e/common/run_test.go b/e2e/common/run_test.go index 3cb833d..78e60a2 100644 --- a/e2e/common/run_test.go +++ b/e2e/common/run_test.go @@ -30,97 +30,6 @@ import ( v1 "k8s.io/api/core/v1" ) -func TestRunSimpleExamples(t *testing.T) { - - WithNewTestNamespace(t, func(ns string) { - Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil()) - - t.Run("run java", func(t *testing.T) { - RegisterTestingT(t) - Expect(Kamel("run", "-n", ns, "files/Java.java").Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - - t.Run("run java with properties", func(t *testing.T) { - RegisterTestingT(t) - Expect(Kamel("run", "-n", ns, "files/Prop.java", "--property-file", "files/prop.properties").Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, "prop"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "prop", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "prop"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - - t.Run("run xml", func(t *testing.T) { - RegisterTestingT(t) - Expect(Kamel("run", "-n", ns, "files/xml.xml").Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, "xml"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "xml", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "xml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - - t.Run("run groovy", func(t *testing.T) { - RegisterTestingT(t) - Expect(Kamel("run", "-n", ns, "files/groovy.groovy").Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, "groovy"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "groovy", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - - t.Run("run js", func(t *testing.T) { - RegisterTestingT(t) - Expect(Kamel("run", "-n", ns, "files/js.js").Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, "js"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "js", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "js"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - - t.Run("run kotlin", func(t *testing.T) { - RegisterTestingT(t) - Expect(Kamel("run", "-n", ns, "files/kotlin.kts").Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, "kotlin"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "kotlin", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "kotlin"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - - t.Run("run yaml", func(t *testing.T) { - RegisterTestingT(t) - Expect(Kamel("run", "-n", ns, "files/yaml.yaml").Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "yaml", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - - t.Run("run yaml Quarkus", func(t *testing.T) { - RegisterTestingT(t) - Expect(Kamel("run", "-n", ns, "--name", "yaml-quarkus", "files/yaml.yaml", "-t", "quarkus.enabled=true").Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, "yaml-quarkus"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "yaml-quarkus", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "yaml-quarkus"), TestTimeoutShort).Should(ContainSubstring("powered by Quarkus")) - Eventually(IntegrationLogs(ns, "yaml-quarkus"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - - t.Run("run polyglot", func(t *testing.T) { - RegisterTestingT(t) - Expect(Kamel("run", "-n", ns, "--name", "polyglot", "files/js-polyglot.js", "files/yaml-polyglot.yaml").Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, "polyglot"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "polyglot", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "polyglot"), TestTimeoutShort).Should(ContainSubstring("Magicpolyglot-yaml")) - Eventually(IntegrationLogs(ns, "polyglot"), TestTimeoutShort).Should(ContainSubstring("Magicpolyglot-js")) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - - }) -} - func TestRunExamplesFromGitHUB(t *testing.T) { WithNewTestNamespace(t, func(ns string) { Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil()) diff --git a/script/Makefile b/script/Makefile index aeca4a9..291a59f 100644 --- a/script/Makefile +++ b/script/Makefile @@ -148,7 +148,7 @@ test: build go test ./... test-integration: build - STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" go test -timeout 60m -v ./e2e/common -tags=integration + STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" go test -timeout 60m -v ./e2e/common -tags=integration && go test -timeout 60m -v ./e2e/common/languages -tags=integration #go test -timeout 60m -v ./e2e/common -tags=integration test-knative: build