You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2022/01/12 13:54:13 UTC

[camel-k] 27/31: fix(e2e): Use different integrations in environment trait tests

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

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

commit 39a1ea1b148f02b91be006a2e19c16faba494ca8
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Jan 11 15:00:16 2022 +0100

    fix(e2e): Use different integrations in environment trait tests
---
 e2e/common/traits/environment_test.go | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/e2e/common/traits/environment_test.go b/e2e/common/traits/environment_test.go
index efd1ad2..80faa97 100644
--- a/e2e/common/traits/environment_test.go
+++ b/e2e/common/traits/environment_test.go
@@ -69,12 +69,13 @@ func TestEnvironmentTrait(t *testing.T) {
 		).Execute()).To(Succeed())
 
 		t.Run("Run integration with default environment", func(t *testing.T) {
-			Expect(Kamel("run", "-n", ns, "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!"))
+			name := "java-default"
+			Expect(Kamel("run", "-n", ns, "--name", name, "files/Java.java").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!"))
 
-			Expect(IntegrationPod(ns, "java")()).To(WithTransform(podEnvVars, And(
+			Expect(IntegrationPod(ns, name)()).To(WithTransform(podEnvVars, And(
 				ContainElement(corev1.EnvVar{Name: "CAMEL_K_VERSION", Value: defaults.Version}),
 				ContainElement(corev1.EnvVar{Name: "NAMESPACE", ValueFrom: &corev1.EnvVarSource{
 					FieldRef: &corev1.ObjectFieldSelector{
@@ -94,14 +95,16 @@ func TestEnvironmentTrait(t *testing.T) {
 		})
 
 		t.Run("Run integration with custom environment", func(t *testing.T) {
+			name := "java-custom-proxy"
 			Expect(Kamel("run", "-n", ns, "files/Java.java",
-				"-t", "environment.vars=\"HTTP_PROXY=http://custom.proxy\"",
+				"--name", name,
+				"-t", "environment.vars=HTTP_PROXY=http://custom.proxy",
 			).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!"))
+			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!"))
 
-			Expect(IntegrationPod(ns, "java")()).To(WithTransform(podEnvVars, And(
+			Expect(IntegrationPod(ns, name)()).To(WithTransform(podEnvVars, And(
 				ContainElement(corev1.EnvVar{Name: "CAMEL_K_VERSION", Value: defaults.Version}),
 				ContainElement(corev1.EnvVar{Name: "NAMESPACE", ValueFrom: &corev1.EnvVarSource{
 					FieldRef: &corev1.ObjectFieldSelector{
@@ -121,14 +124,16 @@ func TestEnvironmentTrait(t *testing.T) {
 		})
 
 		t.Run("Run integration without default HTTP proxy environment", func(t *testing.T) {
+			name := "java-no-proxy"
 			Expect(Kamel("run", "-n", ns, "files/Java.java",
+				"--name", name,
 				"-t", "environment.http-proxy=false",
 			).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!"))
+			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!"))
 
-			Expect(IntegrationPod(ns, "java")()).To(WithTransform(podEnvVars, And(
+			Expect(IntegrationPod(ns, name)()).To(WithTransform(podEnvVars, And(
 				ContainElement(corev1.EnvVar{Name: "CAMEL_K_VERSION", Value: defaults.Version}),
 				ContainElement(corev1.EnvVar{Name: "NAMESPACE", ValueFrom: &corev1.EnvVarSource{
 					FieldRef: &corev1.ObjectFieldSelector{