This is an automated email from the ASF dual-hosted git repository. pcongiusti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 9176a3c011dad40f94d9dde01d857e952604b4d7 Author: Pasquale Congiusti <[email protected]> AuthorDate: Mon Jul 1 12:29:38 2024 +0200 chore(e2e): parallel testing with 2 threads --- e2e/advanced/build_order_strategy_test.go | 3 --- e2e/common/config/config_test.go | 31 +++++++++++++++++++++---------- script/Makefile | 11 ++++++----- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/e2e/advanced/build_order_strategy_test.go b/e2e/advanced/build_order_strategy_test.go index c25d14a4a..e20cb8454 100644 --- a/e2e/advanced/build_order_strategy_test.go +++ b/e2e/advanced/build_order_strategy_test.go @@ -49,7 +49,6 @@ func TestRunBuildOrderStrategyMatchingDependencies(t *testing.T) { } g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutShort).Should(Equal(v1.IntegrationPlatformPhaseReady)) - g.Expect(CreateTimerKamelet(t, ctx, ns, "timer-source")()).To(Succeed()) integrationA := RandomizedSuffixName("java-a") g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", integrationA).Execute()).To(Succeed()) @@ -123,8 +122,6 @@ func TestRunBuildOrderStrategyFIFO(t *testing.T) { } g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutShort).Should(Equal(v1.IntegrationPlatformPhaseReady)) - g.Expect(CreateTimerKamelet(t, ctx, ns, "timer-source")()).To(Succeed()) - integrationA := RandomizedSuffixName("java-a") g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", integrationA, diff --git a/e2e/common/config/config_test.go b/e2e/common/config/config_test.go index a74f46f69..fe3904fa7 100644 --- a/e2e/common/config/config_test.go +++ b/e2e/common/config/config_test.go @@ -34,7 +34,7 @@ import ( v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" ) -func TestRunConfigExamples(t *testing.T) { +func TestRunConfigProperties(t *testing.T) { t.Parallel() WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { @@ -119,8 +119,12 @@ func TestRunConfigExamples(t *testing.T) { g.Eventually(IntegrationLogs(t, ctx, ns, "property-secret-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-external-value")) }) - // Configmap + }) +} +func TestRunConfigConfigmaps(t *testing.T) { + t.Parallel() + WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { // Store a configmap on the cluster // kubectl create configmap my-cm --from-literal=my-configmap-key="my-configmap-content" @@ -181,15 +185,18 @@ func TestRunConfigExamples(t *testing.T) { g.Eventually(IntegrationConditionStatus(t, ctx, ns, "config-configmap-properties-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) g.Eventually(IntegrationLogs(t, ctx, ns, "config-configmap-properties-route"), TestTimeoutShort).Should(ContainSubstring("hello world")) }) + }) +} - // Secret - +func TestRunConfigSecrets(t *testing.T) { + t.Parallel() + WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { // Store a secret on the cluster // kubectl create secret generic my-sec --from-literal=my-secret-key="very top secret" var secData = make(map[string]string) secData["my-secret-key"] = "very top secret" - err = CreatePlainTextSecret(t, ctx, ns, "my-sec", secData) + err := CreatePlainTextSecret(t, ctx, ns, "my-sec", secData) g.Expect(err).To(BeNil()) // Store a secret with multi values @@ -227,8 +234,12 @@ func TestRunConfigExamples(t *testing.T) { g.Eventually(IntegrationLogs(t, ctx, ns, "config-secret-key-route"), TestTimeoutShort).Should(ContainSubstring(secDataMulti["my-secret-key-2"])) }) - // Build-Properties + }) +} +func TestRunConfigBuildProperties(t *testing.T) { + t.Parallel() + WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { t.Run("Build time property", func(t *testing.T) { g.Expect(KamelRun(t, ctx, ns, "./files/build-property-route.yaml", "--build-property", "quarkus.application.name=my-super-application").Execute()).To(Succeed()) g.Eventually(IntegrationPodPhase(t, ctx, ns, "build-property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) @@ -265,7 +276,7 @@ func TestRunConfigExamples(t *testing.T) { t.Run("Build time property from ConfigMap", func(t *testing.T) { var cmData = make(map[string]string) cmData["quarkus.application.name"] = "my-cool-application" - err = CreatePlainTextConfigmap(t, ctx, ns, "my-cm-test-build-property", cmData) + err := CreatePlainTextConfigmap(t, ctx, ns, "my-cm-test-build-property", cmData) g.Expect(err).To(BeNil()) g.Expect(KamelRun(t, ctx, ns, "./files/build-property-file-route.yaml", "--build-property", "configmap:my-cm-test-build-property").Execute()).To(Succeed()) @@ -277,7 +288,7 @@ func TestRunConfigExamples(t *testing.T) { t.Run("Build time property from ConfigMap as property file", func(t *testing.T) { var cmData = make(map[string]string) cmData["my.properties"] = "quarkus.application.name=my-super-cool-application" - err = CreatePlainTextConfigmap(t, ctx, ns, "my-cm-test-build-properties", cmData) + err := CreatePlainTextConfigmap(t, ctx, ns, "my-cm-test-build-properties", cmData) g.Expect(err).To(BeNil()) g.Expect(KamelRun(t, ctx, ns, "./files/build-property-file-route.yaml", "--name", "build-property-file-route-cm", "--build-property", "configmap:my-cm-test-build-properties").Execute()).To(Succeed()) @@ -289,7 +300,7 @@ func TestRunConfigExamples(t *testing.T) { t.Run("Build time property from Secret", func(t *testing.T) { var secData = make(map[string]string) secData["quarkus.application.name"] = "my-great-application" - err = CreatePlainTextSecret(t, ctx, ns, "my-sec-test-build-property", secData) + err := CreatePlainTextSecret(t, ctx, ns, "my-sec-test-build-property", secData) g.Expect(err).To(BeNil()) g.Expect(KamelRun(t, ctx, ns, "./files/build-property-file-route.yaml", "--build-property", "secret:my-sec-test-build-property").Execute()).To(Succeed()) @@ -301,7 +312,7 @@ func TestRunConfigExamples(t *testing.T) { t.Run("Build time property from Secret as property file", func(t *testing.T) { var secData = make(map[string]string) secData["my.properties"] = "quarkus.application.name=my-awesome-application" - err = CreatePlainTextSecret(t, ctx, ns, "my-sec-test-build-properties", secData) + err := CreatePlainTextSecret(t, ctx, ns, "my-sec-test-build-properties", secData) g.Expect(err).To(BeNil()) g.Expect(KamelRun(t, ctx, ns, "./files/build-property-file-route.yaml", "--name", "build-property-file-route-secret", "--build-property", "secret:my-sec-test-build-properties").Execute()).To(Succeed()) diff --git a/script/Makefile b/script/Makefile index 91e37d4db..a4f5e2360 100644 --- a/script/Makefile +++ b/script/Makefile @@ -104,9 +104,10 @@ KAMELET_CATALOG_REPO_TAG := v4.0.1 # and those rules with a dependency on the build rule will no longer call it (see do-build) DO_TEST_PREBUILD ?= true TEST_PREBUILD = build -# Tests may run in parallel to each other. This count sets the amount of tests run in parallel. (default value usually is GOMAXPROCS) -TEST_COMMON_PARALLEL_COUNT ?= 1 -TEST_ADVANCED_PARALLEL_COUNT ?= 1 +# Tests may run in parallel to each other. This count sets the amount of tests run in parallel. +# (default value would be otherwise GOMAXPROCS) +TEST_COMMON_PARALLEL_COUNT ?= 2 +TEST_ADVANCED_PARALLEL_COUNT ?= 2 # OLM (Operator Lifecycle Manager and Operator Hub): uncomment to override operator settings at build time #GOLDFLAGS += -X github.com/apache/camel-k/v2/pkg/util/olm.DefaultOperatorName=camel-k-operator @@ -278,7 +279,7 @@ setup-knative: # test-common: FAILED=0; STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \ - go test -p $(TEST_COMMON_PARALLEL_COUNT) -timeout 90m -v ./e2e/common/... --parallel $(TEST_COMMON_PARALLEL_COUNT) -tags=integration $(GOTESTFMT) || ((FAILED++)); \ + go test -p $(TEST_COMMON_PARALLEL_COUNT) -timeout 90m -v ./e2e/common/... --parallel 1 -tags=integration $(GOTESTFMT) || ((FAILED++)); \ exit $${FAILED} # @@ -298,7 +299,7 @@ test-smoke: # test-advanced: FAILED=0; STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \ - go test -p=$(TEST_ADVANCED_PARALLEL_COUNT) -timeout 90m -v ./e2e/advanced --parallel $(TEST_ADVANCED_PARALLEL_COUNT) -tags=integration $(GOTESTFMT) || ((FAILED++)); \ + go test -p=$(TEST_ADVANCED_PARALLEL_COUNT) -timeout 90m -v ./e2e/advanced --parallel 1 -tags=integration $(GOTESTFMT) || ((FAILED++)); \ exit $${FAILED} #
