This is an automated email from the ASF dual-hosted git repository. cdeppisch pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 19199b2ec8030ba225834095d470f20245d359c3 Author: Christoph Deppisch <cdeppi...@redhat.com> AuthorDate: Mon Mar 4 11:05:45 2024 +0100 chore(e2e): Use operator instance per package in common tests - Gain execution speed on GitHub CI jobs - Custom Kamelets creation need to use proper operatorID --- e2e/advanced/build_order_strategy_test.go | 2 +- e2e/advanced/incremental_build_test.go | 5 +- e2e/advanced/main_test.go | 5 ++ e2e/advanced/promote_test.go | 8 +-- e2e/common/cli/bind_test.go | 2 +- e2e/common/config/default.go | 4 +- e2e/common/config/kamelet_config_test.go | 100 +++++++++++++-------------- e2e/common/{setup => config}/main_test.go | 35 ++++------ e2e/common/config/pipe_config_test.go | 4 +- e2e/common/languages/default.go | 4 +- e2e/common/{setup => languages}/main_test.go | 35 ++++------ e2e/common/misc/default.go | 4 +- e2e/common/misc/kamelet_update_test.go | 12 ++-- e2e/common/{setup => misc}/main_test.go | 36 +++++----- e2e/common/misc/pipe_test.go | 10 +-- e2e/common/misc/registry_maven_wagon_test.go | 52 +++++++------- e2e/common/misc/structured_logs_test.go | 3 +- e2e/common/runtimes/default.go | 1 - e2e/common/setup/testdata/Java.java | 28 -------- e2e/common/setup/testdata/yaml.yaml | 28 -------- e2e/common/traits/builder_test.go | 5 +- e2e/common/traits/default.go | 4 +- e2e/common/traits/deployment_test.go | 2 + e2e/common/traits/health_test.go | 4 +- e2e/common/traits/istio_test.go | 7 ++ e2e/common/traits/kamelet_test.go | 2 +- e2e/common/{setup => traits}/main_test.go | 35 ++++------ e2e/common/traits/service_binding_test.go | 2 +- e2e/install/cli/global_kamelet_test.go | 4 +- e2e/knative/kamelet_test.go | 2 +- e2e/support/test_support.go | 23 +++--- e2e/support/test_util.go | 5 ++ pkg/apis/camel/v1/kamelet_types_support.go | 5 ++ script/Makefile | 10 +-- 34 files changed, 216 insertions(+), 272 deletions(-) diff --git a/e2e/advanced/build_order_strategy_test.go b/e2e/advanced/build_order_strategy_test.go index 83dcdce8c..ad30b02e8 100644 --- a/e2e/advanced/build_order_strategy_test.go +++ b/e2e/advanced/build_order_strategy_test.go @@ -46,7 +46,7 @@ func TestRunBuildOrderStrategyMatchingDependencies(t *testing.T) { "--build-order-strategy", string(v1.BuildOrderStrategyDependencies)).Execute()).To(Succeed()) g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) - g.Expect(CreateTimerKamelet(t, ns, "timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "timer-source")()).To(Succeed()) integrationA := RandomizedSuffixName("java-a") g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", diff --git a/e2e/advanced/incremental_build_test.go b/e2e/advanced/incremental_build_test.go index 09172c6ca..40db5479a 100644 --- a/e2e/advanced/incremental_build_test.go +++ b/e2e/advanced/incremental_build_test.go @@ -98,6 +98,7 @@ func TestRunIncrementalBuildPod(t *testing.T) { operatorID := "camel-k-incremental-build-pod" g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed()) g.Expect(KamelInstallWithID(t, operatorID, ns).Execute()).To(Succeed()) + g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) name := RandomizedSuffixName("java") g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", @@ -141,7 +142,7 @@ func TestRunIncrementalBuildPod(t *testing.T) { integrationIncrementalKitName := IntegrationKit(t, ns, nameIncremental)() // the container comes in a format like // 10.108.177.66/test-d7cad110-bb1d-4e79-8a0e-ebd44f6fe5d4/camel-k-kit-c8357r4k5tp6fn1idm60@sha256:d49716f0429ad8b23a1b8d20a357d64b1aa42a67c1a2a534ebd4c54cd598a18d - // we should be save just to check the substring is contained + // we should be saving just to check the substring is contained g.Eventually(Kit(t, ns, integrationIncrementalKitName)().Status.BaseImage).Should(ContainSubstring(integrationKitName)) g.Eventually(Kit(t, ns, integrationIncrementalKitName)().Status.RootImage).Should(Equal(defaults.BaseImage())) g.Eventually(BuilderPodsCount(t, ns)).Should(Equal(2)) @@ -158,6 +159,7 @@ func TestRunIncrementalBuildOff(t *testing.T) { operatorID := "camel-k-standard-build" g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed()) g.Expect(KamelInstallWithID(t, operatorID, ns).Execute()).To(Succeed()) + g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) name := RandomizedSuffixName("java") g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", @@ -209,6 +211,7 @@ func TestRunIncrementalBuildWithDifferentBaseImages(t *testing.T) { operatorID := "camel-k-incremental-different-base" g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed()) g.Expect(KamelInstallWithID(t, operatorID, ns).Execute()).To(Succeed()) + g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) name := RandomizedSuffixName("java") g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", diff --git a/e2e/advanced/main_test.go b/e2e/advanced/main_test.go index 1127038b2..b579b4c7d 100644 --- a/e2e/advanced/main_test.go +++ b/e2e/advanced/main_test.go @@ -37,6 +37,11 @@ import ( ) func TestMain(m *testing.M) { + justCompile := GetEnvOrDefault("CAMEL_K_E2E_JUST_COMPILE", "false") + if justCompile == "true" { + os.Exit(m.Run()) + } + fastSetup := GetEnvOrDefault("CAMEL_K_E2E_FAST_SETUP", "false") if fastSetup != "true" { os.Exit(m.Run()) diff --git a/e2e/advanced/promote_test.go b/e2e/advanced/promote_test.go index 0051dd0cb..6327b0fc5 100644 --- a/e2e/advanced/promote_test.go +++ b/e2e/advanced/promote_test.go @@ -68,14 +68,14 @@ func TestKamelCLIPromote(t *testing.T) { }) t.Run("kamelet integration dev", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, nsDev, "my-own-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorDevID, nsDev, "my-own-timer-source")()).To(Succeed()) g.Expect(KamelRunWithID(t, operatorDevID, nsDev, "./files/timer-kamelet-usage.groovy").Execute()).To(Succeed()) g.Eventually(IntegrationPodPhase(t, nsDev, "timer-kamelet-usage"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationLogs(t, nsDev, "timer-kamelet-usage"), TestTimeoutShort).Should(ContainSubstring("Hello world")) }) t.Run("binding dev", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, nsDev, "kb-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorDevID, nsDev, "kb-timer-source")()).To(Succeed()) g.Expect(KamelBindWithID(t, operatorDevID, nsDev, "kb-timer-source", "log:info", "-p", "source.message=my-kamelet-binding-rocks").Execute()).To(Succeed()) g.Eventually(IntegrationPodPhase(t, nsDev, "kb-timer-source-to-log"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationLogs(t, nsDev, "kb-timer-source-to-log"), TestTimeoutShort).Should(ContainSubstring("my-kamelet-binding-rocks")) @@ -147,7 +147,7 @@ func TestKamelCLIPromote(t *testing.T) { }) t.Run("kamelet integration promotion", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, nsProd, "my-own-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorProdID, nsProd, "my-own-timer-source")()).To(Succeed()) g.Expect(Kamel(t, "promote", "-n", nsDev, "timer-kamelet-usage", "--to", nsProd).Execute()).To(Succeed()) g.Eventually(IntegrationPodPhase(t, nsProd, "timer-kamelet-usage"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationLogs(t, nsProd, "timer-kamelet-usage"), TestTimeoutShort).Should(ContainSubstring("Hello world")) @@ -160,7 +160,7 @@ func TestKamelCLIPromote(t *testing.T) { }) t.Run("binding promotion", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, nsProd, "kb-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorProdID, nsProd, "kb-timer-source")()).To(Succeed()) g.Expect(Kamel(t, "promote", "-n", nsDev, "kb-timer-source-to-log", "--to", nsProd).Execute()).To(Succeed()) g.Eventually(IntegrationPodPhase(t, nsProd, "kb-timer-source-to-log"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationLogs(t, nsProd, "kb-timer-source-to-log"), TestTimeoutShort).Should(ContainSubstring("my-kamelet-binding-rocks")) diff --git a/e2e/common/cli/bind_test.go b/e2e/common/cli/bind_test.go index ed98095c8..40e1afe09 100644 --- a/e2e/common/cli/bind_test.go +++ b/e2e/common/cli/bind_test.go @@ -35,7 +35,7 @@ import ( func TestKamelCLIBind(t *testing.T) { WithNewTestNamespace(t, func(g *WithT, ns string) { kameletName := "test-timer-source" - g.Expect(CreateTimerKamelet(t, ns, kameletName)()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, kameletName)()).To(Succeed()) t.Run("bind timer to log", func(t *testing.T) { g.Expect(KamelBindWithID(t, operatorID, ns, kameletName, "log:info", "-p", "source.message=helloTest").Execute()).To(Succeed()) diff --git a/e2e/common/config/default.go b/e2e/common/config/default.go index 13e78b4f1..d92514a52 100644 --- a/e2e/common/config/default.go +++ b/e2e/common/config/default.go @@ -25,5 +25,5 @@ import ( "github.com/apache/camel-k/v2/pkg/platform" ) -var ns = support.GetEnvOrDefault("CAMEL_K_TEST_NAMESPACE", support.TestDefaultNamespace) -var operatorID = support.GetEnvOrDefault("CAMEL_K_OPERATOR_ID", platform.DefaultPlatformName) +var operatorNS = support.TestDefaultNamespace + "-config" +var operatorID = platform.DefaultPlatformName + "-config" diff --git a/e2e/common/config/kamelet_config_test.go b/e2e/common/config/kamelet_config_test.go index 913a3f206..8cc946cb9 100644 --- a/e2e/common/config/kamelet_config_test.go +++ b/e2e/common/config/kamelet_config_test.go @@ -40,7 +40,7 @@ func TestKameletImplicitConfigDefaultUserPropery(t *testing.T) { WithNewTestNamespace(t, func(g *WithT, ns string) { t.Run("run test default config using properties", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "iconfig01-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig01-timer-source")()).To(Succeed()) name := RandomizedSuffixName("iconfig-test-timer-source-int01") g.Expect(KamelRunWithID(t, operatorID, ns, "files/TimerKameletIntegrationConfiguration01.java", @@ -63,7 +63,7 @@ func TestKameletImplicitConfigDefaultMountedSecret(t *testing.T) { t.Run("run test default config using mounted secret", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "iconfig03-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig03-timer-source")()).To(Succeed()) name := RandomizedSuffixName("iconfig-test-timer-source-int3") secretName := "my-iconfig-int3-secret" @@ -95,7 +95,7 @@ func TestKameletImplicitConfigDefaultMountedConfigmap(t *testing.T) { t.Run("run test default config using mounted configmap", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "iconfig04-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig04-timer-source")()).To(Succeed()) name := RandomizedSuffixName("iconfig-test-timer-source-int4") cmName := "my-iconfig-int4-configmap" @@ -123,7 +123,7 @@ func TestKameletImplicitConfigDefaultMountedConfigmap(t *testing.T) { func TestKameletImplicitConfigNamedUserPropery(t *testing.T) { WithNewTestNamespace(t, func(g *WithT, ns string) { t.Run("run test named config using properties", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "iconfig05-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig05-timer-source")()).To(Succeed()) name := RandomizedSuffixName("iconfig-test-timer-source-int5") g.Expect(KamelRunWithID(t, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration05.java", @@ -145,7 +145,7 @@ func TestKameletImplicitConfigNamedUserPropery(t *testing.T) { func TestKameletImplicitConfigNamedLabeledSecret(t *testing.T) { WithNewTestNamespace(t, func(g *WithT, ns string) { t.Run("run test named config using labeled secret", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "iconfig06-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig06-timer-source")()).To(Succeed()) name := RandomizedSuffixName("iconfig-test-timer-source-int6") secretName := "my-iconfig-int6-secret" @@ -178,7 +178,7 @@ func TestKameletImplicitConfigNamedLabeledSecret(t *testing.T) { func TestKameletImplicitConfigNamedMountedSecret(t *testing.T) { WithNewTestNamespace(t, func(g *WithT, ns string) { t.Run("run test named config using mounted secret", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "iconfig07-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig07-timer-source")()).To(Succeed()) name := RandomizedSuffixName("iconfig-test-timer-source-int7") secretName := "my-iconfig-int7-secret" @@ -209,7 +209,7 @@ func TestKameletImplicitConfigNamedMountedSecret(t *testing.T) { func TestKameletImplicitConfigNamedMountedConfigmap(t *testing.T) { WithNewTestNamespace(t, func(g *WithT, ns string) { t.Run("run test named config using mounted configmap", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "iconfig08-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig08-timer-source")()).To(Succeed()) name := RandomizedSuffixName("iconfig-test-timer-source-int8") cmName := "my-iconfig-int8-configmap" @@ -238,7 +238,7 @@ func TestKameletImplicitConfigNamedMountedConfigmap(t *testing.T) { func TestKameletImplicitConfigDefaultLabeledSecret(t *testing.T) { WithNewTestNamespace(t, func(g *WithT, ns string) { t.Run("run test default config using labeled secret", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "iconfig09-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig09-timer-source")()).To(Succeed()) name := RandomizedSuffixName("iconfig-test-timer-source-int9") secretName := "my-iconfig-int9-secret" @@ -271,8 +271,8 @@ func TestKameletImplicitConfigDefaultLabeledSecret(t *testing.T) { func TestKameletConfigInlinedUserPropery(t *testing.T) { WithNewTestNamespace(t, func(g *WithT, ns string) { t.Run("run test default config inlined properties", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "config01-timer-source")()).To(Succeed()) - g.Expect(CreateLogKamelet(t, ns, "config01-log-sink")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "config01-timer-source")()).To(Succeed()) + g.Expect(CreateLogKamelet(t, operatorID, ns, "config01-log-sink")()).To(Succeed()) name := RandomizedSuffixName("config-test-timer-source-int1") @@ -296,34 +296,32 @@ func TestKameletConfigDefaultParamUserPropery(t *testing.T) { g := NewWithT(t) t.Run("run test default config parameters properties", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "config02-timer-source")()).To(Succeed()) - g.Expect(CreateLogKamelet(t, ns, "config02-log-sink")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, operatorNS, "config02-timer-source")()).To(Succeed()) + g.Expect(CreateLogKamelet(t, operatorID, operatorNS, "config02-log-sink")()).To(Succeed()) name := RandomizedSuffixName("config-test-timer-source-int2") - g.Expect(KamelRunWithID(t, operatorID, ns, "files/timer-kamelet-integration-parameters-configuration-02.yaml", + g.Expect(KamelRunWithID(t, operatorID, operatorNS, "files/timer-kamelet-integration-parameters-configuration-02.yaml", "-p", "my-message='My parameter message 02'", "-p", "my-logger='myIntegrationLogger02'", "--name", name).Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("My parameter message 02")) - g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("myIntegrationLogger02")) - - g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed()) - g.Eventually(Integration(t, ns, name), TestTimeoutLong).Should(BeNil()) - g.Expect(DeleteKamelet(t, ns, "config02-timer-source")).To(Succeed()) - g.Expect(DeleteKamelet(t, ns, "config02-log-sink")).To(Succeed()) + g.Eventually(IntegrationPodPhase(t, operatorNS, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + g.Eventually(IntegrationLogs(t, operatorNS, name)).Should(ContainSubstring("My parameter message 02")) + g.Eventually(IntegrationLogs(t, operatorNS, name)).Should(ContainSubstring("myIntegrationLogger02")) + + g.Expect(Kamel(t, "delete", name, "-n", operatorNS).Execute()).To(Succeed()) + g.Eventually(Integration(t, operatorNS, name), TestTimeoutLong).Should(BeNil()) + g.Expect(DeleteKamelet(t, operatorNS, "config02-timer-source")).To(Succeed()) + g.Expect(DeleteKamelet(t, operatorNS, "config02-log-sink")).To(Succeed()) }) - - g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed()) } func TestKameletConfigDefaultParamMountedSecret(t *testing.T) { g := NewWithT(t) t.Run("run test default config secret properties", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "config03-timer-source")()).To(Succeed()) - g.Expect(CreateLogKamelet(t, ns, "config03-log-sink")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, operatorNS, "config03-timer-source")()).To(Succeed()) + g.Expect(CreateLogKamelet(t, operatorID, operatorNS, "config03-log-sink")()).To(Succeed()) name := RandomizedSuffixName("config-test-timer-source-int3") secretName := "my-config-int3-secret" @@ -331,31 +329,29 @@ func TestKameletConfigDefaultParamMountedSecret(t *testing.T) { var secData = make(map[string]string) secData["my-message"] = "My secret message 03" secData["my-logger"] = "mySecretIntegrationLogger03" - g.Expect(CreatePlainTextSecret(t, ns, secretName, secData)).To(Succeed()) + g.Expect(CreatePlainTextSecret(t, operatorNS, secretName, secData)).To(Succeed()) - g.Expect(KamelRunWithID(t, operatorID, ns, "files/timer-kamelet-integration-parameters-configuration-03.yaml", + g.Expect(KamelRunWithID(t, operatorID, operatorNS, "files/timer-kamelet-integration-parameters-configuration-03.yaml", "-t", "mount.configs=secret:"+secretName, "--name", name).Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("My secret message 03")) - g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("mySecretIntegrationLogger03")) - - g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed()) - g.Eventually(Integration(t, ns, name), TestTimeoutLong).Should(BeNil()) - g.Expect(DeleteSecret(t, ns, secretName)).To(Succeed()) - g.Expect(DeleteKamelet(t, ns, "config03-timer-source")).To(Succeed()) - g.Expect(DeleteKamelet(t, ns, "config03-log-sink")).To(Succeed()) + g.Eventually(IntegrationPodPhase(t, operatorNS, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + g.Eventually(IntegrationLogs(t, operatorNS, name)).Should(ContainSubstring("My secret message 03")) + g.Eventually(IntegrationLogs(t, operatorNS, name)).Should(ContainSubstring("mySecretIntegrationLogger03")) + + g.Expect(Kamel(t, "delete", name, "-n", operatorNS).Execute()).To(Succeed()) + g.Eventually(Integration(t, operatorNS, name), TestTimeoutLong).Should(BeNil()) + g.Expect(DeleteSecret(t, operatorNS, secretName)).To(Succeed()) + g.Expect(DeleteKamelet(t, operatorNS, "config03-timer-source")).To(Succeed()) + g.Expect(DeleteKamelet(t, operatorNS, "config03-log-sink")).To(Succeed()) }) - - g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed()) } func TestKameletConfigDefaultParamMountedConfigmap(t *testing.T) { g := NewWithT(t) t.Run("run test default config configmap properties", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "config04-timer-source")()).To(Succeed()) - g.Expect(CreateLogKamelet(t, ns, "config04-log-sink")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, operatorNS, "config04-timer-source")()).To(Succeed()) + g.Expect(CreateLogKamelet(t, operatorID, operatorNS, "config04-log-sink")()).To(Succeed()) name := RandomizedSuffixName("config-test-timer-source-int4") cmName := "my-config-int4-configmap" @@ -363,21 +359,19 @@ func TestKameletConfigDefaultParamMountedConfigmap(t *testing.T) { var cmData = make(map[string]string) cmData["my-message"] = "My configmap message 04" cmData["my-logger"] = "myConfigmapIntegrationLogger04" - g.Expect(CreatePlainTextConfigmap(t, ns, cmName, cmData)).To(Succeed()) + g.Expect(CreatePlainTextConfigmap(t, operatorNS, cmName, cmData)).To(Succeed()) - g.Expect(KamelRunWithID(t, operatorID, ns, "files/timer-kamelet-integration-parameters-configuration-04.yaml", + g.Expect(KamelRunWithID(t, operatorID, operatorNS, "files/timer-kamelet-integration-parameters-configuration-04.yaml", "-t", "mount.configs=configmap:"+cmName, "--name", name).Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("My configmap message 04")) - g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("myConfigmapIntegrationLogger04")) - - g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed()) - g.Eventually(Integration(t, ns, name), TestTimeoutLong).Should(BeNil()) - g.Expect(DeleteConfigmap(t, ns, cmName)).To(Succeed()) - g.Expect(DeleteKamelet(t, ns, "config04-timer-source")).To(Succeed()) - g.Expect(DeleteKamelet(t, ns, "config04-log-sink")).To(Succeed()) + g.Eventually(IntegrationPodPhase(t, operatorNS, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + g.Eventually(IntegrationLogs(t, operatorNS, name)).Should(ContainSubstring("My configmap message 04")) + g.Eventually(IntegrationLogs(t, operatorNS, name)).Should(ContainSubstring("myConfigmapIntegrationLogger04")) + + g.Expect(Kamel(t, "delete", name, "-n", operatorNS).Execute()).To(Succeed()) + g.Eventually(Integration(t, operatorNS, name), TestTimeoutLong).Should(BeNil()) + g.Expect(DeleteConfigmap(t, operatorNS, cmName)).To(Succeed()) + g.Expect(DeleteKamelet(t, operatorNS, "config04-timer-source")).To(Succeed()) + g.Expect(DeleteKamelet(t, operatorNS, "config04-log-sink")).To(Succeed()) }) - - g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed()) } diff --git a/e2e/common/setup/main_test.go b/e2e/common/config/main_test.go similarity index 50% copy from e2e/common/setup/main_test.go copy to e2e/common/config/main_test.go index d303f2483..1f977eab9 100644 --- a/e2e/common/setup/main_test.go +++ b/e2e/common/config/main_test.go @@ -20,48 +20,43 @@ See the License for the specific language governing permissions and limitations under the License. */ -package setup +package config import ( "fmt" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" "os" "testing" . "github.com/onsi/gomega" . "github.com/apache/camel-k/v2/e2e/support" - v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" - "github.com/apache/camel-k/v2/pkg/platform" - - corev1 "k8s.io/api/core/v1" ) func TestMain(m *testing.M) { - fastSetup := GetEnvOrDefault("CAMEL_K_E2E_FAST_SETUP", "false") - if fastSetup != "true" { + justCompile := GetEnvOrDefault("CAMEL_K_E2E_JUST_COMPILE", "false") + if justCompile == "true" { os.Exit(m.Run()) } - operatorID := platform.DefaultPlatformName - ns := GetEnvOrDefault("CAMEL_K_GLOBAL_OPERATOR_NS", TestDefaultNamespace) - g := NewGomega(func(message string, callerSkip ...int) { - fmt.Printf("Test fast setup failed! - %s\n", message) + fmt.Printf("Test setup failed! - %s\n", message) }) var t *testing.T g.Expect(TestClient(t)).ShouldNot(BeNil()) - g.Expect(KamelRunWithID(t, operatorID, ns, "testdata/Java.java").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + // Install global operator for tests in this package, all tests must use this operatorID so tests can run in parallel and gain execution speed + g.Expect(NewNamedTestNamespace(t, operatorNS, false)).ShouldNot(BeNil()) + g.Expect(CopyCamelCatalog(t, operatorNS, operatorID)).To(Succeed()) + g.Expect(KamelInstallWithID(t, operatorID, operatorNS, "--global", "--force").Execute()).To(Succeed()) + g.Eventually(SelectedPlatformPhase(t, operatorNS, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) + + exitCode := m.Run() - g.Expect(KamelRunWithID(t, operatorID, ns, "testdata/yaml.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, "yaml", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + g.Expect(UninstallFromNamespace(t, operatorNS)) + g.Expect(DeleteNamespace(t, operatorNS)).To(Succeed()) - os.Exit(m.Run()) + os.Exit(exitCode) } diff --git a/e2e/common/config/pipe_config_test.go b/e2e/common/config/pipe_config_test.go index 1e8af0462..272ed84de 100644 --- a/e2e/common/config/pipe_config_test.go +++ b/e2e/common/config/pipe_config_test.go @@ -37,8 +37,8 @@ func TestPipeConfig(t *testing.T) { WithNewTestNamespace(t, func(g *WithT, ns string) { t.Run("test custom source/sink pipe", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "my-pipe-timer-source")()).To(Succeed()) - g.Expect(CreateLogKamelet(t, ns, "my-pipe-log-sink")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "my-pipe-timer-source")()).To(Succeed()) + g.Expect(CreateLogKamelet(t, operatorID, ns, "my-pipe-log-sink")()).To(Succeed()) t.Run("run test default config using properties", func(t *testing.T) { name := RandomizedSuffixName("my-pipe-with-properties") diff --git a/e2e/common/languages/default.go b/e2e/common/languages/default.go index 63569d2b2..2a7e2e176 100644 --- a/e2e/common/languages/default.go +++ b/e2e/common/languages/default.go @@ -25,5 +25,5 @@ import ( "github.com/apache/camel-k/v2/pkg/platform" ) -var ns = support.GetEnvOrDefault("CAMEL_K_TEST_NAMESPACE", support.TestDefaultNamespace) -var operatorID = support.GetEnvOrDefault("CAMEL_K_OPERATOR_ID", platform.DefaultPlatformName) +var operatorNS = support.TestDefaultNamespace + "-languages" +var operatorID = platform.DefaultPlatformName + "-languages" diff --git a/e2e/common/setup/main_test.go b/e2e/common/languages/main_test.go similarity index 50% copy from e2e/common/setup/main_test.go copy to e2e/common/languages/main_test.go index d303f2483..10800b385 100644 --- a/e2e/common/setup/main_test.go +++ b/e2e/common/languages/main_test.go @@ -20,48 +20,43 @@ See the License for the specific language governing permissions and limitations under the License. */ -package setup +package languages import ( "fmt" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" "os" "testing" . "github.com/onsi/gomega" . "github.com/apache/camel-k/v2/e2e/support" - v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" - "github.com/apache/camel-k/v2/pkg/platform" - - corev1 "k8s.io/api/core/v1" ) func TestMain(m *testing.M) { - fastSetup := GetEnvOrDefault("CAMEL_K_E2E_FAST_SETUP", "false") - if fastSetup != "true" { + justCompile := GetEnvOrDefault("CAMEL_K_E2E_JUST_COMPILE", "false") + if justCompile == "true" { os.Exit(m.Run()) } - operatorID := platform.DefaultPlatformName - ns := GetEnvOrDefault("CAMEL_K_GLOBAL_OPERATOR_NS", TestDefaultNamespace) - g := NewGomega(func(message string, callerSkip ...int) { - fmt.Printf("Test fast setup failed! - %s\n", message) + fmt.Printf("Test setup failed! - %s\n", message) }) var t *testing.T g.Expect(TestClient(t)).ShouldNot(BeNil()) - g.Expect(KamelRunWithID(t, operatorID, ns, "testdata/Java.java").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + // Install global operator for tests in this package, all tests must use this operatorID so tests can run in parallel and gain execution speed + g.Expect(NewNamedTestNamespace(t, operatorNS, false)).ShouldNot(BeNil()) + g.Expect(CopyCamelCatalog(t, operatorNS, operatorID)).To(Succeed()) + g.Expect(KamelInstallWithID(t, operatorID, operatorNS, "--global", "--force").Execute()).To(Succeed()) + g.Eventually(SelectedPlatformPhase(t, operatorNS, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) + + exitCode := m.Run() - g.Expect(KamelRunWithID(t, operatorID, ns, "testdata/yaml.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, "yaml", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + g.Expect(UninstallFromNamespace(t, operatorNS)) + g.Expect(DeleteNamespace(t, operatorNS)).To(Succeed()) - os.Exit(m.Run()) + os.Exit(exitCode) } diff --git a/e2e/common/misc/default.go b/e2e/common/misc/default.go index 794d34d8e..9e677ac69 100644 --- a/e2e/common/misc/default.go +++ b/e2e/common/misc/default.go @@ -25,5 +25,5 @@ import ( "github.com/apache/camel-k/v2/pkg/platform" ) -var ns = support.GetEnvOrDefault("CAMEL_K_TEST_NAMESPACE", support.TestDefaultNamespace) -var operatorID = support.GetEnvOrDefault("CAMEL_K_OPERATOR_ID", platform.DefaultPlatformName) +var operatorNS = support.TestDefaultNamespace + "-misc" +var operatorID = platform.DefaultPlatformName + "-misc" diff --git a/e2e/common/misc/kamelet_update_test.go b/e2e/common/misc/kamelet_update_test.go index adc0a326f..faf251b42 100644 --- a/e2e/common/misc/kamelet_update_test.go +++ b/e2e/common/misc/kamelet_update_test.go @@ -39,8 +39,8 @@ func TestBundleKameletUpdate(t *testing.T) { WithNewTestNamespace(t, func(g *WithT, ns string) { - g.Expect(createBundleKamelet(t, ns, "my-http-sink")()).To(Succeed()) // Going to be replaced - g.Expect(createUserKamelet(t, ns, "user-sink")()).To(Succeed()) // Left intact by the operator + g.Expect(createBundleKamelet(t, operatorID, ns, "my-http-sink")()).To(Succeed()) // Going to be replaced + g.Expect(createUserKamelet(t, operatorID, ns, "user-sink")()).To(Succeed()) // Left intact by the operator g.Eventually(Kamelet(t, "my-http-sink", ns)). Should(WithTransform(KameletLabels, HaveKeyWithValue(customLabel, "true"))) @@ -51,7 +51,7 @@ func TestBundleKameletUpdate(t *testing.T) { }) } -func createBundleKamelet(t *testing.T, ns string, name string) func() error { +func createBundleKamelet(t *testing.T, operatorID string, ns string, name string) func() error { flow := map[string]interface{}{ "from": map[string]interface{}{ "uri": "kamelet:source", @@ -62,10 +62,10 @@ func createBundleKamelet(t *testing.T, ns string, name string) func() error { customLabel: "true", v1.KameletBundledLabel: "true", } - return CreateKamelet(t, ns, name, flow, nil, labels) + return CreateKamelet(t, operatorID, ns, name, flow, nil, labels) } -func createUserKamelet(t *testing.T, ns string, name string) func() error { +func createUserKamelet(t *testing.T, operatorID string, ns string, name string) func() error { flow := map[string]interface{}{ "from": map[string]interface{}{ "uri": "kamelet:source", @@ -75,5 +75,5 @@ func createUserKamelet(t *testing.T, ns string, name string) func() error { labels := map[string]string{ customLabel: "true", } - return CreateKamelet(t, ns, name, flow, nil, labels) + return CreateKamelet(t, operatorID, ns, name, flow, nil, labels) } diff --git a/e2e/common/setup/main_test.go b/e2e/common/misc/main_test.go similarity index 50% copy from e2e/common/setup/main_test.go copy to e2e/common/misc/main_test.go index d303f2483..bf4aea736 100644 --- a/e2e/common/setup/main_test.go +++ b/e2e/common/misc/main_test.go @@ -20,48 +20,44 @@ See the License for the specific language governing permissions and limitations under the License. */ -package setup +package misc import ( "fmt" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" "os" "testing" . "github.com/onsi/gomega" . "github.com/apache/camel-k/v2/e2e/support" - v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" - "github.com/apache/camel-k/v2/pkg/platform" - - corev1 "k8s.io/api/core/v1" ) func TestMain(m *testing.M) { - fastSetup := GetEnvOrDefault("CAMEL_K_E2E_FAST_SETUP", "false") - if fastSetup != "true" { + justCompile := GetEnvOrDefault("CAMEL_K_E2E_JUST_COMPILE", "false") + if justCompile == "true" { os.Exit(m.Run()) } - operatorID := platform.DefaultPlatformName - ns := GetEnvOrDefault("CAMEL_K_GLOBAL_OPERATOR_NS", TestDefaultNamespace) - g := NewGomega(func(message string, callerSkip ...int) { - fmt.Printf("Test fast setup failed! - %s\n", message) + fmt.Printf("Test setup failed! - %s\n", message) }) var t *testing.T g.Expect(TestClient(t)).ShouldNot(BeNil()) - g.Expect(KamelRunWithID(t, operatorID, ns, "testdata/Java.java").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + // Install global operator for tests in this package, all tests must use this operatorID so tests can run in parallel and gain execution speed + g.Expect(NewNamedTestNamespace(t, operatorNS, false)).ShouldNot(BeNil()) + g.Expect(CopyCamelCatalog(t, operatorNS, operatorID)).To(Succeed()) + // Need Kamelet catalog for pipe bind tests + g.Expect(KamelInstallWithIDAndKameletCatalog(t, operatorID, operatorNS, "--global", "--force").Execute()).To(Succeed()) + g.Eventually(SelectedPlatformPhase(t, operatorNS, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) + + exitCode := m.Run() - g.Expect(KamelRunWithID(t, operatorID, ns, "testdata/yaml.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, "yaml", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + g.Expect(UninstallFromNamespace(t, operatorNS)) + g.Expect(DeleteNamespace(t, operatorNS)).To(Succeed()) - os.Exit(m.Run()) + os.Exit(exitCode) } diff --git a/e2e/common/misc/pipe_test.go b/e2e/common/misc/pipe_test.go index 60abb04ba..ab143b47f 100644 --- a/e2e/common/misc/pipe_test.go +++ b/e2e/common/misc/pipe_test.go @@ -41,8 +41,8 @@ func TestPipe(t *testing.T) { // Error Handler testing t.Run("test error handler", func(t *testing.T) { - g.Expect(createErrorProducerKamelet(t, ns, "my-own-error-producer-source")()).To(Succeed()) - g.Expect(CreateLogKamelet(t, ns, "my-own-log-sink")()).To(Succeed()) + g.Expect(createErrorProducerKamelet(t, operatorID, ns, "my-own-error-producer-source")()).To(Succeed()) + g.Expect(CreateLogKamelet(t, operatorID, ns, "my-own-log-sink")()).To(Succeed()) t.Run("throw error test", func(t *testing.T) { g.Expect(KamelBindWithID(t, operatorID, ns, @@ -85,7 +85,7 @@ func TestPipe(t *testing.T) { //Pipe with traits testing t.Run("test Pipe with trait", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, ns, "my-own-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "my-own-timer-source")()).To(Succeed()) // Log sink kamelet exists from previous test g.Expect(KamelBindWithID(t, operatorID, ns, @@ -122,7 +122,7 @@ func TestPipe(t *testing.T) { }) } -func createErrorProducerKamelet(t *testing.T, ns string, name string) func() error { +func createErrorProducerKamelet(t *testing.T, operatorID string, ns string, name string) func() error { props := map[string]v1.JSONSchemaProp{ "message": { Type: "string", @@ -150,5 +150,5 @@ func createErrorProducerKamelet(t *testing.T, ns string, name string) func() err }, } - return CreateKamelet(t, ns, name, flow, props, nil) + return CreateKamelet(t, operatorID, ns, name, flow, props, nil) } diff --git a/e2e/common/misc/registry_maven_wagon_test.go b/e2e/common/misc/registry_maven_wagon_test.go index fe2b90f10..6a13787c3 100644 --- a/e2e/common/misc/registry_maven_wagon_test.go +++ b/e2e/common/misc/registry_maven_wagon_test.go @@ -56,59 +56,59 @@ func TestImageRegistryIsAMavenRepository(t *testing.T) { pom, err := filepath.Abs("files/registry/sample-decryption-1.0.pom") require.NoError(t, err) - g.Expect(KamelRunWithID(t, operatorID, ns, "files/registry/FoobarDecryption.java", + g.Expect(KamelRunWithID(t, operatorID, operatorNS, "files/registry/FoobarDecryption.java", "--name", name, "-d", fmt.Sprintf("file://%s", jar), "-d", fmt.Sprintf("file://%s", pom), ).Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("foobar")) + g.Eventually(IntegrationPodPhase(t, operatorNS, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + g.Eventually(IntegrationConditionStatus(t, operatorNS, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue)) + g.Eventually(IntegrationLogs(t, operatorNS, name), TestTimeoutShort).Should(ContainSubstring("foobar")) }) t.Run("local files are mounted in the integration container at the default path", func(t *testing.T) { name := RandomizedSuffixName("laughing-route-default-path") - g.Expect(KamelRunWithID(t, operatorID, ns, "files/registry/LaughingRoute.java", + g.Expect(KamelRunWithID(t, operatorID, operatorNS, "files/registry/LaughingRoute.java", "--name", name, "-p", "location=/deployments/?filename=laugh.txt", "-d", "file://files/registry/laugh.txt", ).Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("haha")) + g.Eventually(IntegrationPodPhase(t, operatorNS, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + g.Eventually(IntegrationConditionStatus(t, operatorNS, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) + g.Eventually(IntegrationLogs(t, operatorNS, name), TestTimeoutShort).Should(ContainSubstring("haha")) }) t.Run("local files are mounted in the integration container at a custom path", func(t *testing.T) { name := RandomizedSuffixName("laughing-route-custom-path") customPath := "this/is/a/custom/path/" - g.Expect(KamelRunWithID(t, operatorID, ns, "files/registry/LaughingRoute.java", + g.Expect(KamelRunWithID(t, operatorID, operatorNS, "files/registry/LaughingRoute.java", "--name", name, "-p", fmt.Sprintf("location=%s", customPath), "-d", fmt.Sprintf("file://files/registry/laugh.txt?targetPath=%slaugh.txt", customPath), ).Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("haha")) + g.Eventually(IntegrationPodPhase(t, operatorNS, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + g.Eventually(IntegrationConditionStatus(t, operatorNS, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) + g.Eventually(IntegrationLogs(t, operatorNS, name), TestTimeoutShort).Should(ContainSubstring("haha")) }) t.Run("local directory is mounted in the integration container", func(t *testing.T) { name := RandomizedSuffixName("laughing-route-directory") - g.Expect(KamelRunWithID(t, operatorID, ns, "files/registry/LaughingRoute.java", + g.Expect(KamelRunWithID(t, operatorID, operatorNS, "files/registry/LaughingRoute.java", "--name", name, "-p", "location=files/registry/", "-d", fmt.Sprintf("file://files/registry/laughs/?targetPath=files/registry/"), ).Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("haha")) - g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("hehe")) + g.Eventually(IntegrationPodPhase(t, operatorNS, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + g.Eventually(IntegrationConditionStatus(t, operatorNS, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) + g.Eventually(IntegrationLogs(t, operatorNS, name), TestTimeoutShort).Should(ContainSubstring("haha")) + g.Eventually(IntegrationLogs(t, operatorNS, name), TestTimeoutShort).Should(ContainSubstring("hehe")) }) t.Run("pom file is extracted from JAR", func(t *testing.T) { @@ -117,28 +117,28 @@ func TestImageRegistryIsAMavenRepository(t *testing.T) { jar, err := filepath.Abs("files/registry/sample-decryption-1.0.jar") require.NoError(t, err) - g.Expect(KamelRunWithID(t, operatorID, ns, "files/registry/FoobarDecryption.java", + g.Expect(KamelRunWithID(t, operatorID, operatorNS, "files/registry/FoobarDecryption.java", "--name", name, "-d", fmt.Sprintf("file://%s", jar), ).Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("foobar")) + g.Eventually(IntegrationPodPhase(t, operatorNS, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + g.Eventually(IntegrationConditionStatus(t, operatorNS, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) + g.Eventually(IntegrationLogs(t, operatorNS, name), TestTimeoutShort).Should(ContainSubstring("foobar")) }) t.Run("dependency can be used at build time", func(t *testing.T) { // Create integration that should run an Xslt transformation whose template needs to be present at build time name := RandomizedSuffixName("xslt") - g.Expect(KamelRunWithID(t, operatorID, ns, "files/registry/classpath/Xslt.java", "--name", name, + g.Expect(KamelRunWithID(t, operatorID, operatorNS, "files/registry/classpath/Xslt.java", "--name", name, "-d", "file://files/registry/classpath/cheese.xsl?targetPath=xslt/cheese.xsl&classpath=true", ).Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("<cheese><item>A</item></cheese>")) + g.Eventually(IntegrationPodPhase(t, operatorNS, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + g.Eventually(IntegrationConditionStatus(t, operatorNS, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue)) + g.Eventually(IntegrationLogs(t, operatorNS, name), TestTimeoutShort).Should(ContainSubstring("<cheese><item>A</item></cheese>")) }) // Clean up - g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed()) + g.Expect(Kamel(t, "delete", "--all", "-n", operatorNS).Execute()).To(Succeed()) } diff --git a/e2e/common/misc/structured_logs_test.go b/e2e/common/misc/structured_logs_test.go index 2182f4579..9bb03c8c3 100644 --- a/e2e/common/misc/structured_logs_test.go +++ b/e2e/common/misc/structured_logs_test.go @@ -46,8 +46,7 @@ func TestStructuredLogs(t *testing.T) { g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - opns := GetEnvOrDefault("CAMEL_K_GLOBAL_OPERATOR_NS", TestDefaultNamespace) - pod := OperatorPod(t, opns)() + pod := OperatorPod(t, operatorNS)() g.Expect(pod).NotTo(BeNil()) // pod.Namespace could be different from ns if using global operator diff --git a/e2e/common/runtimes/default.go b/e2e/common/runtimes/default.go index dec3b52c7..7191aee4f 100644 --- a/e2e/common/runtimes/default.go +++ b/e2e/common/runtimes/default.go @@ -25,5 +25,4 @@ import ( "github.com/apache/camel-k/v2/pkg/platform" ) -var ns = support.GetEnvOrDefault("CAMEL_K_TEST_NAMESPACE", support.TestDefaultNamespace) var operatorID = support.GetEnvOrDefault("CAMEL_K_OPERATOR_ID", platform.DefaultPlatformName) diff --git a/e2e/common/setup/testdata/Java.java b/e2e/common/setup/testdata/Java.java deleted file mode 100644 index 66fef5fe8..000000000 --- a/e2e/common/setup/testdata/Java.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ - -import org.apache.camel.builder.RouteBuilder; - -public class Java extends RouteBuilder { - @Override - public void configure() throws Exception { - from("timer:tick") - .setHeader("m").constant("string!") - .setBody().simple("Magic${header.m}") - .log("${body}"); - } -} diff --git a/e2e/common/setup/testdata/yaml.yaml b/e2e/common/setup/testdata/yaml.yaml deleted file mode 100644 index 8877c8557..000000000 --- a/e2e/common/setup/testdata/yaml.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# --------------------------------------------------------------------------- -# 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. -# --------------------------------------------------------------------------- - -- from: - uri: "timer:yaml" - parameters: - period: "5000" - steps: - - setHeader: - name: "m" - constant: "string!" - - setBody: - simple: "Magic${header.m}" - - to: "log:info" diff --git a/e2e/common/traits/builder_test.go b/e2e/common/traits/builder_test.go index 3f0ea3650..e9be79107 100644 --- a/e2e/common/traits/builder_test.go +++ b/e2e/common/traits/builder_test.go @@ -237,10 +237,9 @@ func TestBuilderTrait(t *testing.T) { t.Run("Run maven profile", func(t *testing.T) { name := RandomizedSuffixName("java-maven-profile") - opns := GetEnvOrDefault("CAMEL_K_GLOBAL_OPERATOR_NS", TestDefaultNamespace) - mavenProfile1Cm := newMavenProfileConfigMap(opns, "maven-profile-owasp", "owasp-profile") + mavenProfile1Cm := newMavenProfileConfigMap(operatorNS, "maven-profile-owasp", "owasp-profile") g.Expect(TestClient(t).Create(TestContext, mavenProfile1Cm)).To(Succeed()) - mavenProfile2Cm := newMavenProfileConfigMap(opns, "maven-profile-dependency", "dependency-profile") + mavenProfile2Cm := newMavenProfileConfigMap(operatorNS, "maven-profile-dependency", "dependency-profile") g.Expect(TestClient(t).Create(TestContext, mavenProfile2Cm)).To(Succeed()) g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", diff --git a/e2e/common/traits/default.go b/e2e/common/traits/default.go index bc4034843..4721ebd36 100644 --- a/e2e/common/traits/default.go +++ b/e2e/common/traits/default.go @@ -25,5 +25,5 @@ import ( "github.com/apache/camel-k/v2/pkg/platform" ) -var ns = support.GetEnvOrDefault("CAMEL_K_TEST_NAMESPACE", support.TestDefaultNamespace) -var operatorID = support.GetEnvOrDefault("CAMEL_K_OPERATOR_ID", platform.DefaultPlatformName) +var operatorNS = support.TestDefaultNamespace + "-traits" +var operatorID = platform.DefaultPlatformName + "-traits" diff --git a/e2e/common/traits/deployment_test.go b/e2e/common/traits/deployment_test.go index 6021b70a7..1ed16e07b 100644 --- a/e2e/common/traits/deployment_test.go +++ b/e2e/common/traits/deployment_test.go @@ -80,6 +80,8 @@ func TestRecreateDeploymentStrategyTrait(t *testing.T) { } func TestRollingUpdateDeploymentStrategyTrait(t *testing.T) { + t.Parallel() + WithNewTestNamespace(t, func(g *WithT, ns string) { t.Run("Run with RollingUpdate Deployment Strategy", func(t *testing.T) { diff --git a/e2e/common/traits/health_test.go b/e2e/common/traits/health_test.go index 658c66535..87bca537f 100644 --- a/e2e/common/traits/health_test.go +++ b/e2e/common/traits/health_test.go @@ -252,8 +252,8 @@ func TestHealthTrait(t *testing.T) { source := RandomizedSuffixName("my-health-timer-source") sink := RandomizedSuffixName("my-health-log-sink") - g.Expect(CreateTimerKamelet(t, ns, source)()).To(Succeed()) - g.Expect(CreateLogKamelet(t, ns, sink)()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, source)()).To(Succeed()) + g.Expect(CreateLogKamelet(t, operatorID, ns, sink)()).To(Succeed()) g.Expect(KamelBindWithID(t, operatorID, ns, source, diff --git a/e2e/common/traits/istio_test.go b/e2e/common/traits/istio_test.go index 3a80c4278..95c3323c8 100644 --- a/e2e/common/traits/istio_test.go +++ b/e2e/common/traits/istio_test.go @@ -23,6 +23,7 @@ limitations under the License. package traits import ( + "fmt" "testing" . "github.com/onsi/gomega" @@ -38,6 +39,12 @@ func TestIstioTrait(t *testing.T) { t.Parallel() WithNewTestNamespace(t, func(g *WithT, ns string) { + operatorID := fmt.Sprintf("camel-k-%s", ns) + g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed()) + g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed()) + g.Expect(KamelInstallWithID(t, operatorID, ns).Execute()).To(Succeed()) + + g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) t.Run("Run Java with Istio", func(t *testing.T) { name := RandomizedSuffixName("java") diff --git a/e2e/common/traits/kamelet_test.go b/e2e/common/traits/kamelet_test.go index 31e27323a..b79870091 100644 --- a/e2e/common/traits/kamelet_test.go +++ b/e2e/common/traits/kamelet_test.go @@ -49,7 +49,7 @@ func TestKameletTrait(t *testing.T) { }, }, } - g.Expect(CreateKamelet(t, ns, "capabilities-webhook-source", template, nil, nil)()).To(Succeed()) + g.Expect(CreateKamelet(t, operatorID, ns, "capabilities-webhook-source", template, nil, nil)()).To(Succeed()) name := RandomizedSuffixName("webhook") g.Expect(KamelRunWithID(t, operatorID, ns, "files/webhook.yaml", "--name", name).Execute()).To(Succeed()) diff --git a/e2e/common/setup/main_test.go b/e2e/common/traits/main_test.go similarity index 50% rename from e2e/common/setup/main_test.go rename to e2e/common/traits/main_test.go index d303f2483..f7f835f6a 100644 --- a/e2e/common/setup/main_test.go +++ b/e2e/common/traits/main_test.go @@ -20,48 +20,43 @@ See the License for the specific language governing permissions and limitations under the License. */ -package setup +package traits import ( "fmt" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" "os" "testing" . "github.com/onsi/gomega" . "github.com/apache/camel-k/v2/e2e/support" - v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" - "github.com/apache/camel-k/v2/pkg/platform" - - corev1 "k8s.io/api/core/v1" ) func TestMain(m *testing.M) { - fastSetup := GetEnvOrDefault("CAMEL_K_E2E_FAST_SETUP", "false") - if fastSetup != "true" { + justCompile := GetEnvOrDefault("CAMEL_K_E2E_JUST_COMPILE", "false") + if justCompile == "true" { os.Exit(m.Run()) } - operatorID := platform.DefaultPlatformName - ns := GetEnvOrDefault("CAMEL_K_GLOBAL_OPERATOR_NS", TestDefaultNamespace) - g := NewGomega(func(message string, callerSkip ...int) { - fmt.Printf("Test fast setup failed! - %s\n", message) + fmt.Printf("Test setup failed! - %s\n", message) }) var t *testing.T g.Expect(TestClient(t)).ShouldNot(BeNil()) - g.Expect(KamelRunWithID(t, operatorID, ns, "testdata/Java.java").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + // Install global operator for tests in this package, all tests must use this operatorID so tests can run in parallel and gain execution speed + g.Expect(NewNamedTestNamespace(t, operatorNS, false)).ShouldNot(BeNil()) + g.Expect(CopyCamelCatalog(t, operatorNS, operatorID)).To(Succeed()) + g.Expect(KamelInstallWithID(t, operatorID, operatorNS, "--global", "--force").Execute()).To(Succeed()) + g.Eventually(SelectedPlatformPhase(t, operatorNS, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) + + exitCode := m.Run() - g.Expect(KamelRunWithID(t, operatorID, ns, "testdata/yaml.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ns, "yaml", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + g.Expect(UninstallFromNamespace(t, operatorNS)) + g.Expect(DeleteNamespace(t, operatorNS)).To(Succeed()) - os.Exit(m.Run()) + os.Exit(exitCode) } diff --git a/e2e/common/traits/service_binding_test.go b/e2e/common/traits/service_binding_test.go index 656b90360..a6b66ef87 100644 --- a/e2e/common/traits/service_binding_test.go +++ b/e2e/common/traits/service_binding_test.go @@ -97,7 +97,7 @@ func TestServiceBindingTrait(t *testing.T) { } serviceRef := fmt.Sprintf("%s:%s/%s", service.TypeMeta.Kind, ns, service.ObjectMeta.Name) g.Expect(TestClient(t).Create(TestContext, service)).To(Succeed()) - g.Expect(CreateTimerKamelet(t, ns, "my-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, "my-timer-source")()).To(Succeed()) g.Expect(KamelBindWithID(t, operatorID, ns, "my-timer-source", "log:info", "-p", "source.message=Hello+world", "--connect", serviceRef).Execute()).To(Succeed()) diff --git a/e2e/install/cli/global_kamelet_test.go b/e2e/install/cli/global_kamelet_test.go index 5becde9c3..15ae5871e 100644 --- a/e2e/install/cli/global_kamelet_test.go +++ b/e2e/install/cli/global_kamelet_test.go @@ -40,7 +40,7 @@ func TestRunGlobalKamelet(t *testing.T) { // NS2: namespace without operator WithNewTestNamespace(t, func(g *WithT, ns2 string) { - g.Expect(CreateTimerKamelet(t, ns2, "my-own-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns2, "my-own-timer-source")()).To(Succeed()) g.Expect(KamelInstallWithID(t, operatorID, ns2, "--skip-operator-setup", "--olm=false").Execute()).To(Succeed()) @@ -53,7 +53,7 @@ func TestRunGlobalKamelet(t *testing.T) { t.Run("Global operator + global kamelet test", func(t *testing.T) { - g.Expect(CreateTimerKamelet(t, operatorNamespace, "my-own-timer-source")()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, operatorNamespace, "my-own-timer-source")()).To(Succeed()) // NS3: namespace without operator WithNewTestNamespace(t, func(g *WithT, ns3 string) { diff --git a/e2e/knative/kamelet_test.go b/e2e/knative/kamelet_test.go index 2826af61a..50c76767b 100644 --- a/e2e/knative/kamelet_test.go +++ b/e2e/knative/kamelet_test.go @@ -44,7 +44,7 @@ func TestKameletChange(t *testing.T) { knChannel := "test-kamelet-messages" knChannelConf := fmt.Sprintf("%s:InMemoryChannel:%s", messaging.SchemeGroupVersion.String(), knChannel) timerSource := "my-timer-source" - g.Expect(CreateTimerKamelet(t, ns, timerSource)()).To(Succeed()) + g.Expect(CreateTimerKamelet(t, operatorID, ns, timerSource)()).To(Succeed()) g.Expect(CreateKnativeChannel(t, ns, knChannel)()).To(Succeed()) // Consumer route that will read from the KNative channel g.Expect(KamelRunWithID(t, operatorID, ns, "files/test-kamelet-display.groovy", "-w").Execute()).To(Succeed()) diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go index 95564f1ff..3fac8750c 100644 --- a/e2e/support/test_support.go +++ b/e2e/support/test_support.go @@ -2668,7 +2668,7 @@ func CreateKnativeBroker(t *testing.T, ns string, name string) func() error { Kamelets */ -func CreateKamelet(t *testing.T, ns string, name string, template map[string]interface{}, properties map[string]v1.JSONSchemaProp, labels map[string]string) func() error { +func CreateKamelet(t *testing.T, operatorID string, ns string, name string, template map[string]interface{}, properties map[string]v1.JSONSchemaProp, labels map[string]string) func() error { return func() error { kamelet := v1.Kamelet{ ObjectMeta: metav1.ObjectMeta{ @@ -2683,11 +2683,13 @@ func CreateKamelet(t *testing.T, ns string, name string, template map[string]int Template: asTemplate(t, template), }, } + + kamelet.SetOperatorID(operatorID) return TestClient(t).Create(TestContext, &kamelet) } } -func CreateTimerKamelet(t *testing.T, ns string, name string) func() error { +func CreateTimerKamelet(t *testing.T, operatorID string, ns string, name string) func() error { props := map[string]v1.JSONSchemaProp{ "message": { Type: "string", @@ -2710,7 +2712,7 @@ func CreateTimerKamelet(t *testing.T, ns string, name string) func() error { }, } - return CreateKamelet(t, ns, name, flow, props, nil) + return CreateKamelet(t, operatorID, ns, name, flow, props, nil) } func DeleteKamelet(t *testing.T, ns string, name string) error { @@ -2869,7 +2871,7 @@ func deleteKnativeBroker(t *testing.T, ns metav1.Object) { func deleteTestNamespace(t *testing.T, ns ctrl.Object) { value, saveNS := os.LookupEnv("CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE") - if t.Failed() && saveNS && value == "true" { + if t != nil && t.Failed() && saveNS && value == "true" { t.Logf("Warning: retaining failed test project %q", ns.GetName()) return } @@ -2946,12 +2948,10 @@ func DeleteNamespace(t *testing.T, ns string) error { } func NewTestNamespace(t *testing.T, injectKnativeBroker bool) ctrl.Object { - brokerLabel := "eventing.knative.dev/injection" name := os.Getenv("CAMEL_K_TEST_NS") if name == "" { name = "test-" + uuid.New().String() } - c := TestClient(t) if exists, err := testNamespaceExists(t, name); err != nil { failTest(t, err) @@ -2960,6 +2960,13 @@ func NewTestNamespace(t *testing.T, injectKnativeBroker bool) ctrl.Object { name = fmt.Sprintf("%s-%d", name, time.Now().Second()) } + return NewNamedTestNamespace(t, name, injectKnativeBroker) +} + +func NewNamedTestNamespace(t *testing.T, name string, injectKnativeBroker bool) ctrl.Object { + brokerLabel := "eventing.knative.dev/injection" + c := TestClient(t) + if oc, err := openshift.IsOpenShift(TestClient(t)); err != nil { failTest(t, err) } else if oc { @@ -3058,7 +3065,7 @@ func GetOutputStringAsync(cmd *cobra.Command) func() string { } } -func CreateLogKamelet(t *testing.T, ns string, name string) func() error { +func CreateLogKamelet(t *testing.T, operatorID string, ns string, name string) func() error { flow := map[string]interface{}{ "from": map[string]interface{}{ "uri": "kamelet:source", @@ -3076,7 +3083,7 @@ func CreateLogKamelet(t *testing.T, ns string, name string) func() error { }, } - return CreateKamelet(t, ns, name, flow, props, nil) + return CreateKamelet(t, operatorID, ns, name, flow, props, nil) } func GetCIProcessID() string { diff --git a/e2e/support/test_util.go b/e2e/support/test_util.go index 59fd514de..4973a2599 100644 --- a/e2e/support/test_util.go +++ b/e2e/support/test_util.go @@ -117,3 +117,8 @@ func Cleanup(t *testing.T) { func UninstallAll(t *testing.T) error { return Kamel(t, "uninstall", "--olm=false", "--all").Execute() } + +// UninstallFromNamespace Removes operator from given namespace +func UninstallFromNamespace(t *testing.T, ns string) error { + return Kamel(t, "uninstall", "--olm=false", "-n", ns).Execute() +} diff --git a/pkg/apis/camel/v1/kamelet_types_support.go b/pkg/apis/camel/v1/kamelet_types_support.go index a95f425f1..e8818cb9e 100644 --- a/pkg/apis/camel/v1/kamelet_types_support.go +++ b/pkg/apis/camel/v1/kamelet_types_support.go @@ -214,3 +214,8 @@ func NewKameletList() KameletList { }, } } + +// SetOperatorID sets the given operator id as an annotation. +func (k *Kamelet) SetOperatorID(operatorID string) { + SetAnnotation(&k.ObjectMeta, OperatorIDAnnotation, operatorID) +} diff --git a/script/Makefile b/script/Makefile index e2e60d58f..68ed85910 100644 --- a/script/Makefile +++ b/script/Makefile @@ -250,13 +250,7 @@ test: do-build # test-common: do-build FAILED=0; STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \ - go test -timeout 10m -v ./e2e/common/setup -tags=integration $(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || FAILED=1; \ - go test -timeout 30m -v ./e2e/common/languages -tags=integration -parallel=$(TEST_COMMON_PARALLEL_COUNT) $(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || FAILED=1; \ - go test -timeout 30m -v ./e2e/common/cli -tags=integration -parallel=$(TEST_COMMON_PARALLEL_COUNT) $(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || FAILED=1; \ - go test -timeout 30m -v ./e2e/common/config -tags=integration -parallel=$(TEST_COMMON_PARALLEL_COUNT) $(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || FAILED=1; \ - go test -timeout 30m -v ./e2e/common/misc -tags=integration -parallel=$(TEST_COMMON_PARALLEL_COUNT) $(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || FAILED=1; \ - go test -timeout 60m -v ./e2e/common/traits -tags=integration -parallel=$(TEST_COMMON_PARALLEL_COUNT) $(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || FAILED=1; \ - go test -timeout 20m -v ./e2e/common/runtimes -tags=integration -parallel=$(TEST_COMMON_PARALLEL_COUNT) $(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || FAILED=1; \ + go test -timeout 90m -v ./e2e/common/... -tags=integration -parallel=$(TEST_COMMON_PARALLEL_COUNT) $(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || FAILED=1; \ exit $${FAILED} # @@ -264,7 +258,6 @@ test-common: do-build # test-smoke: do-build FAILED=0; STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \ - go test -timeout 10m -v ./e2e/common/setup -tags=integration $(TEST_COMMON_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || FAILED=1; \ go test -timeout 30m -v ./e2e/common/languages -tags=integration -parallel=$(TEST_COMMON_PARALLEL_COUNT) $(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || FAILED=1; \ go test -timeout 30m -v \ ./e2e/common/misc/default.go \ @@ -370,6 +363,7 @@ endif build-compile-integration-tests: @echo "####### Compiling integration tests..." + export CAMEL_K_E2E_JUST_COMPILE="true" ;\ go test -run nope -tags="integration" ./e2e/... clean: