This is an automated email from the ASF dual-hosted git repository.

tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit bbf486c7218db2a7fd9d18b99ec5269dfb009a2d
Author: Tadayoshi Sato <sato.tadayo...@gmail.com>
AuthorDate: Fri Jul 15 17:22:02 2022 +0900

    chore(e2e): reuse namespace for e2e/namespace/install
---
 e2e/namespace/install/cli/run_test.go | 117 +++++++++++++++++-----------------
 1 file changed, 57 insertions(+), 60 deletions(-)

diff --git a/e2e/namespace/install/cli/run_test.go 
b/e2e/namespace/install/cli/run_test.go
index a07212f44..725779314 100644
--- a/e2e/namespace/install/cli/run_test.go
+++ b/e2e/namespace/install/cli/run_test.go
@@ -36,78 +36,75 @@ import (
        v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
 )
 
-func TestRunExamplesFromGitHub(t *testing.T) {
+func TestRun(t *testing.T) {
        WithNewTestNamespace(t, func(ns string) {
                operatorID := fmt.Sprintf("camel-k-%s", ns)
                Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
 
-               t.Run("run java from GitHub", 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).Should(Equal(corev1.ConditionTrue))
-                       Eventually(IntegrationLogs(ns, "java"), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+               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).Should(Equal(corev1.ConditionTrue))
+                               Eventually(IntegrationLogs(ns, "java"), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+                               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+                       })
+
+                       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()).To(Succeed())
+                               Eventually(IntegrationPodPhase(ns, "java"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
+                               Eventually(IntegrationConditionStatus(ns, 
"java", v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+                               Eventually(IntegrationLogs(ns, "java"), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+                               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+                       })
+
+                       t.Run("Gist (ID)", func(t *testing.T) {
+                               name := "github-gist-id"
+                               Expect(KamelRunWithID(operatorID, ns, "--name", 
name, "gist:e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
+                               Eventually(IntegrationPodPhase(ns, name), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
+                               Eventually(IntegrationConditionStatus(ns, name, 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+                               Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+                               Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Tick!"))
+                               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+                       })
+
+                       t.Run("Gist (URL)", func(t *testing.T) {
+                               name := "github-gist-url"
+                               Expect(KamelRunWithID(operatorID, ns, "--name", 
name, 
"https://gist.github.com/lburgazzoli/e2c3f9a5fd0d9e79b21b04809786f17a";).Execute()).To(Succeed())
+                               Eventually(IntegrationPodPhase(ns, name), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
+                               Eventually(IntegrationConditionStatus(ns, name, 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+                               Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+                               Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Tick!"))
+                               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+                       })
+
+                       // Clean up
                        Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
                })
 
-               t.Run("run java from GitHub (RAW)", func(t *testing.T) {
-                       Expect(KamelRunWithID(operatorID, ns, 
"https://raw.githubusercontent.com/apache/camel-k/main/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).Should(Equal(corev1.ConditionTrue))
-                       Eventually(IntegrationLogs(ns, "java"), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
-                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-               })
-
-               t.Run("run from GitHub Gist (ID)", func(t *testing.T) {
-                       name := "github-gist-id"
-                       Expect(KamelRunWithID(operatorID, ns, "--name", name, 
"gist:e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
+               t.Run("Run and update", func(t *testing.T) {
+                       name := "run"
+                       Expect(KamelRunWithID(operatorID, ns, "files/run.yaml", 
"--name", name).Execute()).To(Succeed())
                        Eventually(IntegrationPodPhase(ns, name), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
                        Eventually(IntegrationConditionStatus(ns, name, 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-                       Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
-                       Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Tick!"))
-                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-               })
+                       Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Magic default"))
 
-               t.Run("run from GitHub Gist (URL)", func(t *testing.T) {
-                       name := "github-gist-url"
-                       Expect(KamelRunWithID(operatorID, ns, "--name", name, 
"https://gist.github.com/lburgazzoli/e2c3f9a5fd0d9e79b21b04809786f17a";).Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, name), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
-                       Eventually(IntegrationConditionStatus(ns, name, 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-                       Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
-                       Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Tick!"))
-                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-               })
+                       // Re-run the Integration with an updated configuration
+                       Expect(KamelRunWithID(operatorID, ns, "files/run.yaml", 
"--name", name, "-p", "property=value").Execute()).To(Succeed())
 
-               // Clean up
-               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-       })
-}
+                       // Check the Deployment has progressed successfully
+                       Eventually(DeploymentCondition(ns, name, 
appsv1.DeploymentProgressing), 
TestTimeoutShort).Should(MatchFields(IgnoreExtras, Fields{
+                               "Status": Equal(corev1.ConditionTrue),
+                               "Reason": Equal("NewReplicaSetAvailable"),
+                       }))
 
-func TestRunAndUpdate(t *testing.T) {
-       WithNewTestNamespace(t, func(ns string) {
-               operatorID := fmt.Sprintf("camel-k-%s", ns)
-               Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
-
-               name := "run"
-               Expect(KamelRunWithID(operatorID, ns, "files/run.yaml", 
"--name", name).Execute()).To(Succeed())
-               Eventually(IntegrationPodPhase(ns, name), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
-               Eventually(IntegrationConditionStatus(ns, name, 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-               Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Magic default"))
-
-               // Re-run the Integration with an updated configuration
-               Expect(KamelRunWithID(operatorID, ns, "files/run.yaml", 
"--name", name, "-p", "property=value").Execute()).To(Succeed())
-
-               // Check the Deployment has progressed successfully
-               Eventually(DeploymentCondition(ns, name, 
appsv1.DeploymentProgressing), 
TestTimeoutShort).Should(MatchFields(IgnoreExtras, Fields{
-                       "Status": Equal(corev1.ConditionTrue),
-                       "Reason": Equal("NewReplicaSetAvailable"),
-               }))
-
-               // Check the new configuration is taken into account
-               Eventually(IntegrationPodPhase(ns, name), 
TestTimeoutShort).Should(Equal(corev1.PodRunning))
-               Eventually(IntegrationConditionStatus(ns, name, 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-               Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Magic value"))
+                       // Check the new configuration is taken into account
+                       Eventually(IntegrationPodPhase(ns, name), 
TestTimeoutShort).Should(Equal(corev1.PodRunning))
+                       Eventually(IntegrationConditionStatus(ns, name, 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+                       Eventually(IntegrationLogs(ns, name), 
TestTimeoutShort).Should(ContainSubstring("Magic value"))
 
-               // Clean up
-               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+                       // Clean up
+                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+               })
        })
 }

Reply via email to