This is an automated email from the ASF dual-hosted git repository. pcongiusti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 2c3941bc3b82c6398d1e59b92ac160cb3d467cfd Author: Pasquale Congiusti <pasquale.congiu...@gmail.com> AuthorDate: Thu Feb 23 17:26:47 2023 +0100 fix: some flakiness when getting integrations --- e2e/common/cli/delete_test.go | 8 -------- e2e/common/cli/get_test.go | 11 +++++++---- e2e/common/cli/run_test.go | 26 +++++++++++++------------- e2e/common/startup_test.go | 2 ++ e2e/common/teardown_test.go | 2 +- e2e/knative/startup_test.go | 2 ++ e2e/knative/teardown_test.go | 2 +- 7 files changed, 26 insertions(+), 27 deletions(-) diff --git a/e2e/common/cli/delete_test.go b/e2e/common/cli/delete_test.go index d0bc1cb3d..0ee289db0 100644 --- a/e2e/common/cli/delete_test.go +++ b/e2e/common/cli/delete_test.go @@ -50,14 +50,6 @@ func TestKamelCLIDelete(t *testing.T) { Eventually(IntegrationPod(ns, "yaml"), TestTimeoutLong).Should(BeNil()) }) - t.Run("delete integration from csv", func(t *testing.T) { - Expect(KamelRunWithID(operatorID, ns, "github:apache/camel-k/e2e/namespace/install/cli/files/yaml.yaml").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - Expect(Kamel("delete", "yaml", "-n", ns).Execute()).To(Succeed()) - Eventually(Integration(ns, "yaml")).Should(BeNil()) - Eventually(IntegrationPod(ns, "yaml"), TestTimeoutLong).Should(BeNil()) - }) - t.Run("delete several integrations", func(t *testing.T) { Expect(KamelRunWithID(operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed()) Expect(KamelRunWithID(operatorID, ns, "files/Java.java").Execute()).To(Succeed()) diff --git a/e2e/common/cli/get_test.go b/e2e/common/cli/get_test.go index b5e94a57c..1d404045e 100644 --- a/e2e/common/cli/get_test.go +++ b/e2e/common/cli/get_test.go @@ -40,8 +40,9 @@ func TestKamelCLIGet(t *testing.T) { Expect(KamelRunWithID(operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) // regex is used for the compatibility of tests between OC and vanilla K8 - // kamel get may have different output depending og the platform - kitName := Integration(ns, "yaml")().Status.IntegrationKit.Name + // kamel get may have different output depending on the platform + Eventually(IntegrationKit(ns, "yaml")).ShouldNot(Equal("")) + kitName := IntegrationKit(ns, "yaml")() regex := fmt.Sprintf("^NAME\tPHASE\tKIT\n\\s*yaml\tRunning\t(%s/%s|%s)", ns, kitName, kitName) Expect(GetOutputString(Kamel("get", "-n", ns))).To(MatchRegexp(regex)) @@ -54,8 +55,10 @@ func TestKamelCLIGet(t *testing.T) { Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - kitName1 := Integration(ns, "java")().Status.IntegrationKit.Name - kitName2 := Integration(ns, "yaml")().Status.IntegrationKit.Name + Eventually(IntegrationKit(ns, "yajavaml")).ShouldNot(Equal("")) + Eventually(IntegrationKit(ns, "yaml")).ShouldNot(Equal("")) + kitName1 := IntegrationKit(ns, "java")() + kitName2 := IntegrationKit(ns, "yaml")() regex := fmt.Sprintf("^NAME\tPHASE\tKIT\n\\s*java\tRunning\t"+ "(%s/%s|%s)\n\\s*yaml\tRunning\t(%s/%s|%s)\n", ns, kitName1, kitName1, ns, kitName2, kitName2) Expect(GetOutputString(Kamel("get", "-n", ns))).To(MatchRegexp(regex)) diff --git a/e2e/common/cli/run_test.go b/e2e/common/cli/run_test.go index 235c856e7..161223684 100644 --- a/e2e/common/cli/run_test.go +++ b/e2e/common/cli/run_test.go @@ -44,32 +44,32 @@ func TestKamelCLIRun(t *testing.T) { t.Run("Examples from GitHub", func(t *testing.T) { t.Run("Java", func(t *testing.T) { Expect(KamelRunWithID(operatorID, ns, - "github:apache/camel-k/e2e/namespace/install/files/Java.java").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort). + "github:apache/camel-k-examples/blob/main/generic-examples/languages/Sample.java").Execute()).To(Succeed()) + Eventually(IntegrationPodPhase(ns, "sample"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationConditionStatus(ns, "sample", v1.IntegrationConditionReady), TestTimeoutShort). Should(Equal(corev1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + Eventually(IntegrationLogs(ns, "sample"), TestTimeoutShort).Should(ContainSubstring("Hello Camel K!")) Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0)) }) t.Run("Java (RAW)", func(t *testing.T) { Expect(KamelRunWithID(operatorID, ns, - "https://raw.githubusercontent.com/apache/camel-k/main/e2e/namespace/install/files/Java.java").Execute()). + "https://raw.githubusercontent.com/apache/camel-k-examples/blob/main/generic-examples/languages/Sample.java").Execute()). To(Succeed()) - Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort). + Eventually(IntegrationPodPhase(ns, "sample"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationConditionStatus(ns, "sample", v1.IntegrationConditionReady), TestTimeoutShort). Should(Equal(corev1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + Eventually(IntegrationLogs(ns, "sample"), TestTimeoutShort).Should(ContainSubstring("Hello Camel K!")) Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0)) }) t.Run("Java (branch)", func(t *testing.T) { Expect(KamelRunWithID(operatorID, ns, - "github:apache/camel-k/e2e/namespace/install/files/Java.java?branch=main").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort). + "github:apache/camel-k-examples/blob/main/generic-examples/languages/Sample.java?branch=main").Execute()).To(Succeed()) + Eventually(IntegrationPodPhase(ns, "sample"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationConditionStatus(ns, "sample", v1.IntegrationConditionReady), TestTimeoutShort). Should(Equal(corev1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + Eventually(IntegrationLogs(ns, "sample"), TestTimeoutShort).Should(ContainSubstring("Hello Camel K!")) Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0)) }) @@ -169,7 +169,7 @@ func TestKamelCLIRun(t *testing.T) { } Expect(KamelRunWithID(operatorID, ns, "../traits/files/jvm/Classpath.java", "-d", sampleJar, - "-d", "https://raw.githubusercontent.com/apache/camel-k/main/e2e/namespace/install/cli/files/Java.java|targetPath=/tmp/foo", + "-d", "https://raw.githubusercontent.com/apache/camel-k-examples/blob/main/generic-examples/languages/Sample.java|targetPath=/tmp/foo", ).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) Eventually(IntegrationConditionStatus(ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) diff --git a/e2e/common/startup_test.go b/e2e/common/startup_test.go index fa6558b7d..c8a3ad9af 100644 --- a/e2e/common/startup_test.go +++ b/e2e/common/startup_test.go @@ -40,6 +40,8 @@ func TestCommonCamelKInstallStartup(t *testing.T) { // the namespace is dynamic if there is some collision // we store this value as it will be used for cleaning in the teardown process SaveCIProcessID(ns.GetName()) + // fail fast if something did not work writing the resource + Expect(GetCIProcessID()).ShouldNot(Equal("")) Expect(KamelInstallWithIDAndKameletCatalog(ns.GetName(), ns.GetName()).Execute()).To(Succeed()) Eventually(OperatorPod(ns.GetName())).ShouldNot(BeNil()) diff --git a/e2e/common/teardown_test.go b/e2e/common/teardown_test.go index c990fbbfe..fcc67b0f5 100644 --- a/e2e/common/teardown_test.go +++ b/e2e/common/teardown_test.go @@ -34,7 +34,7 @@ func TestCommonCamelKInstallTeardown(t *testing.T) { RegisterTestingT(t) ns := GetCIProcessID() - Expect(ns).ShouldNot(BeNil()) + Expect(ns).ShouldNot(Equal("")) Expect(DeleteNamespace(t, ns)).To(Succeed()) DeleteCIProcessID() } diff --git a/e2e/knative/startup_test.go b/e2e/knative/startup_test.go index b40f2df41..4bab6ed40 100644 --- a/e2e/knative/startup_test.go +++ b/e2e/knative/startup_test.go @@ -40,6 +40,8 @@ func TestKNativeCamelKInstallStartup(t *testing.T) { // the namespace is dynamic if there is some collision // we store this value as it will be used for cleaning in the teardown process SaveCIProcessID(ns.GetName()) + // fail fast if something did not work writing the resource + Expect(GetCIProcessID()).ShouldNot(Equal("")) Expect(KamelInstallWithIDAndKameletCatalog(ns.GetName(), ns.GetName(), "--trait-profile", "knative").Execute()).To(Succeed()) Eventually(OperatorPod(ns.GetName())).ShouldNot(BeNil()) diff --git a/e2e/knative/teardown_test.go b/e2e/knative/teardown_test.go index 3a2a0f883..ac0504d82 100644 --- a/e2e/knative/teardown_test.go +++ b/e2e/knative/teardown_test.go @@ -34,7 +34,7 @@ func TestKNativeCamelKInstallTeardown(t *testing.T) { RegisterTestingT(t) ns := GetCIProcessID() - Expect(ns).ShouldNot(BeNil()) + Expect(ns).ShouldNot(Equal("")) Expect(DeleteNamespace(t, ns)).To(Succeed()) DeleteCIProcessID() }