From 9e524db416baf4553eeb1264ef502c958e03a213 Mon Sep 17 00:00:00 2001 From: Gaelle Fournier Date: Fri, 15 Sep 2023 17:07:00 +0200 Subject: [PATCH] fix(e2e): Fix E2E test using kamelet my-own-timer-source ref #4750 --- .../TimerKameletIntegrationConfiguration.java | 2 +- ...rKameletIntegrationNamedConfiguration.java | 2 +- ...let-integration-inlined-configuration.yaml | 4 +- ...-integration-parameters-configuration.yaml | 4 +- e2e/common/config/kamelet_config_test.go | 71 ++++++++++--------- 5 files changed, 42 insertions(+), 41 deletions(-) diff --git a/e2e/common/config/files/TimerKameletIntegrationConfiguration.java b/e2e/common/config/files/TimerKameletIntegrationConfiguration.java index bed8647712..05f0ac09a3 100644 --- a/e2e/common/config/files/TimerKameletIntegrationConfiguration.java +++ b/e2e/common/config/files/TimerKameletIntegrationConfiguration.java @@ -22,7 +22,7 @@ public class TimerKameletIntegrationConfiguration extends RouteBuilder { @Override public void configure() throws Exception { - from("kamelet:my-own-timer-source") + from("kamelet:iconfig-test-timer-source") .to("log:info"); } } diff --git a/e2e/common/config/files/TimerKameletIntegrationNamedConfiguration.java b/e2e/common/config/files/TimerKameletIntegrationNamedConfiguration.java index 6149338275..211b4f4119 100644 --- a/e2e/common/config/files/TimerKameletIntegrationNamedConfiguration.java +++ b/e2e/common/config/files/TimerKameletIntegrationNamedConfiguration.java @@ -22,7 +22,7 @@ public class TimerKameletIntegrationNamedConfiguration extends RouteBuilder { @Override public void configure() throws Exception { - from("kamelet:my-own-timer-source/mynamedconfig") + from("kamelet:iconfig-test-timer-source/mynamedconfig") .to("log:info"); } } diff --git a/e2e/common/config/files/timer-kamelet-integration-inlined-configuration.yaml b/e2e/common/config/files/timer-kamelet-integration-inlined-configuration.yaml index d978a0b9ef..d6fb843ce1 100644 --- a/e2e/common/config/files/timer-kamelet-integration-inlined-configuration.yaml +++ b/e2e/common/config/files/timer-kamelet-integration-inlined-configuration.yaml @@ -17,7 +17,7 @@ - route: from: - uri: "kamelet:my-own-timer-source?message=important%20message" + uri: "kamelet:config-test-timer-source?message=important%20message" steps: - to: - uri: "kamelet:my-own-log-sink?loggerName=integrationLogger" \ No newline at end of file + uri: "kamelet:config-test-log-sink?loggerName=integrationLogger" \ No newline at end of file diff --git a/e2e/common/config/files/timer-kamelet-integration-parameters-configuration.yaml b/e2e/common/config/files/timer-kamelet-integration-parameters-configuration.yaml index 4926ec9148..bb038a38de 100644 --- a/e2e/common/config/files/timer-kamelet-integration-parameters-configuration.yaml +++ b/e2e/common/config/files/timer-kamelet-integration-parameters-configuration.yaml @@ -17,11 +17,11 @@ - route: from: - uri: "kamelet:my-own-timer-source" + uri: "kamelet:config-test-timer-source" parameters: message: "{{my-message}}" steps: - to: - uri: "kamelet:my-own-log-sink" + uri: "kamelet:config-test-log-sink" parameters: loggerName: "{{my-logger}}" \ No newline at end of file diff --git a/e2e/common/config/kamelet_config_test.go b/e2e/common/config/kamelet_config_test.go index 9c37e7e416..0dc76feca5 100644 --- a/e2e/common/config/kamelet_config_test.go +++ b/e2e/common/config/kamelet_config_test.go @@ -37,13 +37,13 @@ import ( func TestKameletImplicitConfig(t *testing.T) { RegisterTestingT(t) t.Run("test custom timer source", func(t *testing.T) { - Expect(CreateTimerKamelet(ns, "my-own-timer-source")()).To(Succeed()) + Expect(CreateTimerKamelet(ns, "iconfig-test-timer-source")()).To(Succeed()) t.Run("run test default config using properties", func(t *testing.T) { - name := "my-own-timer-source-config-properties" + name := "iconfig-test-timer-source-config-properties" Expect(KamelRunWithID(operatorID, ns, "files/TimerKameletIntegrationConfiguration.java", - "-p", "camel.kamelet.my-own-timer-source.message='My Default message'", + "-p", "camel.kamelet.iconfig-test-timer-source.message='My Default message'", "--name", name).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) Eventually(IntegrationLogs(ns, name)).Should(ContainSubstring("My Default message")) @@ -52,17 +52,18 @@ func TestKameletImplicitConfig(t *testing.T) { }) t.Run("run test default config using labeled secret", func(t *testing.T) { - name := "my-own-timer-source-default-config-secret" - secretName := "my-own-timer-source-default" + name := "iconfig-test-timer-source-default-config-secret" + secretName := "my-labeled-iconfig-test-timer-source-default-secret" var secData = make(map[string]string) - secData["camel.kamelet.my-own-timer-source.message"] = "very top secret message" + secData["camel.kamelet.iconfig-test-timer-source.message"] = "very top secret message" var labels = make(map[string]string) - labels["camel.apache.org/kamelet"] = "my-own-timer-source" + labels["camel.apache.org/kamelet"] = "iconfig-test-timer-source" Expect(CreatePlainTextSecretWithLabels(ns, secretName, secData, labels)).To(Succeed()) + Eventually(SecretByName(ns, secretName), TestTimeoutLong).Should(Not(BeNil())) Expect(KamelRunWithID(operatorID, ns, "files/TimerKameletIntegrationConfiguration.java", - "-p", "camel.kamelet.my-own-timer-source.message='Default message'", + "-p", "camel.kamelet.iconfig-test-timer-source.message='Default message'", "--name", name).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) Eventually(IntegrationLogs(ns, name)).Should(ContainSubstring("very top secret message")) @@ -72,11 +73,11 @@ func TestKameletImplicitConfig(t *testing.T) { }) t.Run("run test default config using mounted secret", func(t *testing.T) { - name := "my-own-timer-source-default-config-mounted-secret" + name := "iconfig-test-timer-source-default-config-mounted-secret" secretName := "my-mounted-default-secret" var secData = make(map[string]string) - secData["camel.kamelet.my-own-timer-source.message"] = "very top mounted secret message" + secData["camel.kamelet.iconfig-test-timer-source.message"] = "very top mounted secret message" Expect(CreatePlainTextSecret(ns, secretName, secData)).To(Succeed()) Expect(KamelRunWithID(operatorID, ns, "files/TimerKameletIntegrationConfiguration.java", @@ -90,11 +91,11 @@ func TestKameletImplicitConfig(t *testing.T) { }) t.Run("run test default config using mounted configmap", func(t *testing.T) { - name := "my-own-timer-source-default-config-mounted-configmaps" + name := "iconfig-test-timer-source-default-config-mounted-configmaps" cmName := "my-mounted-default-secret" var cmData = make(map[string]string) - cmData["camel.kamelet.my-own-timer-source.message"] = "very top mounted configmap message" + cmData["camel.kamelet.iconfig-test-timer-source.message"] = "very top mounted configmap message" Expect(CreatePlainTextConfigmap(ns, cmName, cmData)).To(Succeed()) Expect(KamelRunWithID(operatorID, ns, "files/TimerKameletIntegrationConfiguration.java", @@ -108,10 +109,10 @@ func TestKameletImplicitConfig(t *testing.T) { }) t.Run("run test named config using properties", func(t *testing.T) { - name := "my-own-timer-source-config-properties" + name := "iconfig-test-timer-source-config-properties" Expect(KamelRunWithID(operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration.java", - "-p", "camel.kamelet.my-own-timer-source.message='Default message'", - "-p", "camel.kamelet.my-own-timer-source.mynamedconfig.message='My Named Config message'", + "-p", "camel.kamelet.iconfig-test-timer-source.message='Default message'", + "-p", "camel.kamelet.iconfig-test-timer-source.mynamedconfig.message='My Named Config message'", "--name", name).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) Eventually(IntegrationLogs(ns, name)).Should(ContainSubstring("My Named Config message")) @@ -119,18 +120,18 @@ func TestKameletImplicitConfig(t *testing.T) { }) t.Run("run test named config using labeled secret", func(t *testing.T) { - name := "my-own-timer-source-implicit-config-secret" - secretName := "my-own-timer-source-mynamedconfig" + name := "iconfig-test-timer-source-implicit-config-secret" + secretName := "iconfig-test-timer-source-mynamedconfig" var secData = make(map[string]string) - secData["camel.kamelet.my-own-timer-source.mynamedconfig.message"] = "very top named secret message" + secData["camel.kamelet.iconfig-test-timer-source.mynamedconfig.message"] = "very top named secret message" var labels = make(map[string]string) - labels["camel.apache.org/kamelet"] = "my-own-timer-source" + labels["camel.apache.org/kamelet"] = "iconfig-test-timer-source" labels["camel.apache.org/kamelet.configuration"] = "mynamedconfig" Expect(CreatePlainTextSecretWithLabels(ns, secretName, secData, labels)).To(Succeed()) Expect(KamelRunWithID(operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration.java", - "-p", "camel.kamelet.my-own-timer-source.message='Default message'", + "-p", "camel.kamelet.iconfig-test-timer-source.message='Default message'", "--name", name).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) Eventually(IntegrationLogs(ns, name)).Should(ContainSubstring("very top named secret message")) @@ -140,15 +141,15 @@ func TestKameletImplicitConfig(t *testing.T) { }) t.Run("run test named config using mounted secret", func(t *testing.T) { - name := "my-own-timer-source-named-config-mounted-secret" + name := "iconfig-test-timer-source-named-config-mounted-secret" secretName := "my-mounted-named-secret" var secData = make(map[string]string) - secData["camel.kamelet.my-own-timer-source.mynamedconfig.message"] = "very top named mounted secret message" + secData["camel.kamelet.iconfig-test-timer-source.mynamedconfig.message"] = "very top named mounted secret message" Expect(CreatePlainTextSecret(ns, secretName, secData)).To(Succeed()) Expect(KamelRunWithID(operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration.java", - "-p", "camel.kamelet.my-own-timer-source.message='Default message'", + "-p", "camel.kamelet.iconfig-test-timer-source.message='Default message'", "-t", "mount.configs=secret:"+secretName, "--name", name).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) @@ -159,15 +160,15 @@ func TestKameletImplicitConfig(t *testing.T) { }) t.Run("run test named config using mounted configmap", func(t *testing.T) { - name := "my-own-timer-source-named-config-mounted-configmap" + name := "iconfig-test-timer-source-named-config-mounted-configmap" cmName := "my-mounted-named-secret" var cmData = make(map[string]string) - cmData["camel.kamelet.my-own-timer-source.mynamedconfig.message"] = "very top named mounted configmap message" + cmData["camel.kamelet.iconfig-test-timer-source.mynamedconfig.message"] = "very top named mounted configmap message" Expect(CreatePlainTextConfigmap(ns, cmName, cmData)).To(Succeed()) Expect(KamelRunWithID(operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration.java", - "-p", "camel.kamelet.my-own-timer-source.message='Default message'", + "-p", "camel.kamelet.iconfig-test-timer-source.message='Default message'", "-t", "mount.configs=configmap:"+cmName, "--name", name).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) @@ -180,17 +181,17 @@ func TestKameletImplicitConfig(t *testing.T) { }) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) - Expect(DeleteKamelet(ns, "my-own-timer-source")).To(Succeed()) + Expect(DeleteKamelet(ns, "iconfig-test-timer-source")).To(Succeed()) } // Tests on integration with kamelets containing configuration from properties and secrets with parameters inside the integration. func TestKameletConfig(t *testing.T) { RegisterTestingT(t) t.Run("test custom timer source", func(t *testing.T) { - Expect(CreateTimerKamelet(ns, "my-own-timer-source")()).To(Succeed()) - Expect(CreateLogKamelet(ns, "my-own-log-sink")()).To(Succeed()) + Expect(CreateTimerKamelet(ns, "config-test-timer-source")()).To(Succeed()) + Expect(CreateLogKamelet(ns, "config-test-log-sink")()).To(Succeed()) t.Run("run test default config inlined properties", func(t *testing.T) { - name := "my-own-timer-source-inline-properties" + name := "config-test-timer-source-inline-properties" Expect(KamelRunWithID(operatorID, ns, "files/timer-kamelet-integration-inlined-configuration.yaml", "--name", name).Execute()).To(Succeed()) @@ -202,7 +203,7 @@ func TestKameletConfig(t *testing.T) { }) t.Run("run test default config parameters properties", func(t *testing.T) { - name := "my-own-timer-source-parameters-properties" + name := "config-test-timer-source-parameters-properties" Expect(KamelRunWithID(operatorID, ns, "files/timer-kamelet-integration-parameters-configuration.yaml", "-p", "my-message='My parameter message'", @@ -216,7 +217,7 @@ func TestKameletConfig(t *testing.T) { }) t.Run("run test default config secret properties", func(t *testing.T) { - name := "my-own-timer-source-secret-properties" + name := "config-test-timer-source-secret-properties" secretName := "my-mounted-secret-properties" var secData = make(map[string]string) @@ -236,7 +237,7 @@ func TestKameletConfig(t *testing.T) { }) t.Run("run test default config configmap properties", func(t *testing.T) { - name := "my-own-timer-source-configmap-properties" + name := "config-test-timer-source-configmap-properties" cmName := "my-mounted-configmap-properties" var cmData = make(map[string]string) @@ -258,6 +259,6 @@ func TestKameletConfig(t *testing.T) { }) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) - Expect(DeleteKamelet(ns, "my-own-timer-source")).To(Succeed()) - Expect(DeleteKamelet(ns, "my-own-log-sink")).To(Succeed()) + Expect(DeleteKamelet(ns, "config-test-timer-source")).To(Succeed()) + Expect(DeleteKamelet(ns, "config-test-log-sink")).To(Succeed()) }