You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cd...@apache.org on 2024/03/13 18:11:15 UTC
(camel-k) 02/06: chore(e2e): Use new context instance for each E2E test
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 1e255ff7f10ed24c41a151d3ded8a362f9b566d5
Author: Christoph Deppisch <cd...@redhat.com>
AuthorDate: Mon Mar 11 19:47:45 2024 +0100
chore(e2e): Use new context instance for each E2E test
---
.github/workflows/common.yml | 2 +-
e2e/advanced/build_order_strategy_test.go | 190 +++---
e2e/advanced/builder_test.go | 49 +-
e2e/advanced/catalog_builder_test.go | 97 ++-
e2e/advanced/debug_test.go | 50 +-
e2e/advanced/deployment_test.go | 19 +-
e2e/advanced/dump_test.go | 21 +-
e2e/advanced/environment_test.go | 62 +-
e2e/advanced/incremental_build_test.go | 238 +++----
e2e/advanced/integration_profile_test.go | 111 ++--
e2e/advanced/kamelet_repo_test.go | 37 +-
e2e/advanced/local_platform_test.go | 39 +-
e2e/advanced/main_test.go | 30 +-
e2e/advanced/maven_http_proxy_test.go | 61 +-
e2e/advanced/operator_id_filtering_test.go | 105 ++--
e2e/advanced/operator_metrics_test.go | 35 +-
e2e/advanced/platform_traits_test.go | 35 +-
e2e/advanced/promote_test.go | 137 ++---
e2e/advanced/reset_test.go | 63 +-
e2e/advanced/synthetic_test.go | 59 +-
e2e/advanced/tekton_test.go | 15 +-
e2e/builder/build_test.go | 161 ++---
e2e/builder/registry_test.go | 47 +-
e2e/common/cli/bind_test.go | 29 +-
e2e/common/cli/config_test.go | 21 +-
e2e/common/cli/delete_test.go | 61 +-
e2e/common/cli/describe_test.go | 20 +-
e2e/common/cli/dev_mode_test.go | 22 +-
e2e/common/cli/duplicate_parameters_test.go | 2 +-
e2e/common/cli/get_test.go | 49 +-
e2e/common/cli/help_test.go | 8 +-
e2e/common/cli/log_test.go | 22 +-
e2e/common/cli/main_test.go | 14 +-
e2e/common/cli/offline_commands_test.go | 12 +-
e2e/common/cli/run_test.go | 153 ++---
e2e/common/cli/version_test.go | 4 +-
e2e/common/config/config_reload_test.go | 153 +++--
e2e/common/config/config_test.go | 290 +++++----
e2e/common/config/kamelet_config_test.go | 275 ++++-----
e2e/common/config/pipe_config_test.go | 125 ++--
e2e/common/languages/groovy_test.go | 21 +-
e2e/common/languages/java_test.go | 21 +-
e2e/common/languages/js_test.go | 21 +-
e2e/common/languages/kotlin_test.go | 21 +-
e2e/common/languages/polyglot_test.go | 23 +-
e2e/common/languages/xml_test.go | 21 +-
e2e/common/languages/yaml_test.go | 21 +-
e2e/common/main_test.go | 18 +-
e2e/common/misc/client_test.go | 14 +-
e2e/common/misc/cron_test.go | 53 +-
e2e/common/misc/integration_fail_test.go | 144 ++---
e2e/common/misc/integration_trait_update_test.go | 23 +-
e2e/common/misc/kamelet_test.go | 30 +-
e2e/common/misc/kamelet_update_test.go | 29 +-
e2e/common/misc/maven_repository_test.go | 27 +-
e2e/common/misc/pipe_test.go | 70 +--
e2e/common/misc/pipe_with_image_test.go | 57 +-
e2e/common/misc/registry_maven_wagon_test.go | 82 ++-
e2e/common/misc/rest_test.go | 33 +-
e2e/common/misc/scale_binding_test.go | 63 +-
e2e/common/misc/scale_integration_test.go | 79 +--
e2e/common/misc/structured_logs_test.go | 29 +-
e2e/common/runtimes/runtimes_test.go | 51 +-
e2e/common/traits/affinity_test.go | 72 +--
e2e/common/traits/builder_test.go | 253 ++++----
e2e/common/traits/camel_test.go | 48 +-
e2e/common/traits/container_test.go | 51 +-
e2e/common/traits/deployment_test.go | 52 +-
e2e/common/traits/error_handler_test.go | 27 +-
e2e/common/traits/errored_trait_test.go | 41 +-
e2e/common/traits/health_test.go | 184 +++---
e2e/common/traits/istio_test.go | 31 +-
e2e/common/traits/jolokia_test.go | 36 +-
e2e/common/traits/jvm_test.go | 30 +-
e2e/common/traits/kamelet_test.go | 29 +-
e2e/common/traits/master_test.go | 50 +-
e2e/common/traits/openapi_test.go | 31 +-
e2e/common/traits/pdb_test.go | 67 +-
e2e/common/traits/pod_test.go | 32 +-
e2e/common/traits/prometheus_test.go | 37 +-
e2e/common/traits/pull_secret_test.go | 46 +-
e2e/common/traits/route_test.go | 104 ++--
e2e/common/traits/service_binding_test.go | 40 +-
e2e/common/traits/service_test.go | 63 +-
e2e/common/traits/toleration_test.go | 73 +--
e2e/install/cli/global_kamelet_test.go | 39 +-
e2e/install/cli/global_test.go | 135 ++--
e2e/install/cli/install_test.go | 89 +--
e2e/install/cli/maven_ca_secret_test.go | 47 +-
e2e/install/cli/uninstall_test.go | 103 ++--
e2e/install/helm/setup_test.go | 15 +-
e2e/install/kustomize/operator_test.go | 43 +-
e2e/install/kustomize/setup_test.go | 26 +-
e2e/install/kustomize/uninstall_test.go | 39 +-
e2e/install/olm/olm_install_test.go | 31 +-
e2e/install/upgrade/cli_upgrade_test.go | 68 +-
e2e/install/upgrade/helm_upgrade_test.go | 32 +-
e2e/install/upgrade/olm_upgrade_test.go | 108 ++--
e2e/knative/kamelet_test.go | 50 +-
e2e/knative/knative_platform_test.go | 39 +-
e2e/knative/knative_test.go | 149 ++---
e2e/knative/openapi_test.go | 20 +-
e2e/knative/pod_test.go | 19 +-
e2e/native/native_binding_test.go | 35 +-
e2e/native/native_test.go | 101 ++-
e2e/native/native_with_sources_test.go | 85 +--
e2e/support/csv.go | 37 +-
e2e/support/test_nexus_hooks.go | 3 +-
e2e/support/test_support.go | 751 +++++++++++------------
e2e/support/test_util.go | 15 +-
e2e/telemetry/telemetry_test.go | 37 +-
111 files changed, 3536 insertions(+), 3851 deletions(-)
diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml
index fde4cafa0..31dacc8f8 100644
--- a/.github/workflows/common.yml
+++ b/.github/workflows/common.yml
@@ -90,7 +90,7 @@ jobs:
-p "${{ github.event.inputs.skip-problematic }}" \
-q "${{ github.event.inputs.log-level }}" \
-t "${{ github.event.inputs.test-filters }}"
- - name: Smoke tests
+ - name: Common tests
uses: ./.github/actions/e2e-common
with:
cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
diff --git a/e2e/advanced/build_order_strategy_test.go b/e2e/advanced/build_order_strategy_test.go
index 42ebe538b..666b774c7 100644
--- a/e2e/advanced/build_order_strategy_test.go
+++ b/e2e/advanced/build_order_strategy_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -37,80 +38,67 @@ import (
func TestRunBuildOrderStrategyMatchingDependencies(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-build-order-deps"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns,
- "--max-running-pipelines", "4",
- "--build-order-strategy", string(v1.BuildOrderStrategyDependencies))).To(Succeed())
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--max-running-pipelines", "4", "--build-order-strategy", string(v1.BuildOrderStrategyDependencies))).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "timer-source")()).To(Succeed())
integrationA := RandomizedSuffixName("java-a")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", integrationA,
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", integrationA).Execute()).To(Succeed())
- g.Eventually(IntegrationKit(t, ns, integrationA), TestTimeoutMedium).ShouldNot(BeEmpty())
- integrationKitNameA := IntegrationKit(t, ns, integrationA)()
- g.Eventually(Build(t, ns, integrationKitNameA), TestTimeoutMedium).ShouldNot(BeNil())
+ g.Eventually(IntegrationKit(t, ctx, ns, integrationA), TestTimeoutMedium).ShouldNot(BeEmpty())
+ integrationKitNameA := IntegrationKit(t, ctx, ns, integrationA)()
+ g.Eventually(Build(t, ctx, ns, integrationKitNameA), TestTimeoutMedium).ShouldNot(BeNil())
integrationB := RandomizedSuffixName("java-b")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", integrationB,
- "-d", "camel:cron",
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", integrationB, "-d", "camel:cron").Execute()).To(Succeed())
integrationC := RandomizedSuffixName("java-c")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", integrationC,
- "-d", "camel:cron",
- "-d", "camel:zipfile",
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", integrationC, "-d", "camel:cron", "-d", "camel:zipfile").Execute()).To(Succeed())
integrationZ := RandomizedSuffixName("groovy-z")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/timer-source.groovy",
- "--name", integrationZ,
- ).Execute()).To(Succeed())
-
- g.Eventually(IntegrationKit(t, ns, integrationB), TestTimeoutMedium).ShouldNot(BeEmpty())
- g.Eventually(IntegrationKit(t, ns, integrationC), TestTimeoutMedium).ShouldNot(BeEmpty())
- g.Eventually(IntegrationKit(t, ns, integrationZ), TestTimeoutMedium).ShouldNot(BeEmpty())
-
- integrationKitNameB := IntegrationKit(t, ns, integrationB)()
- integrationKitNameC := IntegrationKit(t, ns, integrationC)()
- integrationKitNameZ := IntegrationKit(t, ns, integrationZ)()
-
- g.Eventually(BuildPhase(t, ns, integrationKitNameA), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(IntegrationPodPhase(t, ns, integrationA), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, integrationA, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, integrationA), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(Kit(t, ns, integrationKitNameA)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
-
- g.Eventually(BuildPhase(t, ns, integrationKitNameB), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(IntegrationPodPhase(t, ns, integrationB), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, integrationB, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, integrationB), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(Kit(t, ns, integrationKitNameB)().Status.BaseImage).Should(ContainSubstring(integrationKitNameA))
-
- g.Eventually(BuildPhase(t, ns, integrationKitNameC), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(IntegrationPodPhase(t, ns, integrationC), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, integrationC, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, integrationC), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(Kit(t, ns, integrationKitNameC)().Status.BaseImage).Should(ContainSubstring(integrationKitNameB))
-
- g.Eventually(BuildPhase(t, ns, integrationKitNameZ), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(IntegrationPodPhase(t, ns, integrationZ), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, integrationZ, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, integrationZ), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(Kit(t, ns, integrationKitNameZ)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
-
- buildA := Build(t, ns, integrationKitNameA)()
- buildB := Build(t, ns, integrationKitNameB)()
- buildC := Build(t, ns, integrationKitNameC)()
- buildZ := Build(t, ns, integrationKitNameZ)()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-source.groovy", "--name", integrationZ).Execute()).To(Succeed())
+
+ g.Eventually(IntegrationKit(t, ctx, ns, integrationB), TestTimeoutMedium).ShouldNot(BeEmpty())
+ g.Eventually(IntegrationKit(t, ctx, ns, integrationC), TestTimeoutMedium).ShouldNot(BeEmpty())
+ g.Eventually(IntegrationKit(t, ctx, ns, integrationZ), TestTimeoutMedium).ShouldNot(BeEmpty())
+
+ integrationKitNameB := IntegrationKit(t, ctx, ns, integrationB)()
+ integrationKitNameC := IntegrationKit(t, ctx, ns, integrationC)()
+ integrationKitNameZ := IntegrationKit(t, ctx, ns, integrationZ)()
+
+ g.Eventually(BuildPhase(t, ctx, ns, integrationKitNameA), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationA), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, integrationA, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, integrationA), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(Kit(t, ctx, ns, integrationKitNameA)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
+
+ g.Eventually(BuildPhase(t, ctx, ns, integrationKitNameB), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationB), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, integrationB, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, integrationB), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(Kit(t, ctx, ns, integrationKitNameB)().Status.BaseImage).Should(ContainSubstring(integrationKitNameA))
+
+ g.Eventually(BuildPhase(t, ctx, ns, integrationKitNameC), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationC), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, integrationC, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, integrationC), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(Kit(t, ctx, ns, integrationKitNameC)().Status.BaseImage).Should(ContainSubstring(integrationKitNameB))
+
+ g.Eventually(BuildPhase(t, ctx, ns, integrationKitNameZ), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationZ), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, integrationZ, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, integrationZ), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(Kit(t, ctx, ns, integrationKitNameZ)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
+
+ buildA := Build(t, ctx, ns, integrationKitNameA)()
+ buildB := Build(t, ctx, ns, integrationKitNameB)()
+ buildC := Build(t, ctx, ns, integrationKitNameC)()
+ buildZ := Build(t, ctx, ns, integrationKitNameZ)()
g.Expect(buildA.Status.StartedAt.Before(buildB.Status.StartedAt)).Should(BeTrue())
g.Expect(buildA.Status.StartedAt.Before(buildC.Status.StartedAt)).Should(BeTrue())
@@ -118,66 +106,66 @@ func TestRunBuildOrderStrategyMatchingDependencies(t *testing.T) {
g.Expect(buildZ.Status.StartedAt.Before(buildB.Status.StartedAt)).Should(BeTrue())
g.Expect(buildZ.Status.StartedAt.Before(buildC.Status.StartedAt)).Should(BeTrue())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
/*
func TestRunBuildOrderStrategyFIFO(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {x
operatorID := "camel-k-build-order-fifo"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns, "--build-order-strategy", string(v1.BuildOrderStrategyFIFO)).Execute()).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--build-order-strategy", string(v1.BuildOrderStrategyFIFO)).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, ctx, ns, "timer-source")()).To(Succeed())
integrationA := RandomizedSuffixName("java-a")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java",
"--name", integrationA,
).Execute()).To(Succeed())
- g.Eventually(IntegrationPhase(t, ns, integrationA)).Should(Equal(v1.IntegrationPhaseBuildingKit))
+ g.Eventually(IntegrationPhase(t, ctx, ns, integrationA)).Should(Equal(v1.IntegrationPhaseBuildingKit))
integrationB := RandomizedSuffixName("java-b")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java",
"--name", integrationB,
"-d", "camel:joor",
).Execute()).To(Succeed())
integrationZ := RandomizedSuffixName("groovy-z")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/timer-source.groovy",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-source.groovy",
"--name", integrationZ,
).Execute()).To(Succeed())
- integrationKitNameA := IntegrationKit(t, ns, integrationA)()
- g.Eventually(BuildPhase(t, ns, integrationKitNameA), TestTimeoutShort).Should(Equal(v1.BuildPhaseRunning))
-
- g.Eventually(IntegrationPhase(t, ns, integrationB)).Should(Equal(v1.IntegrationPhaseBuildingKit))
- integrationKitNameB := IntegrationKit(t, ns, integrationB)()
- g.Eventually(BuildPhase(t, ns, integrationKitNameB), TestTimeoutShort).Should(Equal(v1.BuildPhaseRunning))
-
- g.Eventually(IntegrationPhase(t, ns, integrationZ)).Should(Equal(v1.IntegrationPhaseBuildingKit))
- integrationKitNameZ := IntegrationKit(t, ns, integrationZ)()
- g.Eventually(BuildPhase(t, ns, integrationKitNameZ), TestTimeoutShort).Should(Equal(v1.BuildPhaseRunning))
-
- g.Eventually(BuildPhase(t, ns, integrationKitNameA), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(IntegrationPodPhase(t, ns, integrationA), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, integrationA, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, integrationA), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(Kit(t, ns, integrationKitNameA)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
-
- g.Eventually(BuildPhase(t, ns, integrationKitNameB), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(IntegrationPodPhase(t, ns, integrationB), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, integrationB, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, integrationB), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(Kit(t, ns, integrationKitNameB)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
-
- g.Eventually(BuildPhase(t, ns, integrationKitNameZ), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(IntegrationPodPhase(t, ns, integrationZ), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, integrationZ, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, integrationZ), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(Kit(t, ns, integrationKitNameZ)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
+ integrationKitNameA := IntegrationKit(t, ctx, ns, integrationA)()
+ g.Eventually(BuildPhase(t, ctx, ns, integrationKitNameA), TestTimeoutShort).Should(Equal(v1.BuildPhaseRunning))
+
+ g.Eventually(IntegrationPhase(t, ctx, ns, integrationB)).Should(Equal(v1.IntegrationPhaseBuildingKit))
+ integrationKitNameB := IntegrationKit(t, ctx, ns, integrationB)()
+ g.Eventually(BuildPhase(t, ctx, ns, integrationKitNameB), TestTimeoutShort).Should(Equal(v1.BuildPhaseRunning))
+
+ g.Eventually(IntegrationPhase(t, ctx, ns, integrationZ)).Should(Equal(v1.IntegrationPhaseBuildingKit))
+ integrationKitNameZ := IntegrationKit(t, ctx, ns, integrationZ)()
+ g.Eventually(BuildPhase(t, ctx, ns, integrationKitNameZ), TestTimeoutShort).Should(Equal(v1.BuildPhaseRunning))
+
+ g.Eventually(BuildPhase(t, ctx, ns, integrationKitNameA), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationA), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, integrationA, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, integrationA), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(Kit(t, ctx, ns, integrationKitNameA)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
+
+ g.Eventually(BuildPhase(t, ctx, ns, integrationKitNameB), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationB), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, integrationB, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, integrationB), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(Kit(t, ctx, ns, integrationKitNameB)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
+
+ g.Eventually(BuildPhase(t, ctx, ns, integrationKitNameZ), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationZ), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, integrationZ, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, integrationZ), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(Kit(t, ctx, ns, integrationKitNameZ)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
diff --git a/e2e/advanced/builder_test.go b/e2e/advanced/builder_test.go
index d18100be6..c5a0919ac 100644
--- a/e2e/advanced/builder_test.go
+++ b/e2e/advanced/builder_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"fmt"
"testing"
"time"
@@ -38,50 +39,48 @@ import (
func TestBuilderTimeout(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, 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)).To(Succeed())
- g.Eventually(OperatorPod(t, ns)).ShouldNot(BeNil())
- g.Eventually(Platform(t, ns)).ShouldNot(BeNil())
- g.Eventually(PlatformConditionStatus(t, ns, v1.IntegrationPlatformConditionTypeCreated), TestTimeoutShort).
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
+ g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
+ g.Eventually(Platform(t, ctx, ns)).ShouldNot(BeNil())
+ g.Eventually(PlatformConditionStatus(t, ctx, ns, v1.IntegrationPlatformConditionTypeCreated), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- pl := Platform(t, ns)()
+ pl := Platform(t, ctx, ns)()
// set a short timeout to simulate the build timeout
pl.Spec.Build.Timeout = &metav1.Duration{
Duration: 10 * time.Second,
}
- TestClient(t).Update(TestContext, pl)
- g.Eventually(Platform(t, ns)).ShouldNot(BeNil())
- g.Eventually(PlatformTimeout(t, ns)).Should(Equal(
+ TestClient(t).Update(ctx, pl)
+ g.Eventually(Platform(t, ctx, ns)).ShouldNot(BeNil())
+ g.Eventually(PlatformTimeout(t, ctx, ns)).Should(Equal(
&metav1.Duration{
Duration: 10 * time.Second,
},
))
- operatorPod := OperatorPod(t, ns)()
+ operatorPod := OperatorPod(t, ctx, ns)()
operatorPodImage := operatorPod.Spec.Containers[0].Image
t.Run("run yaml", func(t *testing.T) {
name := RandomizedSuffixName("yaml")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml",
- "--name", name,
- "-t", "builder.strategy=pod").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml", "--name", name, "-t", "builder.strategy=pod").Execute()).To(Succeed())
// As the build hits timeout, it keeps trying building
- g.Eventually(IntegrationPhase(t, ns, name)).Should(Equal(v1.IntegrationPhaseBuildingKit))
- integrationKitName := IntegrationKit(t, ns, name)()
+ g.Eventually(IntegrationPhase(t, ctx, ns, name)).Should(Equal(v1.IntegrationPhaseBuildingKit))
+ integrationKitName := IntegrationKit(t, ctx, ns, name)()
builderKitName := fmt.Sprintf("camel-k-%s-builder", integrationKitName)
- g.Eventually(BuilderPodPhase(t, ns, builderKitName)).Should(Equal(corev1.PodPending))
- g.Eventually(BuildPhase(t, ns, integrationKitName)).Should(Equal(v1.BuildPhaseRunning))
- g.Eventually(BuilderPod(t, ns, builderKitName)().Spec.InitContainers[0].Name).Should(Equal("builder"))
- g.Eventually(BuilderPod(t, ns, builderKitName)().Spec.InitContainers[0].Image).Should(Equal(operatorPodImage))
+ g.Eventually(BuilderPodPhase(t, ctx, ns, builderKitName)).Should(Equal(corev1.PodPending))
+ g.Eventually(BuildPhase(t, ctx, ns, integrationKitName)).Should(Equal(v1.BuildPhaseRunning))
+ g.Eventually(BuilderPod(t, ctx, ns, builderKitName)().Spec.InitContainers[0].Name).Should(Equal("builder"))
+ g.Eventually(BuilderPod(t, ctx, ns, builderKitName)().Spec.InitContainers[0].Image).Should(Equal(operatorPodImage))
// After a few minutes (5 max retries), this has to be in error state
- g.Eventually(BuildPhase(t, ns, integrationKitName), TestTimeoutMedium).Should(Equal(v1.BuildPhaseError))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseError))
- g.Eventually(BuildFailureRecovery(t, ns, integrationKitName), TestTimeoutMedium).Should(Equal(5))
- g.Eventually(BuilderPodPhase(t, ns, builderKitName), TestTimeoutMedium).Should(Equal(corev1.PodFailed))
+ g.Eventually(BuildPhase(t, ctx, ns, integrationKitName), TestTimeoutMedium).Should(Equal(v1.BuildPhaseError))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(BuildFailureRecovery(t, ctx, ns, integrationKitName), TestTimeoutMedium).Should(Equal(5))
+ g.Eventually(BuilderPodPhase(t, ctx, ns, builderKitName), TestTimeoutMedium).Should(Equal(corev1.PodFailed))
})
})
}
diff --git a/e2e/advanced/catalog_builder_test.go b/e2e/advanced/catalog_builder_test.go
index cd8faa52b..7b85e0ef5 100644
--- a/e2e/advanced/catalog_builder_test.go
+++ b/e2e/advanced/catalog_builder_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"fmt"
"strings"
"testing"
@@ -38,18 +39,18 @@ import (
func TestCamelCatalogBuilder(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, 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)).To(Succeed())
- g.Eventually(OperatorPod(t, ns)).ShouldNot(BeNil())
- g.Eventually(Platform(t, ns)).ShouldNot(BeNil())
- g.Eventually(PlatformConditionStatus(t, ns, v1.IntegrationPlatformConditionTypeCreated), TestTimeoutShort).
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
+ g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
+ g.Eventually(Platform(t, ctx, ns)).ShouldNot(BeNil())
+ g.Eventually(PlatformConditionStatus(t, ctx, ns, v1.IntegrationPlatformConditionTypeCreated), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
catalogName := fmt.Sprintf("camel-catalog-%s", strings.ToLower(defaults.DefaultRuntimeVersion))
- g.Eventually(CamelCatalog(t, ns, catalogName)).ShouldNot(BeNil())
- g.Eventually(CamelCatalogPhase(t, ns, catalogName), TestTimeoutMedium).Should(Equal(v1.CamelCatalogPhaseReady))
+ g.Eventually(CamelCatalog(t, ctx, ns, catalogName)).ShouldNot(BeNil())
+ g.Eventually(CamelCatalogPhase(t, ctx, ns, catalogName), TestTimeoutMedium).Should(Equal(v1.CamelCatalogPhaseReady))
// Run an integration with a catalog not compatible
// The operator should create the catalog, but fail on reconciliation as it is not compatible
@@ -58,23 +59,21 @@ func TestCamelCatalogBuilder(t *testing.T) {
name := RandomizedSuffixName("java-1-15")
nonCompatibleCatalogName := "camel-catalog-1.15.0"
g.Expect(
- KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
- "-t", "camel.runtime-version=1.15.0",
- ).Execute()).To(Succeed())
+ KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "camel.runtime-version=1.15.0").Execute()).To(Succeed())
- g.Eventually(CamelCatalog(t, ns, nonCompatibleCatalogName)).ShouldNot(BeNil())
- g.Eventually(CamelCatalogPhase(t, ns, nonCompatibleCatalogName)).Should(Equal(v1.CamelCatalogPhaseError))
- g.Eventually(CamelCatalogCondition(t, ns, nonCompatibleCatalogName, v1.CamelCatalogConditionReady)().Message).Should(ContainSubstring("Container image tool missing in catalog"))
+ g.Eventually(CamelCatalog(t, ctx, ns, nonCompatibleCatalogName)).ShouldNot(BeNil())
+ g.Eventually(CamelCatalogPhase(t, ctx, ns, nonCompatibleCatalogName)).Should(Equal(v1.CamelCatalogPhaseError))
+ g.Eventually(CamelCatalogCondition(t, ctx, ns, nonCompatibleCatalogName, v1.CamelCatalogConditionReady)().Message).Should(ContainSubstring("Container image tool missing in catalog"))
- g.Eventually(IntegrationKit(t, ns, name)).ShouldNot(Equal(""))
- kitName := IntegrationKit(t, ns, name)()
- g.Eventually(KitPhase(t, ns, kitName)).Should(Equal(v1.IntegrationKitPhaseError))
- g.Eventually(KitCondition(t, ns, kitName, v1.IntegrationKitConditionCatalogAvailable)().Reason).Should(Equal("Camel Catalog 1.15.0 error"))
- g.Eventually(IntegrationPhase(t, ns, name)).Should(Equal(v1.IntegrationPhaseError))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionKitAvailable)().Status).Should(Equal(corev1.ConditionFalse))
+ g.Eventually(IntegrationKit(t, ctx, ns, name)).ShouldNot(Equal(""))
+ kitName := IntegrationKit(t, ctx, ns, name)()
+ g.Eventually(KitPhase(t, ctx, ns, kitName)).Should(Equal(v1.IntegrationKitPhaseError))
+ g.Eventually(KitCondition(t, ctx, ns, kitName, v1.IntegrationKitConditionCatalogAvailable)().Reason).Should(Equal("Camel Catalog 1.15.0 error"))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name)).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionKitAvailable)().Status).Should(Equal(corev1.ConditionFalse))
// Clean up
- g.Eventually(DeleteIntegrations(t, ns)).Should(Equal(0))
+ g.Eventually(DeleteIntegrations(t, ctx, ns)).Should(Equal(0))
})
// Run an integration with a compatible catalog
@@ -85,24 +84,22 @@ func TestCamelCatalogBuilder(t *testing.T) {
compatibleCatalogName := "camel-catalog-" + strings.ToLower(compatibleVersion)
// First of all we delete the catalog, if by any chance it was created previously
- g.Expect(DeleteCamelCatalog(t, ns, compatibleCatalogName)()).Should(BeTrue())
- g.Eventually(CamelCatalog(t, ns, compatibleCatalogName)).Should(BeNil())
+ g.Expect(DeleteCamelCatalog(t, ctx, ns, compatibleCatalogName)()).Should(BeTrue())
+ g.Eventually(CamelCatalog(t, ctx, ns, compatibleCatalogName)).Should(BeNil())
g.Expect(
- KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
- "-t", "camel.runtime-version="+compatibleVersion,
- ).Execute()).To(Succeed())
-
- g.Eventually(CamelCatalog(t, ns, compatibleCatalogName)).ShouldNot(BeNil())
- g.Eventually(CamelCatalogPhase(t, ns, compatibleCatalogName)).Should(Equal(v1.CamelCatalogPhaseReady))
- g.Eventually(CamelCatalogCondition(t, ns, compatibleCatalogName, v1.CamelCatalogConditionReady)().Message).Should(Equal("Container image tool found in catalog"))
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).
+ KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "camel.runtime-version="+compatibleVersion).Execute()).To(Succeed())
+
+ g.Eventually(CamelCatalog(t, ctx, ns, compatibleCatalogName)).ShouldNot(BeNil())
+ g.Eventually(CamelCatalogPhase(t, ctx, ns, compatibleCatalogName)).Should(Equal(v1.CamelCatalogPhaseReady))
+ g.Eventually(CamelCatalogCondition(t, ctx, ns, compatibleCatalogName, v1.CamelCatalogConditionReady)().Message).Should(Equal("Container image tool found in catalog"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutMedium).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutMedium).Should(ContainSubstring("Magicstring!"))
// Clean up
- g.Eventually(DeleteIntegrations(t, ns)).Should(Equal(0))
+ g.Eventually(DeleteIntegrations(t, ctx, ns)).Should(Equal(0))
})
t.Run("Run catalog container exists", func(t *testing.T) {
@@ -111,32 +108,30 @@ func TestCamelCatalogBuilder(t *testing.T) {
compatibleCatalogName := "camel-catalog-" + strings.ToLower(compatibleVersion)
// First of all we delete the catalog, if by any chance it was created previously
- g.Expect(DeleteCamelCatalog(t, ns, compatibleCatalogName)()).Should(BeTrue())
- g.Eventually(CamelCatalog(t, ns, compatibleCatalogName)).Should(BeNil())
+ g.Expect(DeleteCamelCatalog(t, ctx, ns, compatibleCatalogName)()).Should(BeTrue())
+ g.Eventually(CamelCatalog(t, ctx, ns, compatibleCatalogName)).Should(BeNil())
g.Expect(
- KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
- "-t", "camel.runtime-version="+compatibleVersion,
- ).Execute()).To(Succeed())
+ KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "camel.runtime-version="+compatibleVersion).Execute()).To(Succeed())
- g.Eventually(CamelCatalog(t, ns, compatibleCatalogName)).ShouldNot(BeNil())
- g.Eventually(CamelCatalogPhase(t, ns, compatibleCatalogName)).Should(Equal(v1.CamelCatalogPhaseReady))
- g.Eventually(CamelCatalogCondition(t, ns, compatibleCatalogName, v1.CamelCatalogConditionReady)().Message).Should(
+ g.Eventually(CamelCatalog(t, ctx, ns, compatibleCatalogName)).ShouldNot(BeNil())
+ g.Eventually(CamelCatalogPhase(t, ctx, ns, compatibleCatalogName)).Should(Equal(v1.CamelCatalogPhaseReady))
+ g.Eventually(CamelCatalogCondition(t, ctx, ns, compatibleCatalogName, v1.CamelCatalogConditionReady)().Message).Should(
Equal("Container image tool found in catalog"),
)
- g.Eventually(IntegrationKit(t, ns, name)).ShouldNot(Equal(""))
- kitName := IntegrationKit(t, ns, name)()
- g.Eventually(KitPhase(t, ns, kitName)).Should(Equal(v1.IntegrationKitPhaseReady))
- g.Eventually(IntegrationPodPhase(t, ns, name)).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Eventually(IntegrationKit(t, ctx, ns, name)).ShouldNot(Equal(""))
+ kitName := IntegrationKit(t, ctx, ns, name)()
+ g.Eventually(KitPhase(t, ctx, ns, kitName)).Should(Equal(v1.IntegrationKitPhaseReady))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// Clean up
- g.Eventually(DeleteIntegrations(t, ns)).Should(Equal(0))
+ g.Eventually(DeleteIntegrations(t, ctx, ns)).Should(Equal(0))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/advanced/debug_test.go b/e2e/advanced/debug_test.go
index 1bee4ba18..6806e57d5 100644
--- a/e2e/advanced/debug_test.go
+++ b/e2e/advanced/debug_test.go
@@ -39,68 +39,68 @@ import (
func TestKamelCLIDebug(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, 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)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("debug local default port check", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
g.Expect(portIsInUse("127.0.0.1", "5005")()).To(BeFalse())
- debugTestContext, cancel := context.WithCancel(TestContext)
+ debugTestContext, cancel := context.WithCancel(ctx)
defer cancelAndWait(cancel)
go KamelWithContext(t, debugTestContext, "debug", "yaml", "-n", ns).ExecuteContext(debugTestContext)
g.Eventually(portIsInUse("127.0.0.1", "5005"), TestTimeoutMedium, 5*time.Second).Should(BeTrue())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("debug local port check", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
g.Expect(portIsInUse("127.0.0.1", "5006")()).To(BeFalse())
- debugTestContext, cancel := context.WithCancel(TestContext)
+ debugTestContext, cancel := context.WithCancel(ctx)
defer cancelAndWait(cancel)
go KamelWithContext(t, debugTestContext, "debug", "yaml", "--port", "5006", "-n", ns).ExecuteContext(debugTestContext)
g.Eventually(portIsInUse("127.0.0.1", "5006"), TestTimeoutMedium, 5*time.Second).Should(BeTrue())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("debug logs check", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- debugTestContext, cancel := context.WithCancel(TestContext)
+ debugTestContext, cancel := context.WithCancel(ctx)
defer cancelAndWait(cancel)
go KamelWithContext(t, debugTestContext, "debug", "yaml", "-n", ns).ExecuteContext(debugTestContext)
- g.Eventually(IntegrationLogs(t, ns, "yaml"), TestTimeoutMedium).Should(ContainSubstring("Listening for transport dt_socket at address: 5005"))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Eventually(IntegrationLogs(t, ctx, ns, "yaml"), TestTimeoutMedium).Should(ContainSubstring("Listening for transport dt_socket at address: 5005"))
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Pod config test", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- debugTestContext, cancel := context.WithCancel(TestContext)
+ debugTestContext, cancel := context.WithCancel(ctx)
defer cancelAndWait(cancel)
go KamelWithContext(t, debugTestContext, "debug", "yaml", "-n", ns).ExecuteContext(debugTestContext)
g.Eventually(func() string {
- return IntegrationPod(t, ns, "yaml")().Spec.Containers[0].Args[0]
+ return IntegrationPod(t, ctx, ns, "yaml")().Spec.Containers[0].Args[0]
}).Should(ContainSubstring("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005"))
- g.Expect(IntegrationPod(t, ns, "yaml")().GetLabels()["camel.apache.org/debug"]).To(Not(BeNil()))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(IntegrationPod(t, ctx, ns, "yaml")().GetLabels()["camel.apache.org/debug"]).To(Not(BeNil()))
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/advanced/deployment_test.go b/e2e/advanced/deployment_test.go
index 3d58c6eb7..ba3b93192 100644
--- a/e2e/advanced/deployment_test.go
+++ b/e2e/advanced/deployment_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,12 +37,12 @@ import (
func TestDeploymentFailureShouldReportIntegrationCondition(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-failing-deploy"
nsRestr := "restr"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns, "--global", "--force")).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--global", "--force")).To(Succeed())
// Create restricted namespace
ExpectExecSucceed(t, g,
exec.Command(
@@ -68,14 +69,14 @@ func TestDeploymentFailureShouldReportIntegrationCondition(t *testing.T) {
)
// Create an Integration into a restricted namespace
name := RandomizedSuffixName("java-fail")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name, "-n", nsRestr).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-n", nsRestr).Execute()).To(Succeed())
// Check the error is reported into the Integration
- g.Eventually(IntegrationPhase(t, nsRestr, name), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseError))
- g.Eventually(IntegrationCondition(t, nsRestr, name, v1.IntegrationConditionReady)().Status).
+ g.Eventually(IntegrationPhase(t, ctx, nsRestr, name), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationCondition(t, ctx, nsRestr, name, v1.IntegrationConditionReady)().Status).
Should(Equal(corev1.ConditionFalse))
- g.Eventually(IntegrationCondition(t, nsRestr, name, v1.IntegrationConditionReady)().Message).
+ g.Eventually(IntegrationCondition(t, ctx, nsRestr, name, v1.IntegrationConditionReady)().Message).
Should(ContainSubstring("is forbidden: violates PodSecurity"))
// Clean up
- g.Eventually(DeleteIntegrations(t, nsRestr)).Should(Equal(0))
+ g.Eventually(DeleteIntegrations(t, ctx, nsRestr)).Should(Equal(0))
})
}
diff --git a/e2e/advanced/dump_test.go b/e2e/advanced/dump_test.go
index 96c218af1..37b5e0bcc 100644
--- a/e2e/advanced/dump_test.go
+++ b/e2e/advanced/dump_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"fmt"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"testing"
@@ -37,9 +38,9 @@ import (
func TestKamelCLIDump(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
t.Run("dump empty namespace", func(t *testing.T) {
- dump := GetOutputString(Kamel(t, "dump", "-n", ns))
+ dump := GetOutputString(Kamel(t, ctx, "dump", "-n", ns))
g.Expect(dump).To(ContainSubstring("Found 0 integrations:"))
g.Expect(dump).To(ContainSubstring("Found 0 deployments:"))
@@ -47,16 +48,16 @@ func TestKamelCLIDump(t *testing.T) {
t.Run("dump non-empty namespace", func(t *testing.T) {
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)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "yaml")).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "yaml")).Should(ContainSubstring("Magicstring!"))
- dump := GetOutputString(Kamel(t, "dump", "-n", ns))
+ dump := GetOutputString(Kamel(t, ctx, "dump", "-n", ns))
g.Expect(dump).To(ContainSubstring("Found 1 platforms"))
g.Expect(dump).To(ContainSubstring("Found 1 integrations"))
g.Expect(dump).To(ContainSubstring("name: yaml"))
diff --git a/e2e/advanced/environment_test.go b/e2e/advanced/environment_test.go
index bff92d269..eadde81f6 100644
--- a/e2e/advanced/environment_test.go
+++ b/e2e/advanced/environment_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"fmt"
"os"
"strings"
@@ -41,7 +42,7 @@ import (
func TestEnvironmentTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
// HTTP proxy configuration
httpProxy := "http://proxy"
noProxy := []string{
@@ -52,7 +53,7 @@ func TestEnvironmentTrait(t *testing.T) {
}
// Retrieve the Kubernetes Service ClusterIPs to populate the NO_PROXY environment variable
- svc := Service(t, TestDefaultNamespace, "kubernetes")()
+ svc := Service(t, ctx, TestDefaultNamespace, "kubernetes")()
g.Expect(svc).NotTo(BeNil())
noProxy = append(noProxy, svc.Spec.ClusterIPs...)
@@ -67,23 +68,20 @@ func TestEnvironmentTrait(t *testing.T) {
// Install Camel K with the HTTP proxy environment variable
operatorID := "camel-k-trait-environment"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns,
- "--operator-env-vars", fmt.Sprintf("HTTP_PROXY=%s", httpProxy),
- "--operator-env-vars", "NO_PROXY="+strings.Join(noProxy, ","),
- )).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--operator-env-vars", fmt.Sprintf("HTTP_PROXY=%s", httpProxy), "--operator-env-vars", "NO_PROXY="+strings.Join(noProxy, ","))).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Run integration with default environment", func(t *testing.T) {
name := RandomizedSuffixName("java-default")
- g.Expect(KamelRunWithID(t, operatorID, ns, "--name", name, "files/Java.java").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("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--name", name, "files/Java.java").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(IntegrationPod(t, ns, name)()).To(WithTransform(podEnvVars, And(
+ g.Expect(IntegrationPod(t, ctx, 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{
@@ -104,15 +102,12 @@ func TestEnvironmentTrait(t *testing.T) {
t.Run("Run integration with custom environment", func(t *testing.T) {
name := RandomizedSuffixName("java-custom-proxy")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "environment.vars=HTTP_PROXY=http://custom.proxy",
- ).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("Magicstring!"))
-
- g.Expect(IntegrationPod(t, ns, name)()).To(WithTransform(podEnvVars, And(
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "environment.vars=HTTP_PROXY=http://custom.proxy").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+
+ g.Expect(IntegrationPod(t, ctx, 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{
@@ -133,15 +128,12 @@ func TestEnvironmentTrait(t *testing.T) {
t.Run("Run integration without default HTTP proxy environment", func(t *testing.T) {
name := RandomizedSuffixName("java-no-proxy")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "environment.http-proxy=false",
- ).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("Magicstring!"))
-
- g.Expect(IntegrationPod(t, ns, name)()).To(WithTransform(podEnvVars, And(
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "environment.http-proxy=false").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+
+ g.Expect(IntegrationPod(t, ctx, 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{
@@ -160,15 +152,15 @@ func TestEnvironmentTrait(t *testing.T) {
)))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, name)).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, name)()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, name)).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, name)()
envTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "environment")
g.Expect(envTrait).ToNot(BeNil())
g.Expect(len(envTrait)).To(Equal(1))
g.Expect(envTrait["httpProxy"]).To(Equal(false))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/advanced/incremental_build_test.go b/e2e/advanced/incremental_build_test.go
index b34f6c84b..cdb1ba38c 100644
--- a/e2e/advanced/incremental_build_test.go
+++ b/e2e/advanced/incremental_build_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"fmt"
"testing"
@@ -38,33 +39,29 @@ import (
func TestRunIncrementalBuildRoutine(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-incremental-build-routine"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- ).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("Magicstring!"))
- integrationKitName := IntegrationKit(t, ns, name)()
- g.Eventually(Kit(t, ns, integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
- g.Eventually(Kit(t, ns, integrationKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationKitName := IntegrationKit(t, ctx, ns, name)()
+ g.Eventually(Kit(t, ctx, ns, integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
+ g.Eventually(Kit(t, ctx, ns, integrationKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
t.Run("Reuse previous kit", func(t *testing.T) {
nameClone := "java-clone"
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", nameClone,
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, nameClone), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, nameClone, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, nameClone), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationCloneKitName := IntegrationKit(t, ns, nameClone)()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", nameClone).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, nameClone), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, nameClone, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, nameClone), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationCloneKitName := IntegrationKit(t, ctx, ns, nameClone)()
g.Eventually(integrationCloneKitName).Should(Equal(integrationKitName))
})
@@ -72,193 +69,162 @@ func TestRunIncrementalBuildRoutine(t *testing.T) {
// Another integration that should be built on top of the previous IntegrationKit
// just add a new random dependency
nameIncremental := RandomizedSuffixName("java-incremental")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", nameIncremental,
- "-d", "camel:zipfile",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, nameIncremental), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, nameIncremental, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, nameIncremental), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationIncrementalKitName := IntegrationKit(t, ns, nameIncremental)()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", nameIncremental, "-d", "camel:zipfile").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, nameIncremental), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, nameIncremental, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, nameIncremental), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationIncrementalKitName := IntegrationKit(t, ctx, 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 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(Kit(t, ctx, ns, integrationIncrementalKitName)().Status.BaseImage).Should(ContainSubstring(integrationKitName))
+ g.Eventually(Kit(t, ctx, ns, integrationIncrementalKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestRunIncrementalBuildPod(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-incremental-build-pod"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "builder.strategy=pod",
- ).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("Magicstring!"))
- integrationKitName := IntegrationKit(t, ns, name)()
- g.Eventually(Kit(t, ns, integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
- g.Eventually(Kit(t, ns, integrationKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
- g.Eventually(BuilderPodsCount(t, ns)).Should(Equal(1))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "builder.strategy=pod").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationKitName := IntegrationKit(t, ctx, ns, name)()
+ g.Eventually(Kit(t, ctx, ns, integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
+ g.Eventually(Kit(t, ctx, ns, integrationKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
+ g.Eventually(BuilderPodsCount(t, ctx, ns)).Should(Equal(1))
t.Run("Reuse previous kit", func(t *testing.T) {
nameClone := RandomizedSuffixName("java-clone")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", nameClone,
- "-t", "builder.strategy=pod",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, nameClone), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, nameClone, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, nameClone), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationCloneKitName := IntegrationKit(t, ns, nameClone)()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", nameClone, "-t", "builder.strategy=pod").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, nameClone), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, nameClone, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, nameClone), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationCloneKitName := IntegrationKit(t, ctx, ns, nameClone)()
g.Eventually(integrationCloneKitName).Should(Equal(integrationKitName))
- g.Eventually(BuilderPodsCount(t, ns)).Should(Equal(1))
+ g.Eventually(BuilderPodsCount(t, ctx, ns)).Should(Equal(1))
})
t.Run("Create incremental kit", func(t *testing.T) {
// Another integration that should be built on top of the previous IntegrationKit
// just add a new random dependency
nameIncremental := RandomizedSuffixName("java-incremental")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", nameIncremental,
- "-d", "camel:zipfile",
- "-t", "builder.strategy=pod",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, nameIncremental), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, nameIncremental, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, nameIncremental), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationIncrementalKitName := IntegrationKit(t, ns, nameIncremental)()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", nameIncremental, "-d", "camel:zipfile", "-t", "builder.strategy=pod").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, nameIncremental), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, nameIncremental, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, nameIncremental), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationIncrementalKitName := IntegrationKit(t, ctx, 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 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))
+ g.Eventually(Kit(t, ctx, ns, integrationIncrementalKitName)().Status.BaseImage).Should(ContainSubstring(integrationKitName))
+ g.Eventually(Kit(t, ctx, ns, integrationIncrementalKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
+ g.Eventually(BuilderPodsCount(t, ctx, ns)).Should(Equal(2))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestRunIncrementalBuildOff(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-standard-build"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- ).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("Magicstring!"))
- integrationKitName := IntegrationKit(t, ns, name)()
- g.Eventually(Kit(t, ns, integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationKitName := IntegrationKit(t, ctx, ns, name)()
+ g.Eventually(Kit(t, ctx, ns, integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
t.Run("Don't reuse previous kit", func(t *testing.T) {
nameClone := RandomizedSuffixName("java-clone")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", nameClone,
- "-t", "builder.incremental-image-build=false",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, nameClone), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, nameClone, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, nameClone), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationCloneKitName := IntegrationKit(t, ns, nameClone)()
- g.Eventually(Kit(t, ns, integrationCloneKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", nameClone, "-t", "builder.incremental-image-build=false").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, nameClone), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, nameClone, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, nameClone), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationCloneKitName := IntegrationKit(t, ctx, ns, nameClone)()
+ g.Eventually(Kit(t, ctx, ns, integrationCloneKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
})
t.Run("Don't create incremental kit", func(t *testing.T) {
// Another integration that should be built on top of the previous IntegrationKit
// just add a new random dependency
nameIncremental := RandomizedSuffixName("java-incremental")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", nameIncremental,
- "-d", "camel:zipfile",
- "-t", "builder.incremental-image-build=false",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, nameIncremental), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, nameIncremental, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, nameIncremental), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationIncrementalKitName := IntegrationKit(t, ns, nameIncremental)()
- g.Eventually(Kit(t, ns, integrationIncrementalKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", nameIncremental, "-d", "camel:zipfile", "-t", "builder.incremental-image-build=false").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, nameIncremental), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, nameIncremental, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, nameIncremental), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationIncrementalKitName := IntegrationKit(t, ctx, ns, nameIncremental)()
+ g.Eventually(Kit(t, ctx, ns, integrationIncrementalKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestRunIncrementalBuildWithDifferentBaseImages(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-incremental-different-base"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- ).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("Magicstring!"))
- integrationKitName := IntegrationKit(t, ns, name)()
- g.Eventually(Kit(t, ns, integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
- g.Eventually(Kit(t, ns, integrationKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationKitName := IntegrationKit(t, ctx, ns, name)()
+ g.Eventually(Kit(t, ctx, ns, integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
+ g.Eventually(Kit(t, ctx, ns, integrationKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
t.Run("Create incremental kit", func(t *testing.T) {
// Another integration that should be built on top of the previous IntegrationKit
// just add a new random dependency
nameIncremental := RandomizedSuffixName("java-incremental")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", nameIncremental,
- "-d", "camel:zipfile",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, nameIncremental), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, nameIncremental, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, nameIncremental), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationIncrementalKitName := IntegrationKit(t, ns, nameIncremental)()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", nameIncremental, "-d", "camel:zipfile").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, nameIncremental), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, nameIncremental, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, nameIncremental), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationIncrementalKitName := IntegrationKit(t, ctx, 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
- 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(Kit(t, ctx, ns, integrationIncrementalKitName)().Status.BaseImage).Should(ContainSubstring(integrationKitName))
+ g.Eventually(Kit(t, ctx, ns, integrationIncrementalKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
})
t.Run("Create new hierarchy kit", func(t *testing.T) {
// We should spin off a new hierarchy of builds
newBaseImage := "eclipse-temurin:17.0.8.1_1-jdk-ubi9-minimal"
name = RandomizedSuffixName("java-new")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-d", "camel:mongodb",
- "-t", fmt.Sprintf("builder.base-image=%s", newBaseImage),
- ).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("Magicstring!"))
- integrationKitName = IntegrationKit(t, ns, name)()
- g.Eventually(Kit(t, ns, integrationKitName)().Status.BaseImage).Should(Equal(newBaseImage))
- g.Eventually(Kit(t, ns, integrationKitName)().Status.RootImage).Should(Equal(newBaseImage))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-d", "camel:mongodb", "-t", fmt.Sprintf("builder.base-image=%s", newBaseImage)).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationKitName = IntegrationKit(t, ctx, ns, name)()
+ g.Eventually(Kit(t, ctx, ns, integrationKitName)().Status.BaseImage).Should(Equal(newBaseImage))
+ g.Eventually(Kit(t, ctx, ns, integrationKitName)().Status.RootImage).Should(Equal(newBaseImage))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/advanced/integration_profile_test.go b/e2e/advanced/integration_profile_test.go
index 422490ecd..0a14026e2 100644
--- a/e2e/advanced/integration_profile_test.go
+++ b/e2e/advanced/integration_profile_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"testing"
"github.com/apache/camel-k/v2/pkg/util/defaults"
@@ -38,10 +39,10 @@ import (
func TestIntegrationProfile(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-integration-profile"
- g.Expect(KamelInstallWithID(t, operatorID, ns, "--global", "--force")).To(Succeed())
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--global", "--force")).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
integrationProfile := v1.NewIntegrationProfile(ns, "ipr-global")
integrationProfile.SetOperatorID(operatorID)
@@ -50,44 +51,44 @@ func TestIntegrationProfile(t *testing.T) {
LimitCPU: "0.2",
}
- g.Expect(CreateIntegrationProfile(t, &integrationProfile)).To(Succeed())
- g.Eventually(SelectedIntegrationProfilePhase(t, ns, "ipr-global"), TestTimeoutMedium).Should(Equal(v1.IntegrationProfilePhaseReady))
+ g.Expect(CreateIntegrationProfile(t, ctx, &integrationProfile)).To(Succeed())
+ g.Eventually(SelectedIntegrationProfilePhase(t, ctx, ns, "ipr-global"), TestTimeoutMedium).Should(Equal(v1.IntegrationProfilePhaseReady))
- WithNewTestNamespace(t, func(g *WithT, ns1 string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns1 string) {
integrationProfile := v1.NewIntegrationProfile(ns1, "ipr-local")
integrationProfile.SetOperatorID(operatorID)
integrationProfile.Spec.Traits.Container = &traitv1.ContainerTrait{
LimitCPU: "0.1",
}
- g.Expect(CreateIntegrationProfile(t, &integrationProfile)).To(Succeed())
- g.Eventually(SelectedIntegrationProfilePhase(t, ns1, "ipr-local"), TestTimeoutMedium).Should(Equal(v1.IntegrationProfilePhaseReady))
+ g.Expect(CreateIntegrationProfile(t, ctx, &integrationProfile)).To(Succeed())
+ g.Eventually(SelectedIntegrationProfilePhase(t, ctx, ns1, "ipr-local"), TestTimeoutMedium).Should(Equal(v1.IntegrationProfilePhaseReady))
t.Run("Run integration with global integration profile", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns1, "--name", "limited", "--integration-profile", "ipr-global", "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns1, "--name", "limited", "--integration-profile", "ipr-global", "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPod(t, ns1, "limited"), TestTimeoutMedium).Should(Not(BeNil()))
- g.Eventually(IntegrationPodHas(t, ns1, "limited", func(pod *corev1.Pod) bool {
+ g.Eventually(IntegrationPod(t, ctx, ns1, "limited"), TestTimeoutMedium).Should(Not(BeNil()))
+ g.Eventually(IntegrationPodHas(t, ctx, ns1, "limited", func(pod *corev1.Pod) bool {
if len(pod.Spec.Containers) != 1 {
return false
}
containerName := pod.Spec.Containers[0].Name
return containerName == "ck-integration-global"
}), TestTimeoutShort).Should(BeTrue())
- g.Eventually(IntegrationPodHas(t, ns1, "limited", func(pod *corev1.Pod) bool {
+ g.Eventually(IntegrationPodHas(t, ctx, ns1, "limited", func(pod *corev1.Pod) bool {
if len(pod.Spec.Containers) != 1 {
return false
}
cpuLimits := pod.Spec.Containers[0].Resources.Limits.Cpu()
return cpuLimits != nil && cpuLimits.AsApproximateFloat64() > 0
}), TestTimeoutShort).Should(BeTrue())
- g.Expect(Kamel(t, "delete", "limited", "-n", ns1).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "limited", "-n", ns1).Execute()).To(Succeed())
})
t.Run("Run integration with namespace local integration profile", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns1, "--name", "limited", "--integration-profile", "ipr-local", "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns1, "--name", "limited", "--integration-profile", "ipr-local", "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPod(t, ns1, "limited"), TestTimeoutMedium).Should(Not(BeNil()))
- g.Eventually(IntegrationPodHas(t, ns1, "limited", func(pod *corev1.Pod) bool {
+ g.Eventually(IntegrationPod(t, ctx, ns1, "limited"), TestTimeoutMedium).Should(Not(BeNil()))
+ g.Eventually(IntegrationPodHas(t, ctx, ns1, "limited", func(pod *corev1.Pod) bool {
if len(pod.Spec.Containers) != 1 {
return false
}
@@ -95,20 +96,20 @@ func TestIntegrationProfile(t *testing.T) {
return containerName == "integration"
}), TestTimeoutShort).Should(BeTrue())
- g.Eventually(IntegrationPodHas(t, ns1, "limited", func(pod *corev1.Pod) bool {
+ g.Eventually(IntegrationPodHas(t, ctx, ns1, "limited", func(pod *corev1.Pod) bool {
if len(pod.Spec.Containers) != 1 {
return false
}
cpuLimits := pod.Spec.Containers[0].Resources.Limits.Cpu()
return cpuLimits != nil && cpuLimits.AsApproximateFloat64() > 0
}), TestTimeoutShort).Should(BeTrue())
- g.Expect(Kamel(t, "delete", "limited", "-n", ns1).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "limited", "-n", ns1).Execute()).To(Succeed())
})
t.Run("Run integration without integration profile", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns1, "--name", "normal", "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPod(t, ns1, "normal"), TestTimeoutShort).Should(Not(BeNil()))
- g.Eventually(IntegrationPodHas(t, ns1, "normal", func(pod *corev1.Pod) bool {
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns1, "--name", "normal", "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPod(t, ctx, ns1, "normal"), TestTimeoutShort).Should(Not(BeNil()))
+ g.Eventually(IntegrationPodHas(t, ctx, ns1, "normal", func(pod *corev1.Pod) bool {
if len(pod.Spec.Containers) != 1 {
return false
}
@@ -118,7 +119,7 @@ func TestIntegrationProfile(t *testing.T) {
})
// Clean up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns1).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns1).Execute()).To(Succeed())
})
})
}
@@ -126,10 +127,10 @@ func TestIntegrationProfile(t *testing.T) {
func TestIntegrationProfileInfluencesKit(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-ipr-kit"
- g.Expect(KamelInstallWithID(t, operatorID, ns, "--global", "--force")).To(Succeed())
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--global", "--force")).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
integrationProfile := v1.NewIntegrationProfile(ns, "ipr-global")
integrationProfile.SetOperatorID(operatorID)
@@ -137,44 +138,44 @@ func TestIntegrationProfileInfluencesKit(t *testing.T) {
Properties: []string{"b1=foo"},
}
- g.Expect(CreateIntegrationProfile(t, &integrationProfile)).To(Succeed())
- g.Eventually(SelectedIntegrationProfilePhase(t, ns, "ipr-global"), TestTimeoutMedium).Should(Equal(v1.IntegrationProfilePhaseReady))
+ g.Expect(CreateIntegrationProfile(t, ctx, &integrationProfile)).To(Succeed())
+ g.Eventually(SelectedIntegrationProfilePhase(t, ctx, ns, "ipr-global"), TestTimeoutMedium).Should(Equal(v1.IntegrationProfilePhaseReady))
- g.Expect(KamelRunWithID(t, operatorID, ns, "--name", "normal", "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPod(t, ns, "normal"), TestTimeoutMedium).Should(Not(BeNil()))
- g.Eventually(IntegrationPodPhase(t, ns, "normal"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "normal", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "normal"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--name", "normal", "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPod(t, ctx, ns, "normal"), TestTimeoutMedium).Should(Not(BeNil()))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "normal"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "normal", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "normal"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// Verify that a new kit has been built based on the default base image
- integrationKitName := IntegrationKit(t, ns, "normal")()
- g.Eventually(Kit(t, ns, integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
- g.Eventually(Kit(t, ns, integrationKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
+ integrationKitName := IntegrationKit(t, ctx, ns, "normal")()
+ g.Eventually(Kit(t, ctx, ns, integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
+ g.Eventually(Kit(t, ctx, ns, integrationKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
- g.Expect(KamelRunWithID(t, operatorID, ns, "--name", "simple", "--integration-profile", "ipr-global", "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--name", "simple", "--integration-profile", "ipr-global", "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPod(t, ns, "simple"), TestTimeoutMedium).Should(Not(BeNil()))
- g.Eventually(IntegrationPodPhase(t, ns, "simple"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "simple", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "simple"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationPod(t, ctx, ns, "simple"), TestTimeoutMedium).Should(Not(BeNil()))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "simple"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "simple", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "simple"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// Verify that a new kit has been built based on the previous kit
- integrationKitNameWithProfile := IntegrationKit(t, ns, "simple")()
+ integrationKitNameWithProfile := IntegrationKit(t, ctx, ns, "simple")()
g.Eventually(integrationKitNameWithProfile).ShouldNot(Equal(integrationKitName))
- g.Eventually(Kit(t, ns, integrationKitNameWithProfile)().Status.BaseImage).Should(ContainSubstring(integrationKitName))
- g.Eventually(Kit(t, ns, integrationKitNameWithProfile)().Status.RootImage).Should(Equal(defaults.BaseImage()))
+ g.Eventually(Kit(t, ctx, ns, integrationKitNameWithProfile)().Status.BaseImage).Should(ContainSubstring(integrationKitName))
+ g.Eventually(Kit(t, ctx, ns, integrationKitNameWithProfile)().Status.RootImage).Should(Equal(defaults.BaseImage()))
// Clean up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestPropagateIntegrationProfileChanges(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-ipr-changes"
- g.Expect(KamelInstallWithID(t, operatorID, ns, "--global", "--force")).To(Succeed())
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--global", "--force")).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
integrationProfile := v1.NewIntegrationProfile(ns, "debug-profile")
integrationProfile.SetOperatorID(operatorID)
@@ -185,13 +186,13 @@ func TestPropagateIntegrationProfileChanges(t *testing.T) {
Level: "DEBUG",
}
- g.Expect(CreateIntegrationProfile(t, &integrationProfile)).To(Succeed())
- g.Eventually(SelectedIntegrationProfilePhase(t, ns, "debug-profile"), TestTimeoutMedium).Should(Equal(v1.IntegrationProfilePhaseReady))
+ g.Expect(CreateIntegrationProfile(t, ctx, &integrationProfile)).To(Succeed())
+ g.Eventually(SelectedIntegrationProfilePhase(t, ctx, ns, "debug-profile"), TestTimeoutMedium).Should(Equal(v1.IntegrationProfilePhaseReady))
- g.Expect(KamelRunWithID(t, operatorID, ns, "--name", "simple", "--integration-profile", "debug-profile", "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--name", "simple", "--integration-profile", "debug-profile", "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPod(t, ns, "simple"), TestTimeoutMedium).Should(Not(BeNil()))
- g.Eventually(IntegrationPodHas(t, ns, "simple", func(pod *corev1.Pod) bool {
+ g.Eventually(IntegrationPod(t, ctx, ns, "simple"), TestTimeoutMedium).Should(Not(BeNil()))
+ g.Eventually(IntegrationPodHas(t, ctx, ns, "simple", func(pod *corev1.Pod) bool {
if len(pod.Spec.Containers) != 1 {
return false
}
@@ -199,13 +200,13 @@ func TestPropagateIntegrationProfileChanges(t *testing.T) {
return containerName == "ck-ipr"
}), TestTimeoutShort).Should(BeTrue())
- g.Expect(UpdateIntegrationProfile(t, ns, func(ipr *v1.IntegrationProfile) {
+ g.Expect(UpdateIntegrationProfile(t, ctx, ns, func(ipr *v1.IntegrationProfile) {
ipr.Spec.Traits.Container = &traitv1.ContainerTrait{
Name: "ck-ipr-new",
}
})).To(Succeed())
- g.Eventually(IntegrationPodHas(t, ns, "simple", func(pod *corev1.Pod) bool {
+ g.Eventually(IntegrationPodHas(t, ctx, ns, "simple", func(pod *corev1.Pod) bool {
if len(pod.Spec.Containers) != 1 {
return false
}
@@ -214,6 +215,6 @@ func TestPropagateIntegrationProfileChanges(t *testing.T) {
}), TestTimeoutShort).Should(BeTrue())
// Clean up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/advanced/kamelet_repo_test.go b/e2e/advanced/kamelet_repo_test.go
index fd9e3502b..d85a2c2bb 100644
--- a/e2e/advanced/kamelet_repo_test.go
+++ b/e2e/advanced/kamelet_repo_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"fmt"
"testing"
@@ -36,37 +37,31 @@ import (
func TestKameletFromCustomRepository(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, 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)).To(Succeed())
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
kameletName := "timer-custom-source"
- removeKamelet(t, kameletName, ns)
+ removeKamelet(t, ctx, kameletName, ns)
- g.Eventually(Kamelet(t, kameletName, ns)).Should(BeNil())
+ g.Eventually(Kamelet(t, ctx, kameletName, ns)).Should(BeNil())
// Add the custom repository
- g.Expect(Kamel(t, "kamelet", "add-repo",
- "github:squakez/ck-kamelet-test-repo/kamelets",
- "-n", ns,
- "-x", operatorID).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "kamelet", "add-repo", "github:squakez/ck-kamelet-test-repo/kamelets", "-n", ns, "-x", operatorID).Execute()).To(Succeed())
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/TimerCustomKameletIntegration.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "timer-custom-kamelet-integration"), TestTimeoutLong).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerCustomKameletIntegration.java").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "timer-custom-kamelet-integration"), TestTimeoutLong).
Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "timer-custom-kamelet-integration")).Should(ContainSubstring("hello world"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "timer-custom-kamelet-integration")).Should(ContainSubstring("hello world"))
// Remove the custom repository
- g.Expect(Kamel(t, "kamelet", "remove-repo",
- "github:squakez/ck-kamelet-test-repo/kamelets",
- "-n", ns,
- "-x", operatorID).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "kamelet", "remove-repo", "github:squakez/ck-kamelet-test-repo/kamelets", "-n", ns, "-x", operatorID).Execute()).To(Succeed())
})
}
-func removeKamelet(t *testing.T, name string, ns string) {
- kamelet := Kamelet(t, name, ns)()
- TestClient(t).Delete(TestContext, kamelet)
+func removeKamelet(t *testing.T, ctx context.Context, name string, ns string) {
+ kamelet := Kamelet(t, ctx, name, ns)()
+ TestClient(t).Delete(ctx, kamelet)
}
diff --git a/e2e/advanced/local_platform_test.go b/e2e/advanced/local_platform_test.go
index 1b6923d91..ec03d1317 100644
--- a/e2e/advanced/local_platform_test.go
+++ b/e2e/advanced/local_platform_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,29 +37,29 @@ import (
func TestLocalPlatform(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-platform-local"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns, "--global", "--force")).To(Succeed())
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--global", "--force")).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- g.Expect(UpdatePlatform(t, ns, operatorID, func(pl *v1.IntegrationPlatform) {
+ g.Expect(UpdatePlatform(t, ctx, ns, operatorID, func(pl *v1.IntegrationPlatform) {
pl.Spec.Build.Maven.Properties = make(map[string]string)
pl.Spec.Build.Maven.Properties["build-global-prop1"] = "build-global-value1"
// set maximum number of running builds
pl.Spec.Build.MaxRunningBuilds = 1
})).To(Succeed())
- g.Eventually(PlatformHas(t, ns, func(pl *v1.IntegrationPlatform) bool {
+ g.Eventually(PlatformHas(t, ctx, ns, func(pl *v1.IntegrationPlatform) bool {
return pl.Status.Build.MaxRunningBuilds == 1
}), TestTimeoutMedium).Should(BeTrue())
- WithNewTestNamespace(t, func(g *WithT, ns1 string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns1 string) {
// Install platform (use the installer to get staging if present)
- g.Expect(KamelInstallWithID(t, "local-platform", ns1, "--skip-operator-setup")).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, "local-platform", ns1, "--skip-operator-setup")).To(Succeed())
- g.Expect(UpdatePlatform(t, ns1, "local-platform", func(pl *v1.IntegrationPlatform) {
+ g.Expect(UpdatePlatform(t, ctx, ns1, "local-platform", func(pl *v1.IntegrationPlatform) {
pl.Spec.Build.Maven.Properties = make(map[string]string)
pl.Spec.Build.Maven.Properties["build-local-prop1"] = "build-local-value1"
pl.SetOperatorID(operatorID)
@@ -68,17 +69,17 @@ func TestLocalPlatform(t *testing.T) {
}
})).To(Succeed())
- g.Eventually(PlatformPhase(t, ns1), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- g.Eventually(PlatformHas(t, ns1, func(pl *v1.IntegrationPlatform) bool {
+ g.Eventually(PlatformPhase(t, ctx, ns1), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(PlatformHas(t, ctx, ns1, func(pl *v1.IntegrationPlatform) bool {
return pl.Status.Cluster != ""
}), TestTimeoutShort).Should(BeTrue())
- g.Eventually(PlatformHas(t, ns1, func(pl *v1.IntegrationPlatform) bool {
+ g.Eventually(PlatformHas(t, ctx, ns1, func(pl *v1.IntegrationPlatform) bool {
return pl.Status.Build.MaxRunningBuilds == 1
}), TestTimeoutShort).Should(BeTrue())
- pl := PlatformByName(t, ns, operatorID)()
- local := Platform(t, ns1)()
+ pl := PlatformByName(t, ctx, ns, operatorID)()
+ local := Platform(t, ctx, ns1)()
g.Expect(local.Status.Build.PublishStrategy).To(Equal(pl.Status.Build.PublishStrategy))
g.Expect(local.Status.Build.BuildConfiguration.Strategy).To(Equal(pl.Status.Build.BuildConfiguration.Strategy))
g.Expect(local.Status.Build.BuildConfiguration.OrderStrategy).To(Equal(pl.Status.Build.BuildConfiguration.OrderStrategy))
@@ -89,9 +90,9 @@ func TestLocalPlatform(t *testing.T) {
g.Expect(local.Status.Build.Maven.Properties["build-global-prop1"]).To(Equal("build-global-value1"))
g.Expect(local.Status.Build.Maven.Properties["build-local-prop1"]).To(Equal("build-local-value1"))
- g.Expect(KamelRunWithID(t, operatorID, ns1, "--name", "local-integration", "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPod(t, ns1, "local-integration"), TestTimeoutMedium).Should(Not(BeNil()))
- g.Eventually(IntegrationPodHas(t, ns1, "local-integration", func(pod *corev1.Pod) bool {
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns1, "--name", "local-integration", "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPod(t, ctx, ns1, "local-integration"), TestTimeoutMedium).Should(Not(BeNil()))
+ g.Eventually(IntegrationPodHas(t, ctx, ns1, "local-integration", func(pod *corev1.Pod) bool {
if len(pod.Spec.Containers) != 1 {
return false
}
@@ -100,7 +101,7 @@ func TestLocalPlatform(t *testing.T) {
}), TestTimeoutShort).Should(BeTrue())
// Clean up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns1).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns1).Execute()).To(Succeed())
})
})
}
diff --git a/e2e/advanced/main_test.go b/e2e/advanced/main_test.go
index b579b4c7d..ca701cf4f 100644
--- a/e2e/advanced/main_test.go
+++ b/e2e/advanced/main_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"fmt"
"os"
"testing"
@@ -54,22 +55,23 @@ func TestMain(m *testing.M) {
fmt.Printf("Test fast setup failed! - %s\n", message)
})
+ ctx := context.TODO()
var t *testing.T
g.Expect(TestClient(t)).ShouldNot(BeNil())
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/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!"))
-
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/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(KamelRunWithID(t, operatorID, ns, "files/timer-source.groovy").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "timer-source"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "timer-source", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "timer-source"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "yaml", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-source.groovy").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "timer-source"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "timer-source", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "timer-source"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
os.Exit(m.Run())
}
diff --git a/e2e/advanced/maven_http_proxy_test.go b/e2e/advanced/maven_http_proxy_test.go
index b2e099673..4dd7a8af2 100644
--- a/e2e/advanced/maven_http_proxy_test.go
+++ b/e2e/advanced/maven_http_proxy_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@@ -60,7 +61,7 @@ var httpdTlsMountPath = "/etc/tls/private"
func TestMavenProxy(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
hostname := fmt.Sprintf("%s.%s.svc", "proxy", ns)
// Generate the TLS certificate
@@ -114,21 +115,21 @@ func TestMavenProxy(t *testing.T) {
corev1.TLSPrivateKeyKey: privateKeyPem,
},
}
- g.Expect(TestClient(t).Create(TestContext, secret)).To(Succeed())
+ g.Expect(TestClient(t).Create(ctx, secret)).To(Succeed())
// HTTPD ConfigMap
config := newHTTPDConfigMap(ns, hostname)
- g.Expect(TestClient(t).Create(TestContext, config)).To(Succeed())
+ g.Expect(TestClient(t).Create(ctx, config)).To(Succeed())
// HTTPD Deployment
deployment := newHTTPDDeployment(ns, config.Name, secret.Name)
- g.Expect(TestClient(t).Create(TestContext, deployment)).To(Succeed())
+ g.Expect(TestClient(t).Create(ctx, deployment)).To(Succeed())
service := newHTTPDService(deployment)
- g.Expect(TestClient(t).Create(TestContext, service)).To(Succeed())
+ g.Expect(TestClient(t).Create(ctx, service)).To(Succeed())
// Wait for the Deployment to become ready
- g.Eventually(Deployment(t, ns, deployment.Name), TestTimeoutMedium).Should(PointTo(MatchFields(IgnoreExtras,
+ g.Eventually(Deployment(t, ctx, ns, deployment.Name), TestTimeoutMedium).Should(PointTo(MatchFields(IgnoreExtras,
Fields{
"Status": MatchFields(IgnoreExtras,
Fields{
@@ -137,7 +138,7 @@ func TestMavenProxy(t *testing.T) {
}),
))
- svc := Service(t, TestDefaultNamespace, "kubernetes")()
+ svc := Service(t, ctx, TestDefaultNamespace, "kubernetes")()
g.Expect(svc).NotTo(BeNil())
// It may be needed to populate the values from the cluster, machine and service network CIDRs
@@ -150,11 +151,11 @@ func TestMavenProxy(t *testing.T) {
// Install Camel K with the HTTP proxy
operatorID := "camel-k-maven-proxy"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
olm, olmErr := olm.IsAPIAvailable(TestClient(t))
installed, inErr := kubernetes.IsAPIResourceInstalled(TestClient(t), configv1.GroupVersion.String(), reflect.TypeOf(configv1.Proxy{}).Name())
- permission, pErr := kubernetes.CheckPermission(TestContext, TestClient(t), configv1.GroupName, reflect.TypeOf(configv1.Proxy{}).Name(), "", "cluster", "edit")
+ permission, pErr := kubernetes.CheckPermission(ctx, TestClient(t), configv1.GroupName, reflect.TypeOf(configv1.Proxy{}).Name(), "", "cluster", "edit")
olmInstall := pErr == nil && olmErr == nil && inErr == nil && olm && installed && permission
var defaultProxy configv1.Proxy
if olmInstall {
@@ -163,12 +164,12 @@ func TestMavenProxy(t *testing.T) {
key := ctrl.ObjectKey{
Name: "cluster",
}
- g.Expect(TestClient(t).Get(TestContext, key, &defaultProxy)).To(Succeed())
+ g.Expect(TestClient(t).Get(ctx, key, &defaultProxy)).To(Succeed())
newProxy := defaultProxy.DeepCopy()
newProxy.Spec.HTTPProxy = fmt.Sprintf("http://%s", hostname)
newProxy.Spec.NoProxy = strings.Join(noProxy, ",")
- g.Expect(TestClient(t).Update(TestContext, newProxy))
+ g.Expect(TestClient(t).Update(ctx, newProxy))
defer func() {
//
@@ -177,30 +178,24 @@ func TestMavenProxy(t *testing.T) {
// does not work on some platforms, eg. OCP4
//
patch := []byte(`[{"op": "replace","path": "/spec","value": {}},{"op": "replace","path": "/status","value": {}}]`)
- TestClient(t).Patch(TestContext, &defaultProxy, ctrl.RawPatch(types.JSONPatchType, patch))
+ TestClient(t).Patch(ctx, &defaultProxy, ctrl.RawPatch(types.JSONPatchType, patch))
}()
// ENV values should be injected by the OLM
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
} else {
- g.Expect(KamelInstallWithID(t, operatorID, ns,
- "--operator-env-vars", fmt.Sprintf("HTTP_PROXY=http://%s", hostname),
- // TODO: enable TLS for the HTTPS proxy when Maven supports it
- // "--operator-env-vars", fmt.Sprintf("HTTPS_PROXY=https://%s", hostname),
- // "--maven-ca-secret", secret.Name+"/"+corev1.TLSCertKey,
- "--operator-env-vars", "NO_PROXY="+strings.Join(noProxy, ","),
- )).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--operator-env-vars", fmt.Sprintf("HTTP_PROXY=http://%s", hostname), "--operator-env-vars", "NO_PROXY="+strings.Join(noProxy, ","))).To(Succeed())
}
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
// Run the Integration
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).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("Magicstring!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
proxies := corev1.PodList{
TypeMeta: metav1.TypeMeta{
@@ -208,23 +203,23 @@ func TestMavenProxy(t *testing.T) {
APIVersion: corev1.SchemeGroupVersion.String(),
},
}
- err = TestClient(t).List(TestContext, &proxies,
+ err = TestClient(t).List(ctx, &proxies,
ctrl.InNamespace(ns),
ctrl.MatchingLabels(deployment.Spec.Selector.MatchLabels),
)
g.Expect(err).To(Succeed())
g.Expect(proxies.Items).To(HaveLen(1))
- logs := Logs(t, ns, proxies.Items[0].Name, corev1.PodLogOptions{})()
+ logs := Logs(t, ctx, ns, proxies.Items[0].Name, corev1.PodLogOptions{})()
g.Expect(logs).NotTo(BeEmpty())
g.Expect(logs).To(ContainSubstring("\"CONNECT repo.maven.apache.org:443 HTTP/1.1\" 200"))
// Clean up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
- g.Expect(TestClient(t).Delete(TestContext, deployment)).To(Succeed())
- g.Expect(TestClient(t).Delete(TestContext, service)).To(Succeed())
- g.Expect(TestClient(t).Delete(TestContext, secret)).To(Succeed())
- g.Expect(TestClient(t).Delete(TestContext, config)).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(TestClient(t).Delete(ctx, deployment)).To(Succeed())
+ g.Expect(TestClient(t).Delete(ctx, service)).To(Succeed())
+ g.Expect(TestClient(t).Delete(ctx, secret)).To(Succeed())
+ g.Expect(TestClient(t).Delete(ctx, config)).To(Succeed())
})
}
diff --git a/e2e/advanced/operator_id_filtering_test.go b/e2e/advanced/operator_id_filtering_test.go
index e73ea68c3..390d010c8 100644
--- a/e2e/advanced/operator_id_filtering_test.go
+++ b/e2e/advanced/operator_id_filtering_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"fmt"
"testing"
"time"
@@ -37,91 +38,89 @@ import (
func TestOperatorIDCamelCatalogReconciliation(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, operatorID, ns, "--global", "--force")).To(Succeed())
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- g.Eventually(DefaultCamelCatalogPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.CamelCatalogPhaseReady))
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--global", "--force")).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(DefaultCamelCatalogPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.CamelCatalogPhaseReady))
})
}
func TestOperatorIDFiltering(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
- WithNewTestNamespace(t, func(g *WithT, nsop1 string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, nsop1 string) {
operator1 := "operator-1"
- g.Expect(CopyCamelCatalog(t, nsop1, operator1)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, nsop1, operator1)).To(Succeed())
- g.Expect(KamelInstallWithIDAndKameletCatalog(t, operator1, nsop1, "--global", "--force")).To(Succeed())
- g.Eventually(PlatformPhase(t, nsop1), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, nsop1, operator1)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, nsop1, operator1)).To(Succeed())
+ g.Expect(KamelInstallWithIDAndKameletCatalog(t, ctx, operator1, nsop1, "--global", "--force")).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, nsop1), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- WithNewTestNamespace(t, func(g *WithT, nsop2 string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, nsop2 string) {
operator2 := "operator-2"
- g.Expect(CopyCamelCatalog(t, nsop2, operator2)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, nsop2, operator2)).To(Succeed())
- g.Expect(KamelInstallWithIDAndKameletCatalog(t, operator2, nsop2, "--global", "--force")).To(Succeed())
- g.Eventually(PlatformPhase(t, nsop2), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, nsop2, operator2)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, nsop2, operator2)).To(Succeed())
+ g.Expect(KamelInstallWithIDAndKameletCatalog(t, ctx, operator2, nsop2, "--global", "--force")).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, nsop2), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Operators ignore non-scoped integrations", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, "operator-x", ns, "files/yaml.yaml", "--name", "untouched", "--force").Execute()).To(Succeed())
- g.Consistently(IntegrationPhase(t, ns, "untouched"), 10*time.Second).Should(BeEmpty())
+ g.Expect(KamelRunWithID(t, ctx, "operator-x", ns, "files/yaml.yaml", "--name", "untouched", "--force").Execute()).To(Succeed())
+ g.Consistently(IntegrationPhase(t, ctx, ns, "untouched"), 10*time.Second).Should(BeEmpty())
})
t.Run("Operators run scoped integrations", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, "operator-x", ns, "files/yaml.yaml", "--name", "moving", "--force").Execute()).To(Succeed())
- g.Expect(AssignIntegrationToOperator(t, ns, "moving", operator1)).To(Succeed())
- g.Eventually(IntegrationPhase(t, ns, "moving"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationPodPhase(t, ns, "moving"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "moving"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, "operator-x", ns, "files/yaml.yaml", "--name", "moving", "--force").Execute()).To(Succeed())
+ g.Expect(AssignIntegrationToOperator(t, ctx, ns, "moving", operator1)).To(Succeed())
+ g.Eventually(IntegrationPhase(t, ctx, ns, "moving"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "moving"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "moving"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
t.Run("Operators can handoff scoped integrations", func(t *testing.T) {
- g.Expect(AssignIntegrationToOperator(t, ns, "moving", operator2)).To(Succeed())
- g.Eventually(IntegrationPhase(t, ns, "moving"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseBuildingKit))
- g.Eventually(IntegrationPhase(t, ns, "moving"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationPodPhase(t, ns, "moving"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "moving"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(AssignIntegrationToOperator(t, ctx, ns, "moving", operator2)).To(Succeed())
+ g.Eventually(IntegrationPhase(t, ctx, ns, "moving"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseBuildingKit))
+ g.Eventually(IntegrationPhase(t, ctx, ns, "moving"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "moving"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "moving"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
t.Run("Operators can be deactivated after completely handing off scoped integrations", func(t *testing.T) {
- g.Expect(ScaleOperator(t, nsop1, 0)).To(Succeed())
- g.Expect(Kamel(t, "rebuild", "-n", ns, "moving").Execute()).To(Succeed())
- g.Eventually(IntegrationPhase(t, ns, "moving"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationPodPhase(t, ns, "moving"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "moving"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(ScaleOperator(t, nsop1, 1)).To(Succeed())
+ g.Expect(ScaleOperator(t, ctx, nsop1, 0)).To(Succeed())
+ g.Expect(Kamel(t, ctx, "rebuild", "-n", ns, "moving").Execute()).To(Succeed())
+ g.Eventually(IntegrationPhase(t, ctx, ns, "moving"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "moving"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "moving"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(ScaleOperator(t, ctx, nsop1, 1)).To(Succeed())
})
t.Run("Operators can run scoped integrations with fixed image", func(t *testing.T) {
- image := IntegrationPodImage(t, ns, "moving")()
+ image := IntegrationPodImage(t, ctx, ns, "moving")()
g.Expect(image).NotTo(BeEmpty())
// Save resources by deleting "moving" integration
- g.Expect(Kamel(t, "delete", "moving", "-n", ns).Execute()).To(Succeed())
-
- g.Expect(KamelRunWithID(t, "operator-x", ns, "files/yaml.yaml", "--name", "pre-built", "--force",
- "-t", fmt.Sprintf("container.image=%s", image), "-t", "jvm.enabled=true").Execute()).To(Succeed())
- g.Consistently(IntegrationPhase(t, ns, "pre-built"), 10*time.Second).Should(BeEmpty())
- g.Expect(AssignIntegrationToOperator(t, ns, "pre-built", operator2)).To(Succeed())
- g.Eventually(IntegrationPhase(t, ns, "pre-built"), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationPodPhase(t, ns, "pre-built"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "pre-built"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(Kamel(t, "delete", "pre-built", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "moving", "-n", ns).Execute()).To(Succeed())
+
+ g.Expect(KamelRunWithID(t, ctx, "operator-x", ns, "files/yaml.yaml", "--name", "pre-built", "--force", "-t", fmt.Sprintf("container.image=%s", image), "-t", "jvm.enabled=true").Execute()).To(Succeed())
+ g.Consistently(IntegrationPhase(t, ctx, ns, "pre-built"), 10*time.Second).Should(BeEmpty())
+ g.Expect(AssignIntegrationToOperator(t, ctx, ns, "pre-built", operator2)).To(Succeed())
+ g.Eventually(IntegrationPhase(t, ctx, ns, "pre-built"), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "pre-built"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "pre-built"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(Kamel(t, ctx, "delete", "pre-built", "-n", ns).Execute()).To(Succeed())
})
t.Run("Operators can run scoped Pipes", func(t *testing.T) {
- g.Expect(KamelBindWithID(t, "operator-x", ns, "timer-source?message=Hello", "log-sink",
- "--name", "klb", "--force").Execute()).To(Succeed())
- g.Consistently(Integration(t, ns, "klb"), 10*time.Second).Should(BeNil())
-
- g.Expect(AssignPipeToOperator(t, ns, "klb", operator1)).To(Succeed())
- g.Eventually(Integration(t, ns, "klb"), TestTimeoutShort).ShouldNot(BeNil())
- g.Eventually(IntegrationPhase(t, ns, "klb"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationPodPhase(t, ns, "klb"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelBindWithID(t, ctx, "operator-x", ns, "timer-source?message=Hello", "log-sink", "--name", "klb", "--force").Execute()).To(Succeed())
+ g.Consistently(Integration(t, ctx, ns, "klb"), 10*time.Second).Should(BeNil())
+
+ g.Expect(AssignPipeToOperator(t, ctx, ns, "klb", operator1)).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, "klb"), TestTimeoutShort).ShouldNot(BeNil())
+ g.Eventually(IntegrationPhase(t, ctx, ns, "klb"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "klb"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
})
})
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/advanced/operator_metrics_test.go b/e2e/advanced/operator_metrics_test.go
index 004ce2950..376aeb0cc 100644
--- a/e2e/advanced/operator_metrics_test.go
+++ b/e2e/advanced/operator_metrics_test.go
@@ -24,6 +24,7 @@ package advanced
import (
"bytes"
+ "context"
"fmt"
"math"
"os"
@@ -58,24 +59,20 @@ func TestMetrics(t *testing.T) {
t.Skip("WARNING: Test marked as problematic ... skipping")
}
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
name := RandomizedSuffixName("java")
operatorID := "camel-k-metrics"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns, "--log-level", "debug")).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
-
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "prometheus.enabled=true",
- "-t", "prometheus.pod-monitor=false",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--log-level", "debug")).To(Succeed())
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "prometheus.enabled=true", "-t", "prometheus.pod-monitor=false").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- pod := OperatorPod(t, ns)()
+ pod := OperatorPod(t, ctx, ns)()
g.Expect(pod).NotTo(BeNil())
// pod.Namespace could be different from ns if using global operator
@@ -83,19 +80,19 @@ func TestMetrics(t *testing.T) {
logOptions := &corev1.PodLogOptions{
Container: "camel-k-operator",
}
- logs, err := StructuredLogs(t, pod.Namespace, pod.Name, logOptions, false)
+ logs, err := StructuredLogs(t, ctx, pod.Namespace, pod.Name, logOptions, false)
g.Expect(err).To(BeNil())
g.Expect(logs).NotTo(BeEmpty())
response, err := TestClient(t).CoreV1().RESTClient().Get().
- AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/metrics", pod.Namespace, pod.Name)).DoRaw(TestContext)
+ AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/metrics", pod.Namespace, pod.Name)).DoRaw(ctx)
g.Expect(err).To(BeNil())
metrics, err := parsePrometheusData(response)
g.Expect(err).To(BeNil())
- it := Integration(t, ns, name)()
+ it := Integration(t, ctx, ns, name)()
g.Expect(it).NotTo(BeNil())
- build := Build(t, ns, it.Status.IntegrationKit.Name)()
+ build := Build(t, ctx, ns, it.Status.IntegrationKit.Name)()
g.Expect(build).NotTo(BeNil())
t.Run("Build duration metric", func(t *testing.T) {
@@ -541,7 +538,7 @@ func TestMetrics(t *testing.T) {
})
// Clean up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/advanced/platform_traits_test.go b/e2e/advanced/platform_traits_test.go
index a23c7603d..827064001 100644
--- a/e2e/advanced/platform_traits_test.go
+++ b/e2e/advanced/platform_traits_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"testing"
"github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
@@ -38,36 +39,34 @@ import (
func TestTraitOnIntegrationPlatform(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-platform-trait-test"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
containerTestName := "testname"
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- ip := Platform(t, ns)()
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ ip := Platform(t, ctx, ns)()
ip.Spec.Traits = v1.Traits{Logging: &trait.LoggingTrait{Level: "DEBUG"}, Container: &trait.ContainerTrait{Name: containerTestName}}
- if err := TestClient(t).Update(TestContext, ip); err != nil {
+ if err := TestClient(t).Update(ctx, ip); err != nil {
t.Fatal("Can't create IntegrationPlatform", err)
}
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("java")
t.Run("Run integration with platform traits", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- ).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("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(IntegrationPod(t, ns, name)().Spec.Containers[0].Name).To(BeEquivalentTo(containerTestName))
+ g.Expect(IntegrationPod(t, ctx, ns, name)().Spec.Containers[0].Name).To(BeEquivalentTo(containerTestName))
found := false
- for _, env := range IntegrationPod(t, ns, name)().Spec.Containers[0].Env {
+ for _, env := range IntegrationPod(t, ctx, ns, name)().Spec.Containers[0].Env {
if env.Name == "QUARKUS_LOG_LEVEL" {
g.Expect(env.Value).To(BeEquivalentTo("DEBUG"))
found = true
@@ -75,9 +74,9 @@ func TestTraitOnIntegrationPlatform(t *testing.T) {
}
}
g.Expect(found).To(BeTrue(), "Can't find QUARKUS_LOG_LEVEL ENV variable")
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("DEBUG"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("DEBUG"))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
})
}
diff --git a/e2e/advanced/promote_test.go b/e2e/advanced/promote_test.go
index b03e1686e..649190855 100644
--- a/e2e/advanced/promote_test.go
+++ b/e2e/advanced/promote_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"testing"
corev1 "k8s.io/api/core/v1"
@@ -39,141 +40,137 @@ func TestKamelCLIPromote(t *testing.T) {
one := int64(1)
two := int64(2)
// Dev environment namespace
- WithNewTestNamespace(t, func(g *WithT, nsDev string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, nsDev string) {
operatorDevID := "camel-k-cli-promote-dev"
- g.Expect(CopyCamelCatalog(t, nsDev, operatorDevID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, nsDev, operatorDevID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorDevID, nsDev)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, nsDev, operatorDevID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, nsDev, operatorDevID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, nsDev, operatorDevID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorDevID, nsDev)).To(Succeed())
+ g.Eventually(SelectedPlatformPhase(t, ctx, nsDev, operatorDevID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
// Dev content configmap
var cmData = make(map[string]string)
cmData["my-configmap-key"] = "I am development configmap!"
- CreatePlainTextConfigmap(t, nsDev, "my-cm-promote", cmData)
+ CreatePlainTextConfigmap(t, ctx, nsDev, "my-cm-promote", cmData)
// Dev secret
var secData = make(map[string]string)
secData["my-secret-key"] = "very top secret development"
- CreatePlainTextSecret(t, nsDev, "my-sec-promote", secData)
+ CreatePlainTextSecret(t, ctx, nsDev, "my-sec-promote", secData)
t.Run("plain integration dev", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorDevID, nsDev, "./files/promote-route.groovy",
- "--config", "configmap:my-cm-promote",
- "--config", "secret:my-sec-promote",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, nsDev, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationObservedGeneration(t, nsDev, "promote-route")).Should(Equal(&one))
+ g.Expect(KamelRunWithID(t, ctx, operatorDevID, nsDev, "./files/promote-route.groovy", "--config", "configmap:my-cm-promote", "--config", "secret:my-sec-promote").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, nsDev, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationObservedGeneration(t, ctx, nsDev, "promote-route")).Should(Equal(&one))
//g.Eventually(IntegrationConditionStatus(t, nsDev, "promote-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, nsDev, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am development configmap!"))
- g.Eventually(IntegrationLogs(t, nsDev, "promote-route"), TestTimeoutShort).Should(ContainSubstring("very top secret development"))
+ g.Eventually(IntegrationLogs(t, ctx, nsDev, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am development configmap!"))
+ g.Eventually(IntegrationLogs(t, ctx, nsDev, "promote-route"), TestTimeoutShort).Should(ContainSubstring("very top secret development"))
})
t.Run("kamelet integration dev", func(t *testing.T) {
- 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"))
+ g.Expect(CreateTimerKamelet(t, ctx, operatorDevID, nsDev, "my-own-timer-source")()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorDevID, nsDev, "./files/timer-kamelet-usage.groovy").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, nsDev, "timer-kamelet-usage"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, nsDev, "timer-kamelet-usage"), TestTimeoutShort).Should(ContainSubstring("Hello world"))
})
t.Run("binding dev", func(t *testing.T) {
- 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"))
+ g.Expect(CreateTimerKamelet(t, ctx, operatorDevID, nsDev, "kb-timer-source")()).To(Succeed())
+ g.Expect(KamelBindWithID(t, ctx, operatorDevID, nsDev, "kb-timer-source", "log:info", "-p", "source.message=my-kamelet-binding-rocks").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, nsDev, "kb-timer-source-to-log"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, nsDev, "kb-timer-source-to-log"), TestTimeoutShort).Should(ContainSubstring("my-kamelet-binding-rocks"))
})
// Prod environment namespace
- WithNewTestNamespace(t, func(g *WithT, nsProd string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, nsProd string) {
operatorProdID := "camel-k-cli-promote-prod"
- g.Expect(CopyCamelCatalog(t, nsProd, operatorProdID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, nsProd, operatorProdID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorProdID, nsProd)).To(Succeed())
- g.Eventually(PlatformPhase(t, nsProd), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, nsProd, operatorProdID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, nsProd, operatorProdID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorProdID, nsProd)).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, nsProd), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("no configmap in destination", func(t *testing.T) {
- g.Expect(Kamel(t, "promote", "-n", nsDev, "promote-route", "--to", nsProd).Execute()).NotTo(Succeed())
+ g.Expect(Kamel(t, ctx, "promote", "-n", nsDev, "promote-route", "--to", nsProd).Execute()).NotTo(Succeed())
})
// Prod content configmap
var cmData = make(map[string]string)
cmData["my-configmap-key"] = "I am production!"
- CreatePlainTextConfigmap(t, nsProd, "my-cm-promote", cmData)
+ CreatePlainTextConfigmap(t, ctx, nsProd, "my-cm-promote", cmData)
t.Run("no secret in destination", func(t *testing.T) {
- g.Expect(Kamel(t, "promote", "-n", nsDev, "promote-route", "--to", nsProd).Execute()).NotTo(Succeed())
+ g.Expect(Kamel(t, ctx, "promote", "-n", nsDev, "promote-route", "--to", nsProd).Execute()).NotTo(Succeed())
})
// Prod secret
var secData = make(map[string]string)
secData["my-secret-key"] = "very top secret production"
- CreatePlainTextSecret(t, nsProd, "my-sec-promote", secData)
+ CreatePlainTextSecret(t, ctx, nsProd, "my-sec-promote", secData)
t.Run("plain integration promotion", func(t *testing.T) {
- g.Expect(Kamel(t, "promote", "-n", nsDev, "promote-route", "--to", nsProd).Execute()).To(Succeed())
- g.Eventually(IntegrationObservedGeneration(t, nsProd, "promote-route")).Should(Equal(&one))
- g.Eventually(IntegrationPodPhase(t, nsProd, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, nsProd, "promote-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, nsProd, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am production!"))
- g.Eventually(IntegrationLogs(t, nsProd, "promote-route"), TestTimeoutShort).Should(ContainSubstring("very top secret production"))
+ g.Expect(Kamel(t, ctx, "promote", "-n", nsDev, "promote-route", "--to", nsProd).Execute()).To(Succeed())
+ g.Eventually(IntegrationObservedGeneration(t, ctx, nsProd, "promote-route")).Should(Equal(&one))
+ g.Eventually(IntegrationPodPhase(t, ctx, nsProd, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, nsProd, "promote-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, nsProd, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am production!"))
+ g.Eventually(IntegrationLogs(t, ctx, nsProd, "promote-route"), TestTimeoutShort).Should(ContainSubstring("very top secret production"))
// They must use the same image
- g.Expect(IntegrationPodImage(t, nsProd, "promote-route")()).Should(Equal(IntegrationPodImage(t, nsDev, "promote-route")()))
+ g.Expect(IntegrationPodImage(t, ctx, nsProd, "promote-route")()).Should(Equal(IntegrationPodImage(t, ctx, nsDev, "promote-route")()))
})
t.Run("plain integration promotion update", func(t *testing.T) {
// We need to update the Integration CR in order the operator to restart it both in dev and prod envs
- g.Expect(KamelRunWithID(t, operatorDevID, nsDev, "./files/promote-route-edited.groovy", "--name", "promote-route",
- "--config", "configmap:my-cm-promote").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorDevID, nsDev, "./files/promote-route-edited.groovy", "--name", "promote-route", "--config", "configmap:my-cm-promote").Execute()).To(Succeed())
// The generation has to be incremented
- g.Eventually(IntegrationObservedGeneration(t, nsDev, "promote-route")).Should(Equal(&two))
- g.Eventually(IntegrationPodPhase(t, nsDev, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, nsDev, "promote-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, nsDev, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am development configmap!"))
+ g.Eventually(IntegrationObservedGeneration(t, ctx, nsDev, "promote-route")).Should(Equal(&two))
+ g.Eventually(IntegrationPodPhase(t, ctx, nsDev, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, nsDev, "promote-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, nsDev, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am development configmap!"))
// Update the configmap only in prod
var cmData = make(map[string]string)
cmData["my-configmap-key"] = "I am production, but I was updated!"
- UpdatePlainTextConfigmap(t, nsProd, "my-cm-promote", cmData)
+ UpdatePlainTextConfigmap(t, ctx, nsProd, "my-cm-promote", cmData)
// Promote the edited Integration
- g.Expect(Kamel(t, "promote", "-n", nsDev, "promote-route", "--to", nsProd).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "promote", "-n", nsDev, "promote-route", "--to", nsProd).Execute()).To(Succeed())
// The generation has to be incremented also in prod
- g.Eventually(IntegrationObservedGeneration(t, nsDev, "promote-route")).Should(Equal(&two))
- g.Eventually(IntegrationPodPhase(t, nsProd, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, nsProd, "promote-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, nsProd, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am production, but I was updated!"))
+ g.Eventually(IntegrationObservedGeneration(t, ctx, nsDev, "promote-route")).Should(Equal(&two))
+ g.Eventually(IntegrationPodPhase(t, ctx, nsProd, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, nsProd, "promote-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, nsProd, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am production, but I was updated!"))
// They must use the same image
- g.Expect(IntegrationPodImage(t, nsProd, "promote-route")()).Should(Equal(IntegrationPodImage(t, nsDev, "promote-route")()))
+ g.Expect(IntegrationPodImage(t, ctx, nsProd, "promote-route")()).Should(Equal(IntegrationPodImage(t, ctx, nsDev, "promote-route")()))
})
t.Run("no kamelet in destination", func(t *testing.T) {
- g.Expect(Kamel(t, "promote", "-n", nsDev, "timer-kamelet-usage", "--to", nsProd).Execute()).NotTo(Succeed())
+ g.Expect(Kamel(t, ctx, "promote", "-n", nsDev, "timer-kamelet-usage", "--to", nsProd).Execute()).NotTo(Succeed())
})
t.Run("kamelet integration promotion", func(t *testing.T) {
- 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"))
+ g.Expect(CreateTimerKamelet(t, ctx, operatorProdID, nsProd, "my-own-timer-source")()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "promote", "-n", nsDev, "timer-kamelet-usage", "--to", nsProd).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, nsProd, "timer-kamelet-usage"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, nsProd, "timer-kamelet-usage"), TestTimeoutShort).Should(ContainSubstring("Hello world"))
// They must use the same image
- g.Expect(IntegrationPodImage(t, nsProd, "timer-kamelet-usage")()).Should(Equal(IntegrationPodImage(t, nsDev, "timer-kamelet-usage")()))
+ g.Expect(IntegrationPodImage(t, ctx, nsProd, "timer-kamelet-usage")()).Should(Equal(IntegrationPodImage(t, ctx, nsDev, "timer-kamelet-usage")()))
})
t.Run("no kamelet for binding in destination", func(t *testing.T) {
- g.Expect(Kamel(t, "promote", "-n", nsDev, "kb-timer-source-to-log", "--to", nsProd).Execute()).NotTo(Succeed())
+ g.Expect(Kamel(t, ctx, "promote", "-n", nsDev, "kb-timer-source-to-log", "--to", nsProd).Execute()).NotTo(Succeed())
})
t.Run("binding promotion", func(t *testing.T) {
- 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"))
+ g.Expect(CreateTimerKamelet(t, ctx, operatorProdID, nsProd, "kb-timer-source")()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "promote", "-n", nsDev, "kb-timer-source-to-log", "--to", nsProd).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, nsProd, "kb-timer-source-to-log"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, nsProd, "kb-timer-source-to-log"), TestTimeoutShort).Should(ContainSubstring("my-kamelet-binding-rocks"))
// They must use the same image
- g.Expect(IntegrationPodImage(t, nsProd, "kb-timer-source-to-log")()).Should(Equal(IntegrationPodImage(t, nsDev, "kb-timer-source-to-log")()))
+ g.Expect(IntegrationPodImage(t, ctx, nsProd, "kb-timer-source-to-log")()).Should(Equal(IntegrationPodImage(t, ctx, nsDev, "kb-timer-source-to-log")()))
//Binding update
- g.Expect(KamelBindWithID(t, operatorDevID, nsDev, "kb-timer-source", "log:info", "-p", "source.message=my-kamelet-binding-rocks-again").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-again"))
- 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-again"))
+ g.Expect(KamelBindWithID(t, ctx, operatorDevID, nsDev, "kb-timer-source", "log:info", "-p", "source.message=my-kamelet-binding-rocks-again").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, nsDev, "kb-timer-source-to-log"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, nsDev, "kb-timer-source-to-log"), TestTimeoutShort).Should(ContainSubstring("my-kamelet-binding-rocks-again"))
+ g.Expect(Kamel(t, ctx, "promote", "-n", nsDev, "kb-timer-source-to-log", "--to", nsProd).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, nsProd, "kb-timer-source-to-log"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, nsProd, "kb-timer-source-to-log"), TestTimeoutShort).Should(ContainSubstring("my-kamelet-binding-rocks-again"))
})
})
})
diff --git a/e2e/advanced/reset_test.go b/e2e/advanced/reset_test.go
index 6b0773dc8..8724addcd 100644
--- a/e2e/advanced/reset_test.go
+++ b/e2e/advanced/reset_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -35,60 +36,60 @@ import (
func TestKamelReset(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-cli-reset"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Reset the whole platform", func(t *testing.T) {
name := RandomizedSuffixName("yaml1")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(Kit(t, ns, IntegrationKit(t, ns, name)())).Should(Not(BeNil()))
- g.Eventually(Integration(t, ns, name)).Should(Not(BeNil()))
+ g.Eventually(Kit(t, ctx, ns, IntegrationKit(t, ctx, ns, name)())).Should(Not(BeNil()))
+ g.Eventually(Integration(t, ctx, ns, name)).Should(Not(BeNil()))
- g.Expect(Kamel(t, "reset", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "reset", "-n", ns).Execute()).To(Succeed())
- g.Expect(Integration(t, ns, name)()).To(BeNil())
- g.Expect(Kits(t, ns)()).To(HaveLen(0))
+ g.Expect(Integration(t, ctx, ns, name)()).To(BeNil())
+ g.Expect(Kits(t, ctx, ns)()).To(HaveLen(0))
})
t.Run("Reset skip-integrations", func(t *testing.T) {
name := RandomizedSuffixName("yaml2")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(Kit(t, ns, IntegrationKit(t, ns, name)())).Should(Not(BeNil()))
- g.Eventually(Integration(t, ns, name)).Should(Not(BeNil()))
+ g.Eventually(Kit(t, ctx, ns, IntegrationKit(t, ctx, ns, name)())).Should(Not(BeNil()))
+ g.Eventually(Integration(t, ctx, ns, name)).Should(Not(BeNil()))
- g.Expect(Kamel(t, "reset", "-n", ns, "--skip-integrations").Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "reset", "-n", ns, "--skip-integrations").Execute()).To(Succeed())
- g.Expect(Integration(t, ns, name)()).To(Not(BeNil()))
- g.Expect(Kits(t, ns)()).To(HaveLen(0))
+ g.Expect(Integration(t, ctx, ns, name)()).To(Not(BeNil()))
+ g.Expect(Kits(t, ctx, ns)()).To(HaveLen(0))
})
t.Run("Reset skip-kits", func(t *testing.T) {
name := RandomizedSuffixName("yaml3")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- kitName := IntegrationKit(t, ns, name)()
- g.Eventually(Kit(t, ns, kitName)).Should(Not(BeNil()))
- g.Eventually(Integration(t, ns, name)).Should(Not(BeNil()))
+ kitName := IntegrationKit(t, ctx, ns, name)()
+ g.Eventually(Kit(t, ctx, ns, kitName)).Should(Not(BeNil()))
+ g.Eventually(Integration(t, ctx, ns, name)).Should(Not(BeNil()))
- g.Expect(Kamel(t, "reset", "-n", ns, "--skip-kits").Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "reset", "-n", ns, "--skip-kits").Execute()).To(Succeed())
- g.Expect(Integration(t, ns, name)()).To(BeNil())
- g.Expect(Kit(t, ns, kitName)()).To(Not(BeNil()))
+ g.Expect(Integration(t, ctx, ns, name)()).To(BeNil())
+ g.Expect(Kit(t, ctx, ns, kitName)()).To(Not(BeNil()))
})
// Clean up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/advanced/synthetic_test.go b/e2e/advanced/synthetic_test.go
index f6282dd0a..4ed0d8413 100644
--- a/e2e/advanced/synthetic_test.go
+++ b/e2e/advanced/synthetic_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -37,17 +38,17 @@ import (
func TestSyntheticIntegrationOff(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
// Install Camel K without synthetic Integration feature variable (default)
operatorID := "camel-k-synthetic-env-off"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
// Run the external deployment
ExpectExecSucceed(t, g, Kubectl("apply", "-f", "files/deploy.yaml", "-n", ns))
- g.Eventually(DeploymentCondition(t, ns, "my-camel-sb-svc", appsv1.DeploymentProgressing), TestTimeoutShort).
+ g.Eventually(DeploymentCondition(t, ctx, ns, "my-camel-sb-svc", appsv1.DeploymentProgressing), TestTimeoutShort).
Should(MatchFields(IgnoreExtras, Fields{
"Status": Equal(corev1.ConditionTrue),
"Reason": Equal("NewReplicaSetAvailable"),
@@ -55,24 +56,24 @@ func TestSyntheticIntegrationOff(t *testing.T) {
// Label the deployment --> Verify the Integration is not created
ExpectExecSucceed(t, g, Kubectl("label", "deploy", "my-camel-sb-svc", "camel.apache.org/integration=my-it", "-n", ns))
- g.Eventually(Integration(t, ns, "my-it"), TestTimeoutShort).Should(BeNil())
+ g.Eventually(Integration(t, ctx, ns, "my-it"), TestTimeoutShort).Should(BeNil())
})
}
func TestSyntheticIntegrationFromDeployment(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
// Install Camel K with the synthetic Integration feature variable
operatorID := "camel-k-synthetic-env"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns,
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns,
"--operator-env-vars", "CAMEL_K_SYNTHETIC_INTEGRATIONS=true",
)).To(Succeed())
// Run the external deployment
ExpectExecSucceed(t, g, Kubectl("apply", "-f", "files/deploy.yaml", "-n", ns))
- g.Eventually(DeploymentCondition(t, ns, "my-camel-sb-svc", appsv1.DeploymentProgressing), TestTimeoutShort).
+ g.Eventually(DeploymentCondition(t, ctx, ns, "my-camel-sb-svc", appsv1.DeploymentProgressing), TestTimeoutShort).
Should(MatchFields(IgnoreExtras, Fields{
"Status": Equal(corev1.ConditionTrue),
"Reason": Equal("NewReplicaSetAvailable"),
@@ -80,47 +81,47 @@ func TestSyntheticIntegrationFromDeployment(t *testing.T) {
// Label the deployment --> Verify the Integration is created (cannot still monitor)
ExpectExecSucceed(t, g, Kubectl("label", "deploy", "my-camel-sb-svc", "camel.apache.org/integration=my-it", "-n", ns))
- g.Eventually(IntegrationPhase(t, ns, "my-it"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "my-it", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
- g.Eventually(IntegrationCondition(t, ns, "my-it", v1.IntegrationConditionReady), TestTimeoutShort).Should(
+ g.Eventually(IntegrationPhase(t, ctx, ns, "my-it"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "my-it", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
+ g.Eventually(IntegrationCondition(t, ctx, ns, "my-it", v1.IntegrationConditionReady), TestTimeoutShort).Should(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionMonitoringPodsAvailableReason)))
// Label the deployment template --> Verify the Integration is monitored
ExpectExecSucceed(t, g, Kubectl("patch", "deployment", "my-camel-sb-svc", "--patch", `{"spec": {"template": {"metadata": {"labels": {"camel.apache.org/integration": "my-it"}}}}}`, "-n", ns))
- g.Eventually(IntegrationPhase(t, ns, "my-it"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "my-it", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPhase(t, ctx, ns, "my-it"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "my-it", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
one := int32(1)
- g.Eventually(IntegrationStatusReplicas(t, ns, "my-it"), TestTimeoutShort).Should(Equal(&one))
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, "my-it"), TestTimeoutShort).Should(Equal(&one))
// Delete the deployment --> Verify the Integration is eventually garbage collected
ExpectExecSucceed(t, g, Kubectl("delete", "deploy", "my-camel-sb-svc", "-n", ns))
- g.Eventually(Integration(t, ns, "my-it"), TestTimeoutShort).Should(BeNil())
+ g.Eventually(Integration(t, ctx, ns, "my-it"), TestTimeoutShort).Should(BeNil())
// Recreate the deployment and label --> Verify the Integration is monitored
ExpectExecSucceed(t, g, Kubectl("apply", "-f", "files/deploy.yaml", "-n", ns))
ExpectExecSucceed(t, g, Kubectl("label", "deploy", "my-camel-sb-svc", "camel.apache.org/integration=my-it", "-n", ns))
ExpectExecSucceed(t, g, Kubectl("patch", "deployment", "my-camel-sb-svc", "--patch", `{"spec": {"template": {"metadata": {"labels": {"camel.apache.org/integration": "my-it"}}}}}`, "-n", ns))
- g.Eventually(IntegrationPhase(t, ns, "my-it"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "my-it", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationStatusReplicas(t, ns, "my-it"), TestTimeoutShort).Should(Equal(&one))
+ g.Eventually(IntegrationPhase(t, ctx, ns, "my-it"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "my-it", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, "my-it"), TestTimeoutShort).Should(Equal(&one))
// Remove label from the deployment --> Verify the Integration is deleted
ExpectExecSucceed(t, g, Kubectl("label", "deploy", "my-camel-sb-svc", "camel.apache.org/integration-", "-n", ns))
- g.Eventually(Integration(t, ns, "my-it"), TestTimeoutShort).Should(BeNil())
+ g.Eventually(Integration(t, ctx, ns, "my-it"), TestTimeoutShort).Should(BeNil())
// Add label back to the deployment --> Verify the Integration is created
ExpectExecSucceed(t, g, Kubectl("label", "deploy", "my-camel-sb-svc", "camel.apache.org/integration=my-it", "-n", ns))
- g.Eventually(IntegrationPhase(t, ns, "my-it"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "my-it", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationStatusReplicas(t, ns, "my-it"), TestTimeoutShort).Should(Equal(&one))
+ g.Eventually(IntegrationPhase(t, ctx, ns, "my-it"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "my-it", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, "my-it"), TestTimeoutShort).Should(Equal(&one))
// Scale the deployment --> verify replicas are correctly set
ExpectExecSucceed(t, g, Kubectl("scale", "deploy", "my-camel-sb-svc", "--replicas", "2", "-n", ns))
two := int32(2)
- g.Eventually(IntegrationStatusReplicas(t, ns, "my-it"), TestTimeoutShort).Should(Equal(&two))
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, "my-it"), TestTimeoutShort).Should(Equal(&two))
// Delete Integration and deployments --> verify no Integration exists any longer
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
ExpectExecSucceed(t, g, Kubectl("delete", "deploy", "my-camel-sb-svc", "-n", ns))
- g.Eventually(Integration(t, ns, "my-it"), TestTimeoutShort).Should(BeNil())
+ g.Eventually(Integration(t, ctx, ns, "my-it"), TestTimeoutShort).Should(BeNil())
})
}
diff --git a/e2e/advanced/tekton_test.go b/e2e/advanced/tekton_test.go
index 448f4c7e0..6edb89744 100644
--- a/e2e/advanced/tekton_test.go
+++ b/e2e/advanced/tekton_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package advanced
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -35,14 +36,14 @@ import (
func TestTektonLikeBehavior(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
- g.Expect(CreateOperatorServiceAccount(t, ns)).To(Succeed())
- g.Expect(CreateOperatorRole(t, ns)).To(Succeed())
- g.Expect(CreateOperatorRoleBinding(t, ns)).To(Succeed())
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ g.Expect(CreateOperatorServiceAccount(t, ctx, ns)).To(Succeed())
+ g.Expect(CreateOperatorRole(t, ctx, ns)).To(Succeed())
+ g.Expect(CreateOperatorRoleBinding(t, ctx, ns)).To(Succeed())
- g.Eventually(OperatorPod(t, ns)).Should(BeNil())
- g.Expect(CreateKamelPod(t, ns, "tekton-task", "install", "--skip-cluster-setup", "--force")).To(Succeed())
+ g.Eventually(OperatorPod(t, ctx, ns)).Should(BeNil())
+ g.Expect(CreateKamelPod(t, ctx, ns, "tekton-task", "install", "--skip-cluster-setup", "--force")).To(Succeed())
- g.Eventually(OperatorPod(t, ns)).ShouldNot(BeNil())
+ g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
})
}
diff --git a/e2e/builder/build_test.go b/e2e/builder/build_test.go
index 7aed010f9..0ed06c7e0 100644
--- a/e2e/builder/build_test.go
+++ b/e2e/builder/build_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package builder
import (
+ "context"
"errors"
"fmt"
"testing"
@@ -42,14 +43,14 @@ type kitOptions struct {
}
func TestKitMaxBuildLimit(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
- createOperator(t, g, ns, "8m0s", "--global", "--force")
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ createOperator(t, ctx, g, ns, "8m0s", "--global", "--force")
- pl := Platform(t, ns)()
+ pl := Platform(t, ctx, ns)()
// set maximum number of running builds and order strategy
pl.Spec.Build.MaxRunningBuilds = 2
pl.Spec.Build.BuildConfiguration.OrderStrategy = v1.BuildOrderStrategySequential
- if err := TestClient(t).Update(TestContext, pl); err != nil {
+ if err := TestClient(t).Update(ctx, pl); err != nil {
t.Error(err)
t.FailNow()
}
@@ -58,31 +59,31 @@ func TestKitMaxBuildLimit(t *testing.T) {
buildB := "integration-b"
buildC := "integration-c"
- WithNewTestNamespace(t, func(g *WithT, ns1 string) {
- WithNewTestNamespace(t, func(g *WithT, ns2 string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns1 string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns2 string) {
pl1 := v1.NewIntegrationPlatform(ns1, fmt.Sprintf("camel-k-%s", ns))
pl.Spec.DeepCopyInto(&pl1.Spec)
pl1.Spec.Build.Maven.Settings = v1.ValueSource{}
pl1.SetOperatorID(fmt.Sprintf("camel-k-%s", ns))
- if err := TestClient(t).Create(TestContext, &pl1); err != nil {
+ if err := TestClient(t).Create(ctx, &pl1); err != nil {
t.Error(err)
t.FailNow()
}
- g.Eventually(PlatformPhase(t, ns1), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(PlatformPhase(t, ctx, ns1), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
pl2 := v1.NewIntegrationPlatform(ns2, fmt.Sprintf("camel-k-%s", ns))
pl.Spec.DeepCopyInto(&pl2.Spec)
pl2.Spec.Build.Maven.Settings = v1.ValueSource{}
pl2.SetOperatorID(fmt.Sprintf("camel-k-%s", ns))
- if err := TestClient(t).Create(TestContext, &pl2); err != nil {
+ if err := TestClient(t).Create(ctx, &pl2); err != nil {
t.Error(err)
t.FailNow()
}
- g.Eventually(PlatformPhase(t, ns2), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(PlatformPhase(t, ctx, ns2), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- doKitBuildInNamespace(t, g, buildA, ns, TestTimeoutShort, kitOptions{
+ doKitBuildInNamespace(t, ctx, g, buildA, ns, TestTimeoutShort, kitOptions{
operatorID: fmt.Sprintf("camel-k-%s", ns),
dependencies: []string{
"camel:timer", "camel:log",
@@ -92,7 +93,7 @@ func TestKitMaxBuildLimit(t *testing.T) {
},
}, v1.BuildPhaseRunning, v1.IntegrationKitPhaseBuildRunning)
- doKitBuildInNamespace(t, g, buildB, ns1, TestTimeoutShort, kitOptions{
+ doKitBuildInNamespace(t, ctx, g, buildB, ns1, TestTimeoutShort, kitOptions{
operatorID: fmt.Sprintf("camel-k-%s", ns),
dependencies: []string{
"camel:timer", "camel:log",
@@ -102,7 +103,7 @@ func TestKitMaxBuildLimit(t *testing.T) {
},
}, v1.BuildPhaseRunning, v1.IntegrationKitPhaseBuildRunning)
- doKitBuildInNamespace(t, g, buildC, ns2, TestTimeoutShort, kitOptions{
+ doKitBuildInNamespace(t, ctx, g, buildC, ns2, TestTimeoutShort, kitOptions{
operatorID: fmt.Sprintf("camel-k-%s", ns),
dependencies: []string{
"camel:timer", "camel:log",
@@ -117,41 +118,41 @@ func TestKitMaxBuildLimit(t *testing.T) {
}
limit := 0
- for limit < 5 && BuildPhase(t, ns, buildA)() == v1.BuildPhaseRunning {
+ for limit < 5 && BuildPhase(t, ctx, ns, buildA)() == v1.BuildPhaseRunning {
// verify that number of running builds does not exceed max build limit
- g.Consistently(BuildsRunning(BuildPhase(t, ns, buildA), BuildPhase(t, ns1, buildB), BuildPhase(t, ns2, buildC)), TestTimeoutShort, 10*time.Second).Should(Satisfy(notExceedsMaxBuildLimit))
+ g.Consistently(BuildsRunning(BuildPhase(t, ctx, ns, buildA), BuildPhase(t, ctx, ns1, buildB), BuildPhase(t, ctx, ns2, buildC)), TestTimeoutShort, 10*time.Second).Should(Satisfy(notExceedsMaxBuildLimit))
limit++
}
// make sure we have verified max build limit at least once
if limit == 0 {
- t.Error(errors.New(fmt.Sprintf("Unexpected build phase '%s' for %s - not able to verify max builds limit", BuildPhase(t, ns, buildA)(), buildA)))
+ t.Error(errors.New(fmt.Sprintf("Unexpected build phase '%s' for %s - not able to verify max builds limit", BuildPhase(t, ctx, ns, buildA)(), buildA)))
t.FailNow()
}
// verify that all builds are successful
- g.Eventually(BuildPhase(t, ns, buildA), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(KitPhase(t, ns, buildA), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
+ g.Eventually(BuildPhase(t, ctx, ns, buildA), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(KitPhase(t, ctx, ns, buildA), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
- g.Eventually(BuildPhase(t, ns1, buildB), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(KitPhase(t, ns1, buildB), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
+ g.Eventually(BuildPhase(t, ctx, ns1, buildB), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(KitPhase(t, ctx, ns1, buildB), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
- g.Eventually(BuildPhase(t, ns2, buildC), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(KitPhase(t, ns2, buildC), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
+ g.Eventually(BuildPhase(t, ctx, ns2, buildC), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(KitPhase(t, ctx, ns2, buildC), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
})
})
})
}
func TestKitMaxBuildLimitFIFOStrategy(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
- createOperator(t, g, ns, "8m0s", "--global", "--force")
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ createOperator(t, ctx, g, ns, "8m0s", "--global", "--force")
- pl := Platform(t, ns)()
+ pl := Platform(t, ctx, ns)()
// set maximum number of running builds and order strategy
pl.Spec.Build.MaxRunningBuilds = 2
pl.Spec.Build.BuildConfiguration.OrderStrategy = v1.BuildOrderStrategyFIFO
- if err := TestClient(t).Update(TestContext, pl); err != nil {
+ if err := TestClient(t).Update(ctx, pl); err != nil {
t.Error(err)
t.FailNow()
}
@@ -160,7 +161,7 @@ func TestKitMaxBuildLimitFIFOStrategy(t *testing.T) {
buildB := "integration-b"
buildC := "integration-c"
- doKitBuildInNamespace(t, g, buildA, ns, TestTimeoutShort, kitOptions{
+ doKitBuildInNamespace(t, ctx, g, buildA, ns, TestTimeoutShort, kitOptions{
operatorID: fmt.Sprintf("camel-k-%s", ns),
dependencies: []string{
"camel:timer", "camel:log",
@@ -170,7 +171,7 @@ func TestKitMaxBuildLimitFIFOStrategy(t *testing.T) {
},
}, v1.BuildPhaseRunning, v1.IntegrationKitPhaseBuildRunning)
- doKitBuildInNamespace(t, g, buildB, ns, TestTimeoutShort, kitOptions{
+ doKitBuildInNamespace(t, ctx, g, buildB, ns, TestTimeoutShort, kitOptions{
operatorID: fmt.Sprintf("camel-k-%s", ns),
dependencies: []string{
"camel:timer", "camel:log",
@@ -180,7 +181,7 @@ func TestKitMaxBuildLimitFIFOStrategy(t *testing.T) {
},
}, v1.BuildPhaseRunning, v1.IntegrationKitPhaseBuildRunning)
- doKitBuildInNamespace(t, g, buildC, ns, TestTimeoutShort, kitOptions{
+ doKitBuildInNamespace(t, ctx, g, buildC, ns, TestTimeoutShort, kitOptions{
operatorID: fmt.Sprintf("camel-k-%s", ns),
dependencies: []string{
"camel:timer", "camel:log",
@@ -195,37 +196,37 @@ func TestKitMaxBuildLimitFIFOStrategy(t *testing.T) {
}
limit := 0
- for limit < 5 && BuildPhase(t, ns, buildA)() == v1.BuildPhaseRunning {
+ for limit < 5 && BuildPhase(t, ctx, ns, buildA)() == v1.BuildPhaseRunning {
// verify that number of running builds does not exceed max build limit
- g.Consistently(BuildsRunning(BuildPhase(t, ns, buildA), BuildPhase(t, ns, buildB), BuildPhase(t, ns, buildC)), TestTimeoutShort, 10*time.Second).Should(Satisfy(notExceedsMaxBuildLimit))
+ g.Consistently(BuildsRunning(BuildPhase(t, ctx, ns, buildA), BuildPhase(t, ctx, ns, buildB), BuildPhase(t, ctx, ns, buildC)), TestTimeoutShort, 10*time.Second).Should(Satisfy(notExceedsMaxBuildLimit))
limit++
}
// make sure we have verified max build limit at least once
if limit == 0 {
- t.Error(errors.New(fmt.Sprintf("Unexpected build phase '%s' for %s - not able to verify max builds limit", BuildPhase(t, ns, buildA)(), buildA)))
+ t.Error(errors.New(fmt.Sprintf("Unexpected build phase '%s' for %s - not able to verify max builds limit", BuildPhase(t, ctx, ns, buildA)(), buildA)))
t.FailNow()
}
// verify that all builds are successful
- g.Eventually(BuildPhase(t, ns, buildA), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(KitPhase(t, ns, buildA), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
- g.Eventually(BuildPhase(t, ns, buildB), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(KitPhase(t, ns, buildB), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
- g.Eventually(BuildPhase(t, ns, buildC), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(KitPhase(t, ns, buildC), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
+ g.Eventually(BuildPhase(t, ctx, ns, buildA), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(KitPhase(t, ctx, ns, buildA), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
+ g.Eventually(BuildPhase(t, ctx, ns, buildB), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(KitPhase(t, ctx, ns, buildB), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
+ g.Eventually(BuildPhase(t, ctx, ns, buildC), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(KitPhase(t, ctx, ns, buildC), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
})
}
func TestKitMaxBuildLimitDependencyMatchingStrategy(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
- createOperator(t, g, ns, "8m0s", "--global", "--force")
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ createOperator(t, ctx, g, ns, "8m0s", "--global", "--force")
- pl := Platform(t, ns)()
+ pl := Platform(t, ctx, ns)()
// set maximum number of running builds and order strategy
pl.Spec.Build.MaxRunningBuilds = 2
pl.Spec.Build.BuildConfiguration.OrderStrategy = v1.BuildOrderStrategyDependencies
- if err := TestClient(t).Update(TestContext, pl); err != nil {
+ if err := TestClient(t).Update(ctx, pl); err != nil {
t.Error(err)
t.FailNow()
}
@@ -234,7 +235,7 @@ func TestKitMaxBuildLimitDependencyMatchingStrategy(t *testing.T) {
buildB := "integration-b"
buildC := "integration-c"
- doKitBuildInNamespace(t, g, buildA, ns, TestTimeoutShort, kitOptions{
+ doKitBuildInNamespace(t, ctx, g, buildA, ns, TestTimeoutShort, kitOptions{
operatorID: fmt.Sprintf("camel-k-%s", ns),
dependencies: []string{
"camel:timer", "camel:log",
@@ -244,7 +245,7 @@ func TestKitMaxBuildLimitDependencyMatchingStrategy(t *testing.T) {
},
}, v1.BuildPhaseRunning, v1.IntegrationKitPhaseBuildRunning)
- doKitBuildInNamespace(t, g, buildB, ns, TestTimeoutShort, kitOptions{
+ doKitBuildInNamespace(t, ctx, g, buildB, ns, TestTimeoutShort, kitOptions{
operatorID: fmt.Sprintf("camel-k-%s", ns),
dependencies: []string{
"camel:cron", "camel:log", "camel:joor",
@@ -254,7 +255,7 @@ func TestKitMaxBuildLimitDependencyMatchingStrategy(t *testing.T) {
},
}, v1.BuildPhaseRunning, v1.IntegrationKitPhaseBuildRunning)
- doKitBuildInNamespace(t, g, buildC, ns, TestTimeoutShort, kitOptions{
+ doKitBuildInNamespace(t, ctx, g, buildC, ns, TestTimeoutShort, kitOptions{
operatorID: fmt.Sprintf("camel-k-%s", ns),
dependencies: []string{
"camel:timer", "camel:log", "camel:joor", "camel:http",
@@ -269,37 +270,37 @@ func TestKitMaxBuildLimitDependencyMatchingStrategy(t *testing.T) {
}
limit := 0
- for limit < 5 && BuildPhase(t, ns, buildA)() == v1.BuildPhaseRunning {
+ for limit < 5 && BuildPhase(t, ctx, ns, buildA)() == v1.BuildPhaseRunning {
// verify that number of running builds does not exceed max build limit
- g.Consistently(BuildsRunning(BuildPhase(t, ns, buildA), BuildPhase(t, ns, buildB), BuildPhase(t, ns, buildC)), TestTimeoutShort, 10*time.Second).Should(Satisfy(notExceedsMaxBuildLimit))
+ g.Consistently(BuildsRunning(BuildPhase(t, ctx, ns, buildA), BuildPhase(t, ctx, ns, buildB), BuildPhase(t, ctx, ns, buildC)), TestTimeoutShort, 10*time.Second).Should(Satisfy(notExceedsMaxBuildLimit))
limit++
}
// make sure we have verified max build limit at least once
if limit == 0 {
- t.Error(errors.New(fmt.Sprintf("Unexpected build phase '%s' for %s - not able to verify max builds limit", BuildPhase(t, ns, buildA)(), buildA)))
+ t.Error(errors.New(fmt.Sprintf("Unexpected build phase '%s' for %s - not able to verify max builds limit", BuildPhase(t, ctx, ns, buildA)(), buildA)))
t.FailNow()
}
// verify that all builds are successful
- g.Eventually(BuildPhase(t, ns, buildA), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(KitPhase(t, ns, buildA), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
- g.Eventually(BuildPhase(t, ns, buildB), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(KitPhase(t, ns, buildB), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
- g.Eventually(BuildPhase(t, ns, buildC), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(KitPhase(t, ns, buildC), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
+ g.Eventually(BuildPhase(t, ctx, ns, buildA), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(KitPhase(t, ctx, ns, buildA), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
+ g.Eventually(BuildPhase(t, ctx, ns, buildB), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(KitPhase(t, ctx, ns, buildB), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
+ g.Eventually(BuildPhase(t, ctx, ns, buildC), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(KitPhase(t, ctx, ns, buildC), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
})
}
func TestMaxBuildLimitWaitingBuilds(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
- createOperator(t, g, ns, "8m0s", "--global", "--force")
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ createOperator(t, ctx, g, ns, "8m0s", "--global", "--force")
- pl := Platform(t, ns)()
+ pl := Platform(t, ctx, ns)()
// set maximum number of running builds and order strategy
pl.Spec.Build.MaxRunningBuilds = 1
pl.Spec.Build.BuildConfiguration.OrderStrategy = v1.BuildOrderStrategyFIFO
- if err := TestClient(t).Update(TestContext, pl); err != nil {
+ if err := TestClient(t).Update(ctx, pl); err != nil {
t.Error(err)
t.FailNow()
}
@@ -308,7 +309,7 @@ func TestMaxBuildLimitWaitingBuilds(t *testing.T) {
buildB := "integration-b"
buildC := "integration-c"
- doKitBuildInNamespace(t, g, buildA, ns, TestTimeoutShort, kitOptions{
+ doKitBuildInNamespace(t, ctx, g, buildA, ns, TestTimeoutShort, kitOptions{
operatorID: fmt.Sprintf("camel-k-%s", ns),
dependencies: []string{
"camel:timer", "camel:log",
@@ -318,7 +319,7 @@ func TestMaxBuildLimitWaitingBuilds(t *testing.T) {
},
}, v1.BuildPhaseRunning, v1.IntegrationKitPhaseBuildRunning)
- doKitBuildInNamespace(t, g, buildB, ns, TestTimeoutShort, kitOptions{
+ doKitBuildInNamespace(t, ctx, g, buildB, ns, TestTimeoutShort, kitOptions{
operatorID: fmt.Sprintf("camel-k-%s", ns),
dependencies: []string{
"camel:cron", "camel:log", "camel:joor",
@@ -328,7 +329,7 @@ func TestMaxBuildLimitWaitingBuilds(t *testing.T) {
},
}, v1.BuildPhaseScheduling, v1.IntegrationKitPhaseNone)
- doKitBuildInNamespace(t, g, buildC, ns, TestTimeoutShort, kitOptions{
+ doKitBuildInNamespace(t, ctx, g, buildC, ns, TestTimeoutShort, kitOptions{
operatorID: fmt.Sprintf("camel-k-%s", ns),
dependencies: []string{
"camel:timer", "camel:log", "camel:joor", "camel:http",
@@ -339,24 +340,24 @@ func TestMaxBuildLimitWaitingBuilds(t *testing.T) {
}, v1.BuildPhaseScheduling, v1.IntegrationKitPhaseNone)
// verify that last build is waiting
- g.Eventually(BuildConditions(t, ns, buildC), TestTimeoutMedium).ShouldNot(BeNil())
+ g.Eventually(BuildConditions(t, ctx, ns, buildC), TestTimeoutMedium).ShouldNot(BeNil())
g.Eventually(
- BuildCondition(t, ns, buildC, v1.BuildConditionType(v1.BuildConditionScheduled))().Status,
+ BuildCondition(t, ctx, ns, buildC, v1.BuildConditionType(v1.BuildConditionScheduled))().Status,
TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
g.Eventually(
- BuildCondition(t, ns, buildC, v1.BuildConditionType(v1.BuildConditionScheduled))().Reason,
+ BuildCondition(t, ctx, ns, buildC, v1.BuildConditionType(v1.BuildConditionScheduled))().Reason,
TestTimeoutShort).Should(Equal(v1.BuildConditionWaitingReason))
// verify that last build is scheduled
- g.Eventually(BuildPhase(t, ns, buildC), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
- g.Eventually(KitPhase(t, ns, buildC), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
+ g.Eventually(BuildPhase(t, ctx, ns, buildC), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded))
+ g.Eventually(KitPhase(t, ctx, ns, buildC), TestTimeoutLong).Should(Equal(v1.IntegrationKitPhaseReady))
- g.Eventually(BuildConditions(t, ns, buildC), TestTimeoutLong).ShouldNot(BeNil())
+ g.Eventually(BuildConditions(t, ctx, ns, buildC), TestTimeoutLong).ShouldNot(BeNil())
g.Eventually(
- BuildCondition(t, ns, buildC, v1.BuildConditionType(v1.BuildConditionScheduled))().Status,
+ BuildCondition(t, ctx, ns, buildC, v1.BuildConditionType(v1.BuildConditionScheduled))().Status,
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
g.Eventually(
- BuildCondition(t, ns, buildC, v1.BuildConditionType(v1.BuildConditionScheduled))().Reason,
+ BuildCondition(t, ctx, ns, buildC, v1.BuildConditionType(v1.BuildConditionScheduled))().Reason,
TestTimeoutShort).Should(Equal(v1.BuildConditionReadyReason))
})
}
@@ -392,22 +393,22 @@ func doKitFullBuild(t *testing.T, name string, buildTimeout string, testTimeout
options kitOptions, buildPhase v1.BuildPhase, kitPhase v1.IntegrationKitPhase) {
t.Helper()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
- createOperator(t, g, ns, buildTimeout)
- doKitBuildInNamespace(t, g, name, ns, testTimeout, options, buildPhase, kitPhase)
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ createOperator(t, ctx, g, ns, buildTimeout)
+ doKitBuildInNamespace(t, ctx, g, name, ns, testTimeout, options, buildPhase, kitPhase)
})
}
-func createOperator(t *testing.T, g *WithT, ns string, buildTimeout string, installArgs ...string) {
+func createOperator(t *testing.T, ctx context.Context, g *WithT, ns string, buildTimeout string, installArgs ...string) {
args := []string{"--build-timeout", buildTimeout}
args = append(args, installArgs...)
operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, operatorID, ns, args...)).To(Succeed())
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, args...)).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
}
-func doKitBuildInNamespace(t *testing.T, g *WithT, name string, ns string, testTimeout time.Duration, options kitOptions, buildPhase v1.BuildPhase, kitPhase v1.IntegrationKitPhase) {
+func doKitBuildInNamespace(t *testing.T, ctx context.Context, g *WithT, name string, ns string, testTimeout time.Duration, options kitOptions, buildPhase v1.BuildPhase, kitPhase v1.IntegrationKitPhase) {
buildKitArgs := []string{"kit", "create", name, "-n", ns}
for _, dependency := range options.dependencies {
@@ -423,13 +424,13 @@ func doKitBuildInNamespace(t *testing.T, g *WithT, name string, ns string, testT
buildKitArgs = append(buildKitArgs, "--operator-id", fmt.Sprintf("camel-k-%s", ns))
}
- g.Expect(Kamel(t, buildKitArgs...).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, buildKitArgs...).Execute()).To(Succeed())
- g.Eventually(Build(t, ns, name), testTimeout).ShouldNot(BeNil())
+ g.Eventually(Build(t, ctx, ns, name), testTimeout).ShouldNot(BeNil())
if buildPhase != v1.BuildPhaseNone {
- g.Eventually(BuildPhase(t, ns, name), testTimeout).Should(Equal(buildPhase))
+ g.Eventually(BuildPhase(t, ctx, ns, name), testTimeout).Should(Equal(buildPhase))
}
if kitPhase != v1.IntegrationKitPhaseNone {
- g.Eventually(KitPhase(t, ns, name), testTimeout).Should(Equal(kitPhase))
+ g.Eventually(KitPhase(t, ctx, ns, name), testTimeout).Should(Equal(kitPhase))
}
}
diff --git a/e2e/builder/registry_test.go b/e2e/builder/registry_test.go
index 653b94412..4eb413cb5 100644
--- a/e2e/builder/registry_test.go
+++ b/e2e/builder/registry_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package builder
import (
+ "context"
"os"
"testing"
@@ -41,21 +42,16 @@ func TestRunWithDockerHubRegistry(t *testing.T) {
return
}
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-docker-hub"
- g.Expect(KamelInstallWithID(t, operatorID, ns,
- "--registry", "docker.io",
- "--organization", user,
- "--registry-auth-username", user,
- "--registry-auth-password", pass,
- "--cluster-type", "kubernetes")).To(Succeed())
-
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/groovy.groovy").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "groovy"), TestTimeoutLong).Should(Equal(v1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(IntegrationPodImage(t, ns, "groovy"), TestTimeoutShort).Should(HavePrefix("docker.io"))
-
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--registry", "docker.io", "--organization", user, "--registry-auth-username", user, "--registry-auth-password", pass, "--cluster-type", "kubernetes")).To(Succeed())
+
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/groovy.groovy").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "groovy"), TestTimeoutLong).Should(Equal(v1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationPodImage(t, ctx, ns, "groovy"), TestTimeoutShort).Should(HavePrefix("docker.io"))
+
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
@@ -68,20 +64,15 @@ func TestRunWithGithubPackagesRegistry(t *testing.T) {
return
}
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-github-registry"
- g.Expect(KamelInstallWithID(t, operatorID, ns,
- "--registry", "docker.pkg.github.com",
- "--organization", repo,
- "--registry-auth-username", user,
- "--registry-auth-password", pass,
- "--cluster-type", "kubernetes")).To(Succeed())
-
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/groovy.groovy").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "groovy"), TestTimeoutLong).Should(Equal(v1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(IntegrationPodImage(t, ns, "groovy"), TestTimeoutShort).Should(HavePrefix("docker.pkg.github.com"))
-
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--registry", "docker.pkg.github.com", "--organization", repo, "--registry-auth-username", user, "--registry-auth-password", pass, "--cluster-type", "kubernetes")).To(Succeed())
+
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/groovy.groovy").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "groovy"), TestTimeoutLong).Should(Equal(v1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationPodImage(t, ctx, ns, "groovy"), TestTimeoutShort).Should(HavePrefix("docker.pkg.github.com"))
+
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/cli/bind_test.go b/e2e/common/cli/bind_test.go
index 6e45011c6..90daf7fdb 100644
--- a/e2e/common/cli/bind_test.go
+++ b/e2e/common/cli/bind_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package cli
import (
+ "context"
"testing"
corev1 "k8s.io/api/core/v1"
@@ -33,33 +34,33 @@ import (
)
func TestKamelCLIBind(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
kameletName := "test-timer-source"
- g.Expect(CreateTimerKamelet(t, operatorID, ns, kameletName)()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, 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())
- g.Eventually(IntegrationPodPhase(t, ns, "test-timer-source-to-log"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "test-timer-source-to-log")).Should(ContainSubstring("Body: helloTest"))
- g.Expect(KamelBindWithID(t, operatorID, ns, "test-timer-source", "log:info", "-p", "source.message=newText").Execute()).To(Succeed())
- g.Eventually(IntegrationLogs(t, ns, "test-timer-source-to-log")).Should(ContainSubstring("Body: newText"))
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, kameletName, "log:info", "-p", "source.message=helloTest").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "test-timer-source-to-log"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "test-timer-source-to-log")).Should(ContainSubstring("Body: helloTest"))
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "test-timer-source", "log:info", "-p", "source.message=newText").Execute()).To(Succeed())
+ g.Eventually(IntegrationLogs(t, ctx, ns, "test-timer-source-to-log")).Should(ContainSubstring("Body: newText"))
})
t.Run("unsuccessful binding, no property", func(t *testing.T) {
- g.Expect(KamelBindWithID(t, operatorID, ns, operatorNS+"/timer-source", "log:info").Execute()).NotTo(Succeed())
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, operatorNS+"/timer-source", "log:info").Execute()).NotTo(Succeed())
})
t.Run("bind uris", func(t *testing.T) {
- g.Expect(KamelBindWithID(t, operatorID, ns, "timer:foo", "log:bar").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "timer-to-log"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "timer-to-log")).Should(ContainSubstring("Body is null"))
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "timer:foo", "log:bar").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "timer-to-log"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "timer-to-log")).Should(ContainSubstring("Body is null"))
})
t.Run("bind with custom SA", func(t *testing.T) {
- g.Expect(KamelBindWithID(t, operatorID, ns, "timer:foo", "log:bar", "--service-account", "my-service-account").Execute()).To(Succeed())
- g.Eventually(IntegrationSpecSA(t, ns, "timer-to-log")).Should(Equal("my-service-account"))
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "timer:foo", "log:bar", "--service-account", "my-service-account").Execute()).To(Succeed())
+ g.Eventually(IntegrationSpecSA(t, ctx, ns, "timer-to-log")).Should(Equal("my-service-account"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/cli/config_test.go b/e2e/common/cli/config_test.go
index 46c2a560e..e29297616 100644
--- a/e2e/common/cli/config_test.go
+++ b/e2e/common/cli/config_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package cli
import (
+ "context"
"os"
"strings"
"testing"
@@ -39,30 +40,30 @@ import (
)
func TestKamelCLIConfig(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
t.Run("check default namespace", func(t *testing.T) {
_, err := os.Stat(cmd.DefaultConfigLocation)
assert.True(t, os.IsNotExist(err), "No file at "+cmd.DefaultConfigLocation+" was expected")
t.Cleanup(func() { os.Remove(cmd.DefaultConfigLocation) })
- g.Expect(Kamel(t, "config", "--default-namespace", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "config", "--default-namespace", ns).Execute()).To(Succeed())
_, err = os.Stat(cmd.DefaultConfigLocation)
require.NoError(t, err, "A file at "+cmd.DefaultConfigLocation+" was expected")
- g.Expect(Kamel(t, "run", "--operator-id", operatorID, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "run", "--operator-id", operatorID, "files/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).
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "yaml", v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// first line of the integration logs
- logs := strings.Split(IntegrationLogs(t, ns, "yaml")(), "\n")[0]
- podName := IntegrationPod(t, ns, "yaml")().Name
+ logs := strings.Split(IntegrationLogs(t, ctx, ns, "yaml")(), "\n")[0]
+ podName := IntegrationPod(t, ctx, ns, "yaml")().Name
- logsCLI := GetOutputStringAsync(Kamel(t, "log", "yaml"))
+ logsCLI := GetOutputStringAsync(Kamel(t, ctx, "log", "yaml"))
g.Eventually(logsCLI).Should(ContainSubstring("Monitoring pod " + podName))
g.Eventually(logsCLI).Should(ContainSubstring(logs))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/cli/delete_test.go b/e2e/common/cli/delete_test.go
index cba51eef2..2ed2aba0e 100644
--- a/e2e/common/cli/delete_test.go
+++ b/e2e/common/cli/delete_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package cli
import (
+ "context"
"testing"
corev1 "k8s.io/api/core/v1"
@@ -33,47 +34,47 @@ import (
)
func TestKamelCLIDelete(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
t.Run("delete running integration", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Expect(Kamel(t, "delete", "yaml", "-n", ns).Execute()).To(Succeed())
- g.Eventually(Integration(t, ns, "yaml")).Should(BeNil())
- g.Eventually(IntegrationPod(t, ns, "yaml"), TestTimeoutLong).Should(BeNil())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(Kamel(t, ctx, "delete", "yaml", "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, "yaml")).Should(BeNil())
+ g.Eventually(IntegrationPod(t, ctx, ns, "yaml"), TestTimeoutLong).Should(BeNil())
})
t.Run("delete building integration", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Expect(Kamel(t, "delete", "yaml", "-n", ns).Execute()).To(Succeed())
- g.Eventually(Integration(t, ns, "yaml")).Should(BeNil())
- g.Eventually(IntegrationPod(t, ns, "yaml"), TestTimeoutLong).Should(BeNil())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "yaml", "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, "yaml")).Should(BeNil())
+ g.Eventually(IntegrationPod(t, ctx, ns, "yaml"), TestTimeoutLong).Should(BeNil())
})
t.Run("delete several integrations", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPodPhase(t, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Expect(Kamel(t, "delete", "yaml", "-n", ns).Execute()).To(Succeed())
- g.Eventually(Integration(t, ns, "yaml")).Should(BeNil())
- g.Eventually(IntegrationPod(t, ns, "yaml"), TestTimeoutLong).Should(BeNil())
- g.Expect(Kamel(t, "delete", "java", "-n", ns).Execute()).To(Succeed())
- g.Eventually(Integration(t, ns, "java")).Should(BeNil())
- g.Eventually(IntegrationPod(t, ns, "java"), TestTimeoutLong).Should(BeNil())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(Kamel(t, ctx, "delete", "yaml", "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, "yaml")).Should(BeNil())
+ g.Eventually(IntegrationPod(t, ctx, ns, "yaml"), TestTimeoutLong).Should(BeNil())
+ g.Expect(Kamel(t, ctx, "delete", "java", "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, "java")).Should(BeNil())
+ g.Eventually(IntegrationPod(t, ctx, ns, "java"), TestTimeoutLong).Should(BeNil())
})
t.Run("delete all integrations", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPodPhase(t, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
- g.Eventually(Integration(t, ns, "yaml")).Should(BeNil())
- g.Eventually(IntegrationPod(t, ns, "yaml"), TestTimeoutLong).Should(BeNil())
- g.Eventually(Integration(t, ns, "java")).Should(BeNil())
- g.Eventually(IntegrationPod(t, ns, "java"), TestTimeoutLong).Should(BeNil())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, "yaml")).Should(BeNil())
+ g.Eventually(IntegrationPod(t, ctx, ns, "yaml"), TestTimeoutLong).Should(BeNil())
+ g.Eventually(Integration(t, ctx, ns, "java")).Should(BeNil())
+ g.Eventually(IntegrationPod(t, ctx, ns, "java"), TestTimeoutLong).Should(BeNil())
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/cli/describe_test.go b/e2e/common/cli/describe_test.go
index 8e5f6a562..f4cf6ce9b 100644
--- a/e2e/common/cli/describe_test.go
+++ b/e2e/common/cli/describe_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package cli
import (
+ "context"
"fmt"
"regexp"
"testing"
@@ -36,13 +37,12 @@ import (
)
func TestKamelCliDescribe(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
-
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
t.Run("Test kamel describe integration", func(t *testing.T) {
- integration := GetOutputString(Kamel(t, "describe", "integration", "yaml", "-n", ns))
+ integration := GetOutputString(Kamel(t, ctx, "describe", "integration", "yaml", "-n", ns))
r, _ := regexp.Compile("(?sm).*Name:\\s+yaml.*")
g.Expect(integration).To(MatchRegexp(r.String()))
@@ -54,9 +54,9 @@ func TestKamelCliDescribe(t *testing.T) {
})
t.Run("Test kamel describe integration kit", func(t *testing.T) {
- kitName := Integration(t, ns, "yaml")().Status.IntegrationKit.Name
- kitNamespace := Integration(t, ns, "yaml")().Status.IntegrationKit.Namespace
- kit := GetOutputString(Kamel(t, "describe", "kit", kitName, "-n", kitNamespace))
+ kitName := Integration(t, ctx, ns, "yaml")().Status.IntegrationKit.Name
+ kitNamespace := Integration(t, ctx, ns, "yaml")().Status.IntegrationKit.Namespace
+ kit := GetOutputString(Kamel(t, ctx, "describe", "kit", kitName, "-n", kitNamespace))
r, _ := regexp.Compile("(?sm).*Namespace:\\s+" + kitNamespace + ".*")
g.Expect(kit).To(MatchRegexp(r.String()))
@@ -71,7 +71,7 @@ func TestKamelCliDescribe(t *testing.T) {
})
t.Run("Test kamel describe integration platform", func(t *testing.T) {
- platform := GetOutputString(Kamel(t, "describe", "platform", operatorID, "-n", operatorNS))
+ platform := GetOutputString(Kamel(t, ctx, "describe", "platform", operatorID, "-n", operatorNS))
g.Expect(platform).To(ContainSubstring(fmt.Sprintf("Name: %s", operatorID)))
r, _ := regexp.Compile("(?sm).*Namespace:\\s+" + operatorNS + ".*")
@@ -81,6 +81,6 @@ func TestKamelCliDescribe(t *testing.T) {
g.Expect(platform).To(MatchRegexp(r.String()))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/cli/dev_mode_test.go b/e2e/common/cli/dev_mode_test.go
index c257a3723..0c84b4676 100644
--- a/e2e/common/cli/dev_mode_test.go
+++ b/e2e/common/cli/dev_mode_test.go
@@ -37,7 +37,7 @@ import (
)
func TestRunDevMode(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
/*
* TODO
* The changing of the yaml file constant from "string" to "magic" is not being
@@ -50,7 +50,7 @@ func TestRunDevMode(t *testing.T) {
}
t.Run("run yaml dev mode", func(t *testing.T) {
- ctx, cancel := context.WithCancel(TestContext)
+ ctx, cancel := context.WithCancel(ctx)
defer cancel()
piper, pipew := io.Pipe()
defer pipew.Close()
@@ -79,7 +79,7 @@ func TestRunDevMode(t *testing.T) {
})
t.Run("run yaml remote dev mode", func(t *testing.T) {
- ctx, cancel := context.WithCancel(TestContext)
+ ctx, cancel := context.WithCancel(ctx)
defer cancel()
piper, pipew := io.Pipe()
defer pipew.Close()
@@ -114,15 +114,15 @@ func TestRunDevMode(t *testing.T) {
name := RandomizedSuffixName("yaml")
// First run (warm up)
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed())
- g.Eventually(Integration(t, ns, name)).Should(BeNil())
- g.Eventually(IntegrationPod(t, ns, name), TestTimeoutMedium).Should(BeNil())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name)).Should(BeNil())
+ g.Eventually(IntegrationPod(t, ctx, ns, name), TestTimeoutMedium).Should(BeNil())
// Second run (rebuild)
- ctx, cancel := context.WithCancel(TestContext)
+ ctx, cancel := context.WithCancel(ctx)
defer cancel()
piper, pipew := io.Pipe()
defer pipew.Close()
@@ -148,6 +148,6 @@ func TestRunDevMode(t *testing.T) {
g.Eventually(logScanner.IsFound("Magicstring!"), timeout).Should(BeTrue())
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/cli/duplicate_parameters_test.go b/e2e/common/cli/duplicate_parameters_test.go
index 5a1f54618..44f6de40d 100644
--- a/e2e/common/cli/duplicate_parameters_test.go
+++ b/e2e/common/cli/duplicate_parameters_test.go
@@ -35,7 +35,7 @@ import (
func TestDuplicateParameters(t *testing.T) {
g := NewWithT(t)
- ctx, cancel := context.WithCancel(TestContext)
+ ctx, cancel := context.WithCancel(context.TODO())
defer cancel()
// run kamel to output the traits/configuration structure in json format to check the processed values
diff --git a/e2e/common/cli/get_test.go b/e2e/common/cli/get_test.go
index 2ab5cc504..c9b0ee351 100644
--- a/e2e/common/cli/get_test.go
+++ b/e2e/common/cli/get_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package cli
import (
+ "context"
"fmt"
"testing"
@@ -34,46 +35,46 @@ import (
)
func TestKamelCLIGet(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
t.Run("get integration", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
// regex is used for the compatibility of tests between OC and vanilla K8
// kamel get may have different output depending on the platform
- g.Eventually(IntegrationKit(t, ns, "yaml")).ShouldNot(Equal(""))
- kitName := IntegrationKit(t, ns, "yaml")()
- kitNamespace := IntegrationKitNamespace(t, ns, "yaml")()
+ g.Eventually(IntegrationKit(t, ctx, ns, "yaml")).ShouldNot(Equal(""))
+ kitName := IntegrationKit(t, ctx, ns, "yaml")()
+ kitNamespace := IntegrationKitNamespace(t, ctx, ns, "yaml")()
regex := fmt.Sprintf("^NAME\tPHASE\tKIT\n\\s*yaml\tRunning\t(%s/%s|%s)", kitNamespace, kitName, kitName)
- g.Expect(GetOutputString(Kamel(t, "get", "-n", ns))).To(MatchRegexp(regex))
+ g.Expect(GetOutputString(Kamel(t, ctx, "get", "-n", ns))).To(MatchRegexp(regex))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("get several integrations", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPodPhase(t, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
-
- g.Eventually(IntegrationKit(t, ns, "java")).ShouldNot(Equal(""))
- g.Eventually(IntegrationKit(t, ns, "yaml")).ShouldNot(Equal(""))
- kitName1 := IntegrationKit(t, ns, "java")()
- kitName2 := IntegrationKit(t, ns, "yaml")()
- kitNamespace1 := IntegrationKitNamespace(t, ns, "java")()
- kitNamespace2 := IntegrationKitNamespace(t, ns, "yaml")()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+
+ g.Eventually(IntegrationKit(t, ctx, ns, "java")).ShouldNot(Equal(""))
+ g.Eventually(IntegrationKit(t, ctx, ns, "yaml")).ShouldNot(Equal(""))
+ kitName1 := IntegrationKit(t, ctx, ns, "java")()
+ kitName2 := IntegrationKit(t, ctx, ns, "yaml")()
+ kitNamespace1 := IntegrationKitNamespace(t, ctx, ns, "java")()
+ kitNamespace2 := IntegrationKitNamespace(t, ctx, ns, "yaml")()
regex := fmt.Sprintf("^NAME\tPHASE\tKIT\n\\s*java\tRunning\t"+
"(%s/%s|%s)\n\\s*yaml\tRunning\t(%s/%s|%s)\n", kitNamespace1, kitName1, kitName1, kitNamespace2, kitName2, kitName2)
- g.Expect(GetOutputString(Kamel(t, "get", "-n", ns))).To(MatchRegexp(regex))
+ g.Expect(GetOutputString(Kamel(t, ctx, "get", "-n", ns))).To(MatchRegexp(regex))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("get no integrations", func(t *testing.T) {
- g.Expect(GetOutputString(Kamel(t, "get", "-n", ns))).NotTo(ContainSubstring("Running"))
- g.Expect(GetOutputString(Kamel(t, "get", "-n", ns))).NotTo(ContainSubstring("Building Kit"))
+ g.Expect(GetOutputString(Kamel(t, ctx, "get", "-n", ns))).NotTo(ContainSubstring("Running"))
+ g.Expect(GetOutputString(Kamel(t, ctx, "get", "-n", ns))).NotTo(ContainSubstring("Building Kit"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/cli/help_test.go b/e2e/common/cli/help_test.go
index cdb6eab54..968d2efac 100644
--- a/e2e/common/cli/help_test.go
+++ b/e2e/common/cli/help_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package cli
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -31,10 +32,11 @@ import (
)
func TestKamelCLIHelp(t *testing.T) {
+ ctx := context.TODO()
g := NewWithT(t)
t.Run("default help message", func(t *testing.T) {
- helpMsg := GetOutputString(Kamel(t, "help"))
+ helpMsg := GetOutputString(Kamel(t, ctx, "help"))
g.Expect(helpMsg).To(ContainSubstring("Apache Camel K is a lightweight integration platform, born on Kubernetes"))
g.Expect(helpMsg).To(ContainSubstring("Usage:"))
g.Expect(helpMsg).To(ContainSubstring("Available Commands:"))
@@ -42,14 +44,14 @@ func TestKamelCLIHelp(t *testing.T) {
})
t.Run("'get' command help (short flag)", func(t *testing.T) {
- helpMsg := GetOutputString(Kamel(t, "get", "-h"))
+ helpMsg := GetOutputString(Kamel(t, ctx, "get", "-h"))
g.Expect(helpMsg).To(ContainSubstring("Get the status of integrations deployed on Kubernetes"))
g.Expect(helpMsg).To(ContainSubstring("Usage:"))
g.Expect(helpMsg).To(ContainSubstring("Flags:"))
})
t.Run("'bind' command help (long flag)", func(t *testing.T) {
- helpMsg := GetOutputString(Kamel(t, "bind", "--help"))
+ helpMsg := GetOutputString(Kamel(t, ctx, "bind", "--help"))
g.Expect(helpMsg).To(ContainSubstring("Bind Kubernetes resources, such as Kamelets, in an integration flow."))
g.Expect(helpMsg).To(ContainSubstring("kamel bind [source] [sink] ... [flags]"))
g.Expect(helpMsg).To(ContainSubstring("Global Flags:"))
diff --git a/e2e/common/cli/log_test.go b/e2e/common/cli/log_test.go
index 50258be0b..38a2d34d7 100644
--- a/e2e/common/cli/log_test.go
+++ b/e2e/common/cli/log_test.go
@@ -23,35 +23,37 @@ limitations under the License.
package cli
import (
+ "context"
"strings"
"testing"
- . "github.com/apache/camel-k/v2/e2e/support"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/v2/e2e/support"
)
func TestKamelCLILog(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
t.Run("check integration log", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml", "--name", "log-yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "log-yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml", "--name", "log-yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "log-yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
// first line of the integration logs
- firstLine := strings.Split(IntegrationLogs(t, ns, "log-yaml")(), "\n")[0]
- podName := IntegrationPod(t, ns, "log-yaml")().Name
+ firstLine := strings.Split(IntegrationLogs(t, ctx, ns, "log-yaml")(), "\n")[0]
+ podName := IntegrationPod(t, ctx, ns, "log-yaml")().Name
- logsCLI := GetOutputStringAsync(Kamel(t, "log", "log-yaml", "-n", ns))
+ logsCLI := GetOutputStringAsync(Kamel(t, ctx, "log", "log-yaml", "-n", ns))
g.Eventually(logsCLI).Should(ContainSubstring("Monitoring pod " + podName))
g.Eventually(logsCLI).Should(ContainSubstring(firstLine))
- logs := strings.Split(IntegrationLogs(t, ns, "log-yaml")(), "\n")
+ logs := strings.Split(IntegrationLogs(t, ctx, ns, "log-yaml")(), "\n")
lastLine := logs[len(logs)-1]
- logsCLI = GetOutputStringAsync(Kamel(t, "log", "log-yaml", "-n", ns, "--tail", "5"))
+ logsCLI = GetOutputStringAsync(Kamel(t, ctx, "log", "log-yaml", "-n", ns, "--tail", "5"))
g.Eventually(logsCLI).Should(ContainSubstring("Monitoring pod " + podName))
g.Eventually(logsCLI).Should(ContainSubstring(lastLine))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/cli/main_test.go b/e2e/common/cli/main_test.go
index c4dfbe1fa..4a2ae1916 100644
--- a/e2e/common/cli/main_test.go
+++ b/e2e/common/cli/main_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package cli
import (
+ "context"
"fmt"
"os"
"testing"
@@ -43,20 +44,21 @@ func TestMain(m *testing.M) {
fmt.Printf("Test setup failed! - %s\n", message)
})
+ ctx := context.TODO()
var t *testing.T
g.Expect(TestClient(t)).ShouldNot(BeNil())
// Install global operator for tests in this package, all tests must use this operatorID
- g.Expect(NewNamedTestNamespace(t, operatorNS, false)).ShouldNot(BeNil())
- g.Expect(CopyCamelCatalog(t, operatorNS, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithIDAndKameletCatalog(t, operatorID, operatorNS, "--global", "--force")).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, operatorNS, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(NewNamedTestNamespace(t, ctx, operatorNS, false)).ShouldNot(BeNil())
+ g.Expect(CopyCamelCatalog(t, ctx, operatorNS, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithIDAndKameletCatalog(t, ctx, operatorID, operatorNS, "--global", "--force")).To(Succeed())
+ g.Eventually(SelectedPlatformPhase(t, ctx, operatorNS, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
exitCode := m.Run()
- g.Expect(UninstallFromNamespace(t, operatorNS))
- g.Expect(DeleteNamespace(t, operatorNS)).To(Succeed())
+ g.Expect(UninstallFromNamespace(t, ctx, operatorNS))
+ g.Expect(DeleteNamespace(t, ctx, operatorNS)).To(Succeed())
os.Exit(exitCode)
}
diff --git a/e2e/common/cli/offline_commands_test.go b/e2e/common/cli/offline_commands_test.go
index 6ee536e6d..f482a6d8e 100644
--- a/e2e/common/cli/offline_commands_test.go
+++ b/e2e/common/cli/offline_commands_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package cli
import (
+ "context"
"io"
"testing"
@@ -31,24 +32,27 @@ import (
)
func TestKamelVersionWorksOffline(t *testing.T) {
+ ctx := context.TODO()
g := NewWithT(t)
- g.Expect(Kamel(t, "version", "--kube-config", "non-existent-kubeconfig-file").Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "version", "--kube-config", "non-existent-kubeconfig-file").Execute()).To(Succeed())
}
func TestKamelHelpOptionWorksOffline(t *testing.T) {
+ ctx := context.TODO()
g := NewWithT(t)
- traitCmd := Kamel(t, "run", "Xxx.java", "--help")
+ traitCmd := Kamel(t, ctx, "run", "Xxx.java", "--help")
traitCmd.SetOut(io.Discard)
g.Expect(traitCmd.Execute()).To(Succeed())
}
func TestKamelCompletionWorksOffline(t *testing.T) {
+ ctx := context.TODO()
g := NewWithT(t)
- bashCmd := Kamel(t, "completion", "bash", "--kube-config", "non-existent-kubeconfig-file")
+ bashCmd := Kamel(t, ctx, "completion", "bash", "--kube-config", "non-existent-kubeconfig-file")
bashCmd.SetOut(io.Discard)
- zshCmd := Kamel(t, "completion", "zsh", "--kube-config", "non-existent-kubeconfig-file")
+ zshCmd := Kamel(t, ctx, "completion", "zsh", "--kube-config", "non-existent-kubeconfig-file")
zshCmd.SetOut(io.Discard)
g.Expect(bashCmd.Execute()).To(Succeed())
g.Expect(zshCmd.Execute()).To(Succeed())
diff --git a/e2e/common/cli/run_test.go b/e2e/common/cli/run_test.go
index 548cb95bc..4a1a05cd4 100644
--- a/e2e/common/cli/run_test.go
+++ b/e2e/common/cli/run_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package cli
import (
+ "context"
"os"
"testing"
@@ -39,38 +40,38 @@ import (
var sampleJar = "https://raw.githubusercontent.com/apache/camel-k/main/e2e/common/traits/files/jvm/sample-1.0.jar"
func TestKamelCLIRun(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
t.Run("Examples from GitHub", func(t *testing.T) {
t.Run("Java", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns,
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns,
"github:apache/camel-k-examples/generic-examples/languages/Sample.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "sample"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "sample", v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "sample"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "sample", v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "sample"), TestTimeoutShort).Should(ContainSubstring("Hello Camel K!"))
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "sample"), TestTimeoutShort).Should(ContainSubstring("Hello Camel K!"))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
t.Run("Java (RAW)", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns,
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns,
"https://raw.githubusercontent.com/apache/camel-k-examples/main/generic-examples/languages/Sample.java").Execute()).
To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "sample"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "sample", v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "sample"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "sample", v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "sample"), TestTimeoutShort).Should(ContainSubstring("Hello Camel K!"))
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "sample"), TestTimeoutShort).Should(ContainSubstring("Hello Camel K!"))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
t.Run("Java (branch)", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns,
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns,
"github:apache/camel-k-examples/generic-examples/languages/Sample.java?branch=main").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "sample"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "sample", v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "sample"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "sample", v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "sample"), TestTimeoutShort).Should(ContainSubstring("Hello Camel K!"))
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "sample"), TestTimeoutShort).Should(ContainSubstring("Hello Camel K!"))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
// GIST does not like GITHUB_TOKEN apparently, we must temporarily remove it
@@ -79,26 +80,26 @@ func TestKamelCLIRun(t *testing.T) {
t.Run("Gist (ID)", func(t *testing.T) {
name := RandomizedSuffixName("github-gist-id")
- g.Expect(KamelRunWithID(t, operatorID, ns, "--name", name,
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--name", name,
"gist:e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
t.Run("Gist (URL)", func(t *testing.T) {
name := RandomizedSuffixName("github-gist-url")
- g.Expect(KamelRunWithID(t, operatorID, ns, "--name", name,
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--name", name,
"https://gist.github.com/lburgazzoli/e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
// Revert GITHUB TOKEN
@@ -106,80 +107,80 @@ func TestKamelCLIRun(t *testing.T) {
os.Unsetenv("GITHUB_TOKEN_TMP")
// Clean up
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
t.Run("Run and update", func(t *testing.T) {
name := RandomizedSuffixName("run")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/run.yaml", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/run.yaml", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magic default"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magic default"))
// Re-run the Integration with an updated configuration
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/run.yaml", "--name", name, "-p", "property=value").Execute()).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/run.yaml", "--name", name, "-p", "property=value").Execute()).
To(Succeed())
// Check the Deployment has progressed successfully
- g.Eventually(DeploymentCondition(t, ns, name, appsv1.DeploymentProgressing), TestTimeoutShort).
+ g.Eventually(DeploymentCondition(t, ctx, ns, name, appsv1.DeploymentProgressing), TestTimeoutShort).
Should(MatchFields(IgnoreExtras, Fields{
"Status": Equal(corev1.ConditionTrue),
"Reason": Equal("NewReplicaSetAvailable"),
}))
// Check the new configuration is taken into account
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutShort).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magic value"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magic value"))
// Clean up
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
t.Run("Run with glob patterns", func(t *testing.T) {
t.Run("YAML", func(t *testing.T) {
name := RandomizedSuffixName("run")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/glob/run*", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/glob/run*", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello run 1 default"))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello run 2 default"))
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello run 1 default"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello run 2 default"))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
t.Run("Java", func(t *testing.T) {
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/glob/Java*", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/glob/Java*", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello java 1 default"))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello java 2 default"))
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello java 1 default"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello java 2 default"))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
t.Run("All", func(t *testing.T) {
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/glob/*", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/glob/*", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello run 1 default"))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello run 2 default"))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello java 1 default"))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello java 2 default"))
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello run 1 default"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello run 2 default"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello java 1 default"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Hello java 2 default"))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
// Clean up
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
})
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
/*
* TODO
* The dependency cannot be read by maven while building. See #3708
@@ -192,21 +193,21 @@ func TestKamelCLIRun(t *testing.T) {
}
// Requires a local integration platform in order to resolve the insecure registry
// Install platform (use the installer to get staging if present)
- g.Expect(KamelInstallWithID(t, operatorID, ns, "--skip-operator-setup")).To(Succeed())
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--skip-operator-setup")).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- g.Expect(KamelRunWithID(t, operatorID, ns, "../traits/files/jvm/Classpath.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "../traits/files/jvm/Classpath.java",
"-d", sampleJar,
).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
})
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
/*
* TODO
* The dependency cannot be read by maven while building. See #3708
@@ -219,18 +220,18 @@ func TestKamelCLIRun(t *testing.T) {
}
// Requires a local integration platform in order to resolve the insecure registry
// Install platform (use the installer to get staging if present)
- g.Expect(KamelInstallWithID(t, operatorID, ns, "--skip-operator-setup")).To(Succeed())
- g.Eventually(PlatformPhase(t, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--skip-operator-setup")).To(Succeed())
+ g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- g.Expect(KamelRunWithID(t, operatorID, ns, "../traits/files/jvm/Classpath.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "../traits/files/jvm/Classpath.java",
"-d", sampleJar,
"-d", "https://raw.githubusercontent.com/apache/camel-k-examples/main/generic-examples/languages/Sample.java|targetPath=/tmp/foo",
).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
})
- g.Eventually(DeleteIntegrations(t, ns), TestTimeoutLong).Should(Equal(0))
+ g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
}
diff --git a/e2e/common/cli/version_test.go b/e2e/common/cli/version_test.go
index 488ee7a03..9e9399495 100644
--- a/e2e/common/cli/version_test.go
+++ b/e2e/common/cli/version_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package cli
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -32,10 +33,11 @@ import (
)
func TestKamelCLIVersion(t *testing.T) {
+ ctx := context.TODO()
g := NewWithT(t)
t.Run("check version correctness", func(t *testing.T) {
- version := GetOutputString(Kamel(t, "version"))
+ version := GetOutputString(Kamel(t, ctx, "version"))
g.Expect(version).To(ContainSubstring(defaults.Version))
})
}
diff --git a/e2e/common/config/config_reload_test.go b/e2e/common/config/config_reload_test.go
index d59c719ad..7b5cf9d70 100644
--- a/e2e/common/config/config_reload_test.go
+++ b/e2e/common/config/config_reload_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package config
import (
+ "context"
"fmt"
"strconv"
"testing"
@@ -38,106 +39,94 @@ import (
func TestConfigmapHotReload(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-config-hot-reload"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("config-configmap-route")
var cmData = make(map[string]string)
cmData["my-configmap-key"] = "my configmap content"
- CreatePlainTextConfigmapWithLabels(t, ns, "my-hot-cm", cmData, map[string]string{"camel.apache.org/integration": "test"})
-
- g.Expect(KamelRunWithID(t, operatorID, ns,
- "./files/config-configmap-route.groovy",
- "--config",
- "configmap:my-hot-cm",
- "-t",
- "mount.hot-reload=true",
- "--name",
- name,
- ).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("my configmap content"))
+ CreatePlainTextConfigmapWithLabels(t, ctx, ns, "my-hot-cm", cmData, map[string]string{"camel.apache.org/integration": "test"})
+
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-configmap-route.groovy",
+ "--config", "configmap:my-hot-cm",
+ "-t", "mount.hot-reload=true",
+ "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("my configmap content"))
cmData["my-configmap-key"] = "my configmap content updated"
- UpdatePlainTextConfigmapWithLabels(t, ns, "my-hot-cm", cmData, map[string]string{"camel.apache.org/integration": "test"})
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("my configmap content updated"))
+ UpdatePlainTextConfigmapWithLabels(t, ctx, ns, "my-hot-cm", cmData, map[string]string{"camel.apache.org/integration": "test"})
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("my configmap content updated"))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestConfigmapHotReloadDefault(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-config-hot-reload-default"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("config-configmap-route")
var cmData = make(map[string]string)
cmData["my-configmap-key"] = "my configmap content"
- CreatePlainTextConfigmapWithLabels(t, ns, "my-hot-cm-2", cmData, map[string]string{"camel.apache.org/integration": "test"})
-
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/config-configmap-route.groovy",
- "--config",
- "configmap:my-hot-cm-2",
- "--name",
- name,
- ).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("my configmap content"))
+ CreatePlainTextConfigmapWithLabels(t, ctx, ns, "my-hot-cm-2", cmData, map[string]string{"camel.apache.org/integration": "test"})
+
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-configmap-route.groovy",
+ "--config", "configmap:my-hot-cm-2",
+ "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("my configmap content"))
cmData["my-configmap-key"] = "my configmap content updated"
- UpdatePlainTextConfigmapWithLabels(t, ns, "my-hot-cm-2", cmData, map[string]string{"camel.apache.org/integration": "test"})
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(Not(ContainSubstring("my configmap content updated")))
+ UpdatePlainTextConfigmapWithLabels(t, ctx, ns, "my-hot-cm-2", cmData, map[string]string{"camel.apache.org/integration": "test"})
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(Not(ContainSubstring("my configmap content updated")))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestSecretHotReload(t *testing.T) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-secret-hot-reload"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("config-secret-route")
var secData = make(map[string]string)
secData["my-secret-key"] = "very top secret"
- CreatePlainTextSecretWithLabels(t, ns, "my-hot-sec", secData, map[string]string{"camel.apache.org/integration": "test"})
-
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/config-secret-route.groovy",
- "--config",
- "secret:my-hot-sec",
- "-t",
- "mount.hot-reload=true",
- "--name",
- name,
- ).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("very top secret"))
+ CreatePlainTextSecretWithLabels(t, ctx, ns, "my-hot-sec", secData, map[string]string{"camel.apache.org/integration": "test"})
+
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-secret-route.groovy",
+ "--config", "secret:my-hot-sec",
+ "-t", "mount.hot-reload=true",
+ "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("very top secret"))
secData["my-secret-key"] = "very top secret updated"
- UpdatePlainTextSecretWithLabels(t, ns, "my-hot-sec", secData, map[string]string{"camel.apache.org/integration": "test"})
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("very top secret updated"))
+ UpdatePlainTextSecretWithLabels(t, ctx, ns, "my-hot-sec", secData, map[string]string{"camel.apache.org/integration": "test"})
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("very top secret updated"))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
@@ -150,38 +139,34 @@ func TestConfigmapWithOwnerRefHotReload(t *testing.T) {
}
func CheckConfigmapWithOwnerRef(t *testing.T, hotreload bool) {
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := fmt.Sprintf("camel-k-config-owner-ref-%s", strconv.FormatBool(hotreload))
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("config-configmap-route")
cmName := RandomizedSuffixName("my-hot-cm-")
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/config-configmap-route.groovy",
- "--config",
- "configmap:"+cmName,
- "--name",
- name,
- "-t",
- "mount.hot-reload="+strconv.FormatBool(hotreload),
- ).Execute()).To(Succeed())
-
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseError))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-configmap-route.groovy",
+ "--config", "configmap:"+cmName,
+ "--name", name,
+ "-t", "mount.hot-reload="+strconv.FormatBool(hotreload)).Execute()).To(Succeed())
+
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseError))
var cmData = make(map[string]string)
cmData["my-configmap-key"] = "my configmap content"
- CreatePlainTextConfigmapWithOwnerRefWithLabels(t, ns, cmName, cmData, name, Integration(t, ns, name)().UID, map[string]string{"camel.apache.org/integration": "test"})
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutLong).Should(ContainSubstring("my configmap content"))
+ CreatePlainTextConfigmapWithOwnerRefWithLabels(t, ctx, ns, cmName, cmData, name, Integration(t, ctx, ns, name)().UID, map[string]string{"camel.apache.org/integration": "test"})
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutLong).Should(ContainSubstring("my configmap content"))
cmData["my-configmap-key"] = "my configmap content updated"
- UpdatePlainTextConfigmapWithLabels(t, ns, cmName, cmData, map[string]string{"camel.apache.org/integration": "test"})
+ UpdatePlainTextConfigmapWithLabels(t, ctx, ns, cmName, cmData, map[string]string{"camel.apache.org/integration": "test"})
if hotreload {
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutLong).Should(ContainSubstring("my configmap content updated"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutLong).Should(ContainSubstring("my configmap content updated"))
} else {
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutLong).Should(Not(ContainSubstring("my configmap content updated")))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutLong).Should(Not(ContainSubstring("my configmap content updated")))
}
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/config/config_test.go b/e2e/common/config/config_test.go
index fee946697..c60267d75 100644
--- a/e2e/common/config/config_test.go
+++ b/e2e/common/config/config_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package config
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -37,108 +38,105 @@ import (
func TestRunConfigExamples(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-config"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Simple property", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/property-route.groovy", "-p", "my.message=test-property").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("test-property"))
- g.Expect(Kamel(t, "delete", "property-route", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-route.groovy", "-p", "my.message=test-property").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("test-property"))
+ g.Expect(Kamel(t, ctx, "delete", "property-route", "-n", ns).Execute()).To(Succeed())
})
t.Run("Property file", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/property-file-route.groovy", "--property", "file:./files/my.properties").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello world"))
- g.Expect(Kamel(t, "delete", "property-file-route", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-file-route.groovy", "--property", "file:./files/my.properties").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello world"))
+ g.Expect(Kamel(t, ctx, "delete", "property-file-route", "-n", ns).Execute()).To(Succeed())
})
t.Run("Property precedence", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/property-file-route.groovy", "-p", "my.key.2=universe", "-p", "file:./files/my.properties").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello universe"))
- g.Expect(Kamel(t, "delete", "property-file-route", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-file-route.groovy", "-p", "my.key.2=universe", "-p", "file:./files/my.properties").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello universe"))
+ g.Expect(Kamel(t, ctx, "delete", "property-file-route", "-n", ns).Execute()).To(Succeed())
})
t.Run("Property from ConfigMap", func(t *testing.T) {
var cmData = make(map[string]string)
cmData["my.message"] = "my-configmap-property-value"
- CreatePlainTextConfigmap(t, ns, "my-cm-test-property", cmData)
+ CreatePlainTextConfigmap(t, ctx, ns, "my-cm-test-property", cmData)
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/property-route.groovy", "-p", "configmap:my-cm-test-property").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-configmap-property-value"))
- g.Expect(Kamel(t, "delete", "property-route", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-route.groovy", "-p", "configmap:my-cm-test-property").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-configmap-property-value"))
+ g.Expect(Kamel(t, ctx, "delete", "property-route", "-n", ns).Execute()).To(Succeed())
})
t.Run("Property from ConfigMap as property file", func(t *testing.T) {
var cmData = make(map[string]string)
cmData["my.properties"] = "my.message=my-configmap-property-entry"
- CreatePlainTextConfigmap(t, ns, "my-cm-test-properties", cmData)
+ CreatePlainTextConfigmap(t, ctx, ns, "my-cm-test-properties", cmData)
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/property-route.groovy", "-p", "configmap:my-cm-test-properties").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-configmap-property-entry"))
- g.Expect(Kamel(t, "delete", "property-route", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-route.groovy", "-p", "configmap:my-cm-test-properties").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-configmap-property-entry"))
+ g.Expect(Kamel(t, ctx, "delete", "property-route", "-n", ns).Execute()).To(Succeed())
})
t.Run("Property from Secret", func(t *testing.T) {
var secData = make(map[string]string)
secData["my.message"] = "my-secret-property-value"
- CreatePlainTextSecret(t, ns, "my-sec-test-property", secData)
+ CreatePlainTextSecret(t, ctx, ns, "my-sec-test-property", secData)
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/property-route.groovy", "-p", "secret:my-sec-test-property").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-property-value"))
- g.Expect(Kamel(t, "delete", "property-route", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-route.groovy", "-p", "secret:my-sec-test-property").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-property-value"))
+ g.Expect(Kamel(t, ctx, "delete", "property-route", "-n", ns).Execute()).To(Succeed())
})
t.Run("Property from Secret as property file", func(t *testing.T) {
var secData = make(map[string]string)
secData["my.properties"] = "my.message=my-secret-property-entry"
- CreatePlainTextSecret(t, ns, "my-sec-test-properties", secData)
+ CreatePlainTextSecret(t, ctx, ns, "my-sec-test-properties", secData)
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/property-route.groovy", "-p", "secret:my-sec-test-properties").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-property-entry"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-route.groovy", "--name", "property-route-secret", "-p", "secret:my-sec-test-properties").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "property-route-secret"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "property-route-secret", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "property-route-secret"), TestTimeoutShort).Should(ContainSubstring("my-secret-property-entry"))
})
t.Run("Property from Secret inlined", func(t *testing.T) {
var secData = make(map[string]string)
secData["my-message"] = "my-secret-external-value"
- CreatePlainTextSecret(t, ns, "my-sec-inlined", secData)
+ CreatePlainTextSecret(t, ctx, ns, "my-sec-inlined", secData)
// TODO: remove jvm.options trait as soon as CAMEL-20054 gets fixed
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/property-secret-route.groovy",
- "-t", "mount.configs=secret:my-sec-inlined",
- "-t", "jvm.options=-Dcamel.k.mount-path.secrets=/etc/camel/conf.d/_secrets",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "property-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "property-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "property-secret-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-external-value"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-secret-route.groovy", "-t", "mount.configs=secret:my-sec-inlined", "-t", "jvm.options=-Dcamel.k.mount-path.secrets=/etc/camel/conf.d/_secrets").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "property-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "property-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "property-secret-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-external-value"))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, "property-secret-route")).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, "property-secret-route")()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, "property-secret-route")).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, "property-secret-route")()
mountTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "mount")
g.Expect(mountTrait).ToNot(BeNil())
g.Expect(len(mountTrait)).To(Equal(1))
g.Expect(mountTrait["configs"]).ToNot(BeNil())
- g.Expect(Kamel(t, "delete", "property-secret-route", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "property-secret-route", "-n", ns).Execute()).To(Succeed())
})
@@ -147,59 +145,59 @@ func TestRunConfigExamples(t *testing.T) {
// Store a configmap on the cluster
var cmData = make(map[string]string)
cmData["my-configmap-key"] = "my-configmap-content"
- CreatePlainTextConfigmap(t, ns, "my-cm", cmData)
+ CreatePlainTextConfigmap(t, ctx, ns, "my-cm", cmData)
// Store a configmap with multiple values
var cmDataMulti = make(map[string]string)
cmDataMulti["my-configmap-key"] = "should-not-see-it"
cmDataMulti["my-configmap-key-2"] = "my-configmap-content-2"
- CreatePlainTextConfigmap(t, ns, "my-cm-multi", cmDataMulti)
+ CreatePlainTextConfigmap(t, ctx, ns, "my-cm-multi", cmDataMulti)
t.Run("Config configmap", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/config-configmap-route.groovy", "--config", "configmap:my-cm").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "config-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "config-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "config-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-configmap-route.groovy", "--config", "configmap:my-cm").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "config-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "config-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "config-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
})
t.Run("Resource configmap", func(t *testing.T) {
// We can reuse the configmap created previously
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/resource-configmap-route.groovy", "--resource", "configmap:my-cm").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "resource-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "resource-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "resource-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/resource-configmap-route.groovy", "--resource", "configmap:my-cm").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "resource-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "resource-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "resource-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
})
t.Run("Resource configmap with destination", func(t *testing.T) {
// We can reuse the configmap created previously
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/resource-configmap-location-route.groovy", "--resource", "configmap:my-cm@/tmp/app").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "resource-configmap-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "resource-configmap-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "resource-configmap-location-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/resource-configmap-location-route.groovy", "--resource", "configmap:my-cm@/tmp/app").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "resource-configmap-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "resource-configmap-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "resource-configmap-location-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
})
t.Run("Resource configmap with filtered key and destination", func(t *testing.T) {
// We'll use the configmap contaning 2 values filtering only 1 key
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/resource-configmap-key-location-route.groovy", "--resource", "configmap:my-cm-multi/my-configmap-key-2@/tmp/app/test.txt").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "resource-configmap-key-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "resource-configmap-key-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "resource-configmap-key-location-route"), TestTimeoutShort).ShouldNot(ContainSubstring(cmDataMulti["my-configmap-key"]))
- g.Eventually(IntegrationLogs(t, ns, "resource-configmap-key-location-route"), TestTimeoutShort).Should(ContainSubstring(cmDataMulti["my-configmap-key-2"]))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/resource-configmap-key-location-route.groovy", "--resource", "configmap:my-cm-multi/my-configmap-key-2@/tmp/app/test.txt").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "resource-configmap-key-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "resource-configmap-key-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "resource-configmap-key-location-route"), TestTimeoutShort).ShouldNot(ContainSubstring(cmDataMulti["my-configmap-key"]))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "resource-configmap-key-location-route"), TestTimeoutShort).Should(ContainSubstring(cmDataMulti["my-configmap-key-2"]))
})
- // Store a configmap as property file
- var cmDataProps = make(map[string]string)
- cmDataProps["my.properties"] = "my.key.1=hello\nmy.key.2=world"
- CreatePlainTextConfigmap(t, ns, "my-cm-properties", cmDataProps)
-
t.Run("Config configmap as property file", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/config-configmap-properties-route.groovy", "--config", "configmap:my-cm-properties").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "config-configmap-properties-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "config-configmap-properties-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "config-configmap-properties-route"), TestTimeoutShort).Should(ContainSubstring("hello world"))
+ // Store a configmap as property file
+ var cmDataProps = make(map[string]string)
+ cmDataProps["my.properties"] = "my.key.1=hello\nmy.key.2=world"
+ CreatePlainTextConfigmap(t, ctx, ns, "my-cm-properties", cmDataProps)
+
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-configmap-properties-route.groovy", "--config", "configmap:my-cm-properties").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "config-configmap-properties-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ 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
@@ -207,127 +205,123 @@ func TestRunConfigExamples(t *testing.T) {
// Store a secret on the cluster
var secData = make(map[string]string)
secData["my-secret-key"] = "very top secret"
- CreatePlainTextSecret(t, ns, "my-sec", secData)
+ CreatePlainTextSecret(t, ctx, ns, "my-sec", secData)
// Store a secret with multi values
var secDataMulti = make(map[string]string)
secDataMulti["my-secret-key"] = "very top secret"
secDataMulti["my-secret-key-2"] = "even more secret"
- CreatePlainTextSecret(t, ns, "my-sec-multi", secDataMulti)
+ CreatePlainTextSecret(t, ctx, ns, "my-sec-multi", secDataMulti)
t.Run("Config secret", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/config-secret-route.groovy", "--config", "secret:my-sec").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "config-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "config-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "config-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"]))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-secret-route.groovy", "--config", "secret:my-sec").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "config-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "config-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "config-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"]))
})
t.Run("Resource secret", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/resource-secret-route.groovy", "--resource", "secret:my-sec").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "resource-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "resource-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "resource-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"]))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/resource-secret-route.groovy", "--resource", "secret:my-sec").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "resource-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "resource-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "resource-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"]))
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Secret with filtered key", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/config-secret-key-route.groovy", "--config", "secret:my-sec-multi/my-secret-key-2").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "config-secret-key-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "config-secret-key-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "config-secret-key-route"), TestTimeoutShort).ShouldNot(ContainSubstring(secDataMulti["my-secret-key"]))
- g.Eventually(IntegrationLogs(t, ns, "config-secret-key-route"), TestTimeoutShort).Should(ContainSubstring(secDataMulti["my-secret-key-2"]))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-secret-key-route.groovy", "--config", "secret:my-sec-multi/my-secret-key-2").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "config-secret-key-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "config-secret-key-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "config-secret-key-route"), TestTimeoutShort).ShouldNot(ContainSubstring(secDataMulti["my-secret-key"]))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "config-secret-key-route"), TestTimeoutShort).Should(ContainSubstring(secDataMulti["my-secret-key-2"]))
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
// Build-Properties
t.Run("Build time property", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/build-property-route.groovy", "--build-property", "quarkus.application.name=my-super-application").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "build-property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "build-property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "build-property-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-route.groovy", "--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))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "build-property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "build-property-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application"))
// Don't delete - we need it for next test execution
})
// We need to check also that the property (which is available in the IntegrationKit) is correctly replaced and we don't reuse the same kit
t.Run("Build time property updated", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/build-property-route.groovy", "--name", "build-property-route-updated",
- "--build-property", "quarkus.application.name=my-super-application-updated").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "build-property-route-updated"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "build-property-route-updated", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "build-property-route-updated"), TestTimeoutShort).Should(ContainSubstring("my-super-application-updated"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-route.groovy", "--name", "build-property-route-updated", "--build-property", "quarkus.application.name=my-super-application-updated").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "build-property-route-updated"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "build-property-route-updated", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "build-property-route-updated"), TestTimeoutShort).Should(ContainSubstring("my-super-application-updated"))
// Verify the integration kits are different
- g.Eventually(IntegrationKit(t, ns, "build-property-route-updated")).ShouldNot(Equal(IntegrationKit(t, ns, "build-property-route")()))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Eventually(IntegrationKit(t, ctx, ns, "build-property-route-updated")).ShouldNot(Equal(IntegrationKit(t, ctx, ns, "build-property-route")()))
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
// Build-Properties file
t.Run("Build time property file", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application"))
- g.Expect(Kamel(t, "delete", "build-property-file-route", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application"))
+ g.Expect(Kamel(t, ctx, "delete", "build-property-file-route", "-n", ns).Execute()).To(Succeed())
})
t.Run("Build time property file with precedence", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "quarkus.application.name=my-overridden-application", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "build-property-file-route"), TestTimeoutMedium).Should(ContainSubstring("my-overridden-application"))
- g.Expect(Kamel(t, "delete", "build-property-file-route", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-file-route.groovy", "--name", "build-property-file-route-precedence", "--build-property", "quarkus.application.name=my-overridden-application", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "build-property-file-route-precedence"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "build-property-file-route-precedence", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "build-property-file-route-precedence"), TestTimeoutShort).Should(ContainSubstring("my-overridden-application"))
+ g.Expect(Kamel(t, ctx, "delete", "build-property-file-route-precedence", "-n", ns).Execute()).To(Succeed())
})
t.Run("Build time property from ConfigMap", func(t *testing.T) {
var cmData = make(map[string]string)
cmData["quarkus.application.name"] = "my-cool-application"
- CreatePlainTextConfigmap(t, ns, "my-cm-test-build-property", cmData)
+ CreatePlainTextConfigmap(t, ctx, ns, "my-cm-test-build-property", cmData)
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "configmap:my-cm-test-build-property").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "build-property-file-route"), TestTimeoutLong).Should(ContainSubstring("my-cool-application"))
- g.Expect(Kamel(t, "delete", "build-property-file-route", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "configmap:my-cm-test-build-property").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-cool-application"))
+ g.Expect(Kamel(t, ctx, "delete", "build-property-file-route", "-n", ns).Execute()).To(Succeed())
})
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"
- CreatePlainTextConfigmap(t, ns, "my-cm-test-build-properties", cmData)
-
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "configmap:my-cm-test-build-properties").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-super-cool-application"))
- g.Expect(Kamel(t, "delete", "build-property-file-route", "-n", ns).Execute()).To(Succeed())
+ CreatePlainTextConfigmap(t, ctx, ns, "my-cm-test-build-properties", cmData)
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-file-route.groovy", "--name", "build-property-file-route-cm", "--build-property", "configmap:my-cm-test-build-properties").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "build-property-file-route-cm"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "build-property-file-route-cm", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "build-property-file-route-cm"), TestTimeoutShort).Should(ContainSubstring("my-super-cool-application"))
+ g.Expect(Kamel(t, ctx, "delete", "build-property-file-route-cm", "-n", ns).Execute()).To(Succeed())
})
t.Run("Build time property from Secret", func(t *testing.T) {
var secData = make(map[string]string)
secData["quarkus.application.name"] = "my-great-application"
- CreatePlainTextSecret(t, ns, "my-sec-test-build-property", secData)
-
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "secret:my-sec-test-build-property").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-great-application"))
- g.Expect(Kamel(t, "delete", "build-property-file-route", "-n", ns).Execute()).To(Succeed())
+ CreatePlainTextSecret(t, ctx, ns, "my-sec-test-build-property", secData)
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "secret:my-sec-test-build-property").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-great-application"))
+ g.Expect(Kamel(t, ctx, "delete", "build-property-file-route", "-n", ns).Execute()).To(Succeed())
})
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-awsome-application"
- CreatePlainTextSecret(t, ns, "my-sec-test-build-properties", secData)
-
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "secret:my-sec-test-build-properties").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-awsome-application"))
- g.Expect(Kamel(t, "delete", "build-property-file-route", "-n", ns).Execute()).To(Succeed())
+ CreatePlainTextSecret(t, ctx, ns, "my-sec-test-build-properties", secData)
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-file-route.groovy", "--name", "build-property-file-route-secret", "--build-property", "secret:my-sec-test-build-properties").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "build-property-file-route-secret"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "build-property-file-route-secret", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "build-property-file-route-secret"), TestTimeoutShort).Should(ContainSubstring("my-awsome-application"))
+ g.Expect(Kamel(t, ctx, "delete", "build-property-file-route-secret", "-n", ns).Execute()).To(Succeed())
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/config/kamelet_config_test.go b/e2e/common/config/kamelet_config_test.go
index 67114fded..8dcc0c2c1 100644
--- a/e2e/common/config/kamelet_config_test.go
+++ b/e2e/common/config/kamelet_config_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package config
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -38,102 +39,102 @@ import (
func TestKameletImplicitConfigDefaultUserProperty(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-config-kamelet-user-property"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("run test default config using properties", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig01-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "iconfig01-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int01")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/TimerKameletIntegrationConfiguration01.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegrationConfiguration01.java",
"-p", "camel.kamelet.iconfig01-timer-source.message='Default message 01'",
"--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("Default message 01"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("Default message 01"))
- 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, "iconfig01-timer-source")).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteKamelet(t, ctx, ns, "iconfig01-timer-source")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test default config using mounted secret", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig03-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "iconfig03-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int3")
secretName := "my-iconfig-int3-secret"
var secData = make(map[string]string)
secData["camel.kamelet.iconfig03-timer-source.message"] = "very top mounted secret message"
- g.Expect(CreatePlainTextSecret(t, ns, secretName, secData)).To(Succeed())
- g.Eventually(SecretByName(t, ns, secretName), TestTimeoutLong).Should(Not(BeNil()))
+ g.Expect(CreatePlainTextSecret(t, ctx, ns, secretName, secData)).To(Succeed())
+ g.Eventually(SecretByName(t, ctx, ns, secretName), TestTimeoutLong).Should(Not(BeNil()))
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/TimerKameletIntegrationConfiguration03.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegrationConfiguration03.java",
"-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("very top mounted secret message"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("very top mounted secret message"))
- 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.Eventually(SecretByName(t, ns, secretName), TestTimeoutLong).Should(BeNil())
- g.Expect(DeleteKamelet(t, ns, "iconfig03-timer-source")).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteSecret(t, ctx, ns, secretName)).To(Succeed())
+ g.Eventually(SecretByName(t, ctx, ns, secretName), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteKamelet(t, ctx, ns, "iconfig03-timer-source")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test default config using mounted configmap", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig04-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "iconfig04-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int4")
cmName := "my-iconfig-int4-configmap"
var cmData = make(map[string]string)
cmData["camel.kamelet.iconfig04-timer-source.message"] = "very top mounted configmap message"
- g.Expect(CreatePlainTextConfigmap(t, ns, cmName, cmData)).To(Succeed())
+ g.Expect(CreatePlainTextConfigmap(t, ctx, ns, cmName, cmData)).To(Succeed())
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/TimerKameletIntegrationConfiguration04.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegrationConfiguration04.java",
"-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("very top mounted configmap message"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("very top mounted configmap message"))
- 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, "iconfig04-timer-source")).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteConfigmap(t, ctx, ns, cmName)).To(Succeed())
+ g.Expect(DeleteKamelet(t, ctx, ns, "iconfig04-timer-source")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test named config using properties", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig05-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "iconfig05-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int5")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration05.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration05.java",
"-p", "camel.kamelet.iconfig05-timer-source.message='Default message 05'",
"-p", "camel.kamelet.iconfig05-timer-source.mynamedconfig.message='My Named Config message'",
"--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 Named Config message"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("My Named Config message"))
- 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, "iconfig05-timer-source")).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteKamelet(t, ctx, ns, "iconfig05-timer-source")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test named config using labeled secret", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig06-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "iconfig06-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int6")
secretName := "my-iconfig-int6-secret"
@@ -143,78 +144,78 @@ func TestKameletImplicitConfigDefaultUserProperty(t *testing.T) {
var labels = make(map[string]string)
labels["camel.apache.org/kamelet"] = "iconfig06-timer-source"
labels["camel.apache.org/kamelet.configuration"] = "mynamedconfig"
- g.Expect(CreatePlainTextSecretWithLabels(t, ns, secretName, secData, labels)).To(Succeed())
- g.Eventually(SecretByName(t, ns, secretName), TestTimeoutLong).Should(Not(BeNil()))
+ g.Expect(CreatePlainTextSecretWithLabels(t, ctx, ns, secretName, secData, labels)).To(Succeed())
+ g.Eventually(SecretByName(t, ctx, ns, secretName), TestTimeoutLong).Should(Not(BeNil()))
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration06.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration06.java",
"-p", "camel.kamelet.iconfig06-timer-source.message='Default message 06'",
"--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("very top named secret message"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("very top named secret message"))
- 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.Eventually(SecretByName(t, ns, secretName), TestTimeoutLong).Should(BeNil())
- g.Expect(DeleteKamelet(t, ns, "iconfig06-timer-source")).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteSecret(t, ctx, ns, secretName)).To(Succeed())
+ g.Eventually(SecretByName(t, ctx, ns, secretName), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteKamelet(t, ctx, ns, "iconfig06-timer-source")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test named config using mounted secret", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig07-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "iconfig07-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int7")
secretName := "my-iconfig-int7-secret"
var secData = make(map[string]string)
secData["camel.kamelet.iconfig07-timer-source.mynamedconfig.message"] = "very top named mounted secret message"
- g.Expect(CreatePlainTextSecret(t, ns, secretName, secData)).To(Succeed())
- g.Eventually(SecretByName(t, ns, secretName), TestTimeoutLong).Should(Not(BeNil()))
+ g.Expect(CreatePlainTextSecret(t, ctx, ns, secretName, secData)).To(Succeed())
+ g.Eventually(SecretByName(t, ctx, ns, secretName), TestTimeoutLong).Should(Not(BeNil()))
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration07.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration07.java",
"-p", "camel.kamelet.iconfig07-timer-source.message='Default message 07'",
"-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("very top named mounted secret message"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("very top named mounted secret message"))
- 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.Eventually(SecretByName(t, ns, secretName), TestTimeoutLong).Should(BeNil())
- g.Expect(DeleteKamelet(t, ns, "iconfig07-timer-source")).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteSecret(t, ctx, ns, secretName)).To(Succeed())
+ g.Eventually(SecretByName(t, ctx, ns, secretName), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteKamelet(t, ctx, ns, "iconfig07-timer-source")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test named config using mounted configmap", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig08-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "iconfig08-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int8")
cmName := "my-iconfig-int8-configmap"
var cmData = make(map[string]string)
cmData["camel.kamelet.iconfig08-timer-source.mynamedconfig.message"] = "very top named mounted configmap message"
- g.Expect(CreatePlainTextConfigmap(t, ns, cmName, cmData)).To(Succeed())
+ g.Expect(CreatePlainTextConfigmap(t, ctx, ns, cmName, cmData)).To(Succeed())
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration08.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration08.java",
"-p", "camel.kamelet.iconfig08-timer-source.message='Default message 08'",
"-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("very top named mounted configmap message"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("very top named mounted configmap message"))
- 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, "iconfig08-timer-source")).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteConfigmap(t, ctx, ns, cmName)).To(Succeed())
+ g.Expect(DeleteKamelet(t, ctx, ns, "iconfig08-timer-source")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test default config using labeled secret", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "iconfig09-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "iconfig09-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int9")
secretName := "my-iconfig-int9-secret"
@@ -223,70 +224,70 @@ func TestKameletImplicitConfigDefaultUserProperty(t *testing.T) {
secData["camel.kamelet.iconfig09-timer-source.message"] = "very top labeled secret message"
var labels = make(map[string]string)
labels["camel.apache.org/kamelet"] = "iconfig09-timer-source"
- g.Expect(CreatePlainTextSecretWithLabels(t, ns, secretName, secData, labels)).To(Succeed())
- g.Eventually(SecretByName(t, ns, secretName), TestTimeoutLong).Should(Not(BeNil()))
+ g.Expect(CreatePlainTextSecretWithLabels(t, ctx, ns, secretName, secData, labels)).To(Succeed())
+ g.Eventually(SecretByName(t, ctx, ns, secretName), TestTimeoutLong).Should(Not(BeNil()))
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/TimerKameletIntegrationConfiguration09.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegrationConfiguration09.java",
"--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("very top labeled secret message"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("very top labeled secret message"))
- 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.Eventually(SecretByName(t, ns, secretName), TestTimeoutLong).Should(BeNil())
- g.Expect(DeleteKamelet(t, ns, "iconfig09-timer-source")).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteSecret(t, ctx, ns, secretName)).To(Succeed())
+ g.Eventually(SecretByName(t, ctx, ns, secretName), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteKamelet(t, ctx, ns, "iconfig09-timer-source")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test default config inlined properties", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "config01-timer-source")()).To(Succeed())
- g.Expect(CreateLogKamelet(t, operatorID, ns, "config01-log-sink")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "config01-timer-source")()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, operatorID, ns, "config01-log-sink")()).To(Succeed())
name := RandomizedSuffixName("config-test-timer-source-int1")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/timer-kamelet-integration-inlined-configuration-01.yaml",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-kamelet-integration-inlined-configuration-01.yaml",
"--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("important message"))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("integrationLogger"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("important message"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("integrationLogger"))
- 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, "config01-timer-source")).To(Succeed())
- g.Expect(DeleteKamelet(t, ns, "config01-log-sink")).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteKamelet(t, ctx, ns, "config01-timer-source")).To(Succeed())
+ g.Expect(DeleteKamelet(t, ctx, ns, "config01-log-sink")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test default config parameters properties", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "config02-timer-source")()).To(Succeed())
- g.Expect(CreateLogKamelet(t, operatorID, ns, "config02-log-sink")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "config02-timer-source")()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, operatorID, ns, "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, ctx, operatorID, ns, "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.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("My parameter message 02"))
+ g.Eventually(IntegrationLogs(t, ctx, 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.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteKamelet(t, ctx, ns, "config02-timer-source")).To(Succeed())
+ g.Expect(DeleteKamelet(t, ctx, ns, "config02-log-sink")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test default config secret properties", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "config03-timer-source")()).To(Succeed())
- g.Expect(CreateLogKamelet(t, operatorID, ns, "config03-log-sink")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "config03-timer-source")()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, operatorID, ns, "config03-log-sink")()).To(Succeed())
name := RandomizedSuffixName("config-test-timer-source-int3")
secretName := "my-config-int3-secret"
@@ -294,28 +295,28 @@ func TestKameletImplicitConfigDefaultUserProperty(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, ctx, ns, secretName, secData)).To(Succeed())
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/timer-kamelet-integration-parameters-configuration-03.yaml",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "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.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("My secret message 03"))
+ g.Eventually(IntegrationLogs(t, ctx, 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.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteSecret(t, ctx, ns, secretName)).To(Succeed())
+ g.Expect(DeleteKamelet(t, ctx, ns, "config03-timer-source")).To(Succeed())
+ g.Expect(DeleteKamelet(t, ctx, ns, "config03-log-sink")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test default config configmap properties", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "config04-timer-source")()).To(Succeed())
- g.Expect(CreateLogKamelet(t, operatorID, ns, "config04-log-sink")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "config04-timer-source")()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, operatorID, ns, "config04-log-sink")()).To(Succeed())
name := RandomizedSuffixName("config-test-timer-source-int4")
cmName := "my-config-int4-configmap"
@@ -323,22 +324,22 @@ func TestKameletImplicitConfigDefaultUserProperty(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, ctx, ns, cmName, cmData)).To(Succeed())
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/timer-kamelet-integration-parameters-configuration-04.yaml",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "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.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("My configmap message 04"))
+ g.Eventually(IntegrationLogs(t, ctx, 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.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Expect(DeleteConfigmap(t, ctx, ns, cmName)).To(Succeed())
+ g.Expect(DeleteKamelet(t, ctx, ns, "config04-timer-source")).To(Succeed())
+ g.Expect(DeleteKamelet(t, ctx, ns, "config04-log-sink")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
})
diff --git a/e2e/common/config/pipe_config_test.go b/e2e/common/config/pipe_config_test.go
index b471b1012..3c3acc438 100644
--- a/e2e/common/config/pipe_config_test.go
+++ b/e2e/common/config/pipe_config_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package config
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,32 +37,32 @@ import (
func TestPipeConfig(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-pipe-config"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("test custom source/sink pipe", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "my-pipe-timer-source")()).To(Succeed())
- g.Expect(CreateLogKamelet(t, operatorID, ns, "my-pipe-log-sink")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "my-pipe-timer-source")()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, 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")
- g.Expect(KamelBindWithID(t, operatorID, ns,
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-p", "source.message=My pipe message",
"-p", "sink.loggerName=myPipeLogger",
"--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 pipe message"))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("myPipeLogger"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("My pipe message"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("myPipeLogger"))
- g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
})
t.Run("run test implicit default config using labeled secret", func(t *testing.T) {
@@ -72,20 +73,20 @@ func TestPipeConfig(t *testing.T) {
secData["camel.kamelet.my-pipe-timer-source.message"] = "My pipe secret message"
var labels = make(map[string]string)
labels["camel.apache.org/kamelet"] = "my-pipe-timer-source"
- g.Expect(CreatePlainTextSecretWithLabels(t, ns, secretName, secData, labels)).To(Succeed())
+ g.Expect(CreatePlainTextSecretWithLabels(t, ctx, ns, secretName, secData, labels)).To(Succeed())
- g.Expect(KamelBindWithID(t, operatorID, ns,
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-p", "sink.loggerName=myDefaultLogger",
"--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 pipe secret message"))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("myDefaultLogger"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("My pipe secret message"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("myDefaultLogger"))
- g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed())
- g.Expect(DeleteSecret(t, ns, secretName)).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Expect(DeleteSecret(t, ctx, ns, secretName)).To(Succeed())
})
t.Run("run test implicit default config using mounted secret", func(t *testing.T) {
@@ -95,20 +96,20 @@ func TestPipeConfig(t *testing.T) {
var secData = make(map[string]string)
secData["camel.kamelet.my-pipe-timer-source.message"] = "My pipe secret message"
secData["camel.kamelet.my-pipe-log-sink.loggerName"] = "myPipeSecretLogger"
- g.Expect(CreatePlainTextSecret(t, ns, secretName, secData)).To(Succeed())
+ g.Expect(CreatePlainTextSecret(t, ctx, ns, secretName, secData)).To(Succeed())
- g.Expect(KamelBindWithID(t, operatorID, ns,
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-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 pipe secret message"))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("myPipeSecretLogger"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("My pipe secret message"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("myPipeSecretLogger"))
- g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed())
- g.Expect(DeleteSecret(t, ns, secretName)).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Expect(DeleteSecret(t, ctx, ns, secretName)).To(Succeed())
})
t.Run("run test implicit default config using mounted configmap", func(t *testing.T) {
@@ -118,20 +119,20 @@ func TestPipeConfig(t *testing.T) {
var cmData = make(map[string]string)
cmData["camel.kamelet.my-pipe-timer-source.message"] = "My pipe configmap message"
cmData["camel.kamelet.my-pipe-log-sink.loggerName"] = "myPipeConfigmapLogger"
- g.Expect(CreatePlainTextConfigmap(t, ns, cmName, cmData)).To(Succeed())
+ g.Expect(CreatePlainTextConfigmap(t, ctx, ns, cmName, cmData)).To(Succeed())
- g.Expect(KamelBindWithID(t, operatorID, ns,
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-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 pipe configmap message"))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("myPipeConfigmapLogger"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("My pipe configmap message"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("myPipeConfigmapLogger"))
- g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed())
- g.Expect(DeleteConfigmap(t, ns, cmName)).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Expect(DeleteConfigmap(t, ctx, ns, cmName)).To(Succeed())
})
t.Run("run test implicit named config using mounted secret", func(t *testing.T) {
@@ -141,9 +142,9 @@ func TestPipeConfig(t *testing.T) {
var secData = make(map[string]string)
secData["camel.kamelet.my-pipe-timer-source.mynamedconfig.message"] = "My pipe named secret message"
secData["camel.kamelet.my-pipe-log-sink.mynamedconfig.loggerName"] = "myPipeNamedSecretLogger"
- g.Expect(CreatePlainTextSecret(t, ns, secretName, secData)).To(Succeed())
+ g.Expect(CreatePlainTextSecret(t, ctx, ns, secretName, secData)).To(Succeed())
- g.Expect(KamelBindWithID(t, operatorID, ns,
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-t", "mount.configs=secret:"+secretName,
@@ -152,12 +153,12 @@ func TestPipeConfig(t *testing.T) {
"--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 pipe named secret message"))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("myPipeNamedSecretLogger"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("My pipe named secret message"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("myPipeNamedSecretLogger"))
- g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed())
- g.Expect(DeleteSecret(t, ns, secretName)).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Expect(DeleteSecret(t, ctx, ns, secretName)).To(Succeed())
})
t.Run("run test implicit named config using mounted configmap", func(t *testing.T) {
@@ -167,9 +168,9 @@ func TestPipeConfig(t *testing.T) {
var cmData = make(map[string]string)
cmData["camel.kamelet.my-pipe-timer-source.mynamedconfig.message"] = "My pipe named configmap message"
cmData["camel.kamelet.my-pipe-log-sink.mynamedconfig.loggerName"] = "myPipeNamedConfigmapLogger"
- g.Expect(CreatePlainTextConfigmap(t, ns, cmName, cmData)).To(Succeed())
+ g.Expect(CreatePlainTextConfigmap(t, ctx, ns, cmName, cmData)).To(Succeed())
- g.Expect(KamelBindWithID(t, operatorID, ns,
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-t", "mount.configs=configmap:"+cmName,
@@ -178,12 +179,12 @@ func TestPipeConfig(t *testing.T) {
"--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 pipe named configmap message"))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("myPipeNamedConfigmapLogger"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("My pipe named configmap message"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("myPipeNamedConfigmapLogger"))
- g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed())
- g.Expect(DeleteConfigmap(t, ns, cmName)).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Expect(DeleteConfigmap(t, ctx, ns, cmName)).To(Succeed())
})
t.Run("run test implicit specific config using mounted secret", func(t *testing.T) {
name := RandomizedSuffixName("my-pipe-with-specific-secret")
@@ -192,9 +193,9 @@ func TestPipeConfig(t *testing.T) {
var secData = make(map[string]string)
secData["mynamedconfig.message"] = "My pipe specific secret message"
secData["mynamedconfig.loggerName"] = "myPipeSpecificSecretLogger"
- g.Expect(CreatePlainTextSecret(t, ns, secretName, secData)).To(Succeed())
+ g.Expect(CreatePlainTextSecret(t, ctx, ns, secretName, secData)).To(Succeed())
- g.Expect(KamelBindWithID(t, operatorID, ns,
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-t", "mount.configs=secret:"+secretName,
@@ -203,12 +204,12 @@ func TestPipeConfig(t *testing.T) {
"--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 pipe specific secret message"))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("myPipeSpecificSecretLogger"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("My pipe specific secret message"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("myPipeSpecificSecretLogger"))
- g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed())
- g.Expect(DeleteSecret(t, ns, secretName)).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Expect(DeleteSecret(t, ctx, ns, secretName)).To(Succeed())
})
t.Run("run test implicit specific config using mounted configmap", func(t *testing.T) {
name := RandomizedSuffixName("my-pipe-with-specific-configmap")
@@ -217,9 +218,9 @@ func TestPipeConfig(t *testing.T) {
var cmData = make(map[string]string)
cmData["mynamedconfig.message"] = "My pipe specific configmap message"
cmData["mynamedconfig.loggerName"] = "myPipeSpecificConfgmapLogger"
- g.Expect(CreatePlainTextConfigmap(t, ns, cmName, cmData)).To(Succeed())
+ g.Expect(CreatePlainTextConfigmap(t, ctx, ns, cmName, cmData)).To(Succeed())
- g.Expect(KamelBindWithID(t, operatorID, ns,
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-t", "mount.configs=configmap:"+cmName,
@@ -228,15 +229,15 @@ func TestPipeConfig(t *testing.T) {
"--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 pipe specific configmap message"))
- g.Eventually(IntegrationLogs(t, ns, name)).Should(ContainSubstring("myPipeSpecificConfgmapLogger"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("My pipe specific configmap message"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("myPipeSpecificConfgmapLogger"))
- g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed())
- g.Expect(DeleteConfigmap(t, ns, cmName)).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Expect(DeleteConfigmap(t, ctx, ns, cmName)).To(Succeed())
})
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/languages/groovy_test.go b/e2e/common/languages/groovy_test.go
index d4aa49724..424f1d02e 100644
--- a/e2e/common/languages/groovy_test.go
+++ b/e2e/common/languages/groovy_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package languages
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,21 +37,21 @@ import (
func TestRunSimpleGroovyExamples(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-runtimes-groovy"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("run groovy", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/groovy.groovy").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "groovy"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "groovy", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/groovy.groovy").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "groovy"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "groovy", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/languages/java_test.go b/e2e/common/languages/java_test.go
index 9e6873e11..7a94420f4 100644
--- a/e2e/common/languages/java_test.go
+++ b/e2e/common/languages/java_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package languages
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,21 +37,21 @@ import (
func TestRunSimpleJavaExamples(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-runtimes-java"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("run java", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/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!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/languages/js_test.go b/e2e/common/languages/js_test.go
index 4234f2807..a07d3dbe9 100644
--- a/e2e/common/languages/js_test.go
+++ b/e2e/common/languages/js_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package languages
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,21 +37,21 @@ import (
func TestRunSimpleJavaScriptExamples(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-runtimes-js"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("run js", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/js.js").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "js"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "js", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "js"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/js.js").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "js"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "js", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "js"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/languages/kotlin_test.go b/e2e/common/languages/kotlin_test.go
index e1e360d46..c0cac7493 100644
--- a/e2e/common/languages/kotlin_test.go
+++ b/e2e/common/languages/kotlin_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package languages
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,21 +37,21 @@ import (
func TestRunSimpleKotlinExamples(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-runtimes-kotlin"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("run kotlin", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/kotlin.kts").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "kotlin"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "kotlin", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "kotlin"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/kotlin.kts").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "kotlin"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "kotlin", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "kotlin"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/languages/polyglot_test.go b/e2e/common/languages/polyglot_test.go
index 21a5d51f1..457ded99f 100644
--- a/e2e/common/languages/polyglot_test.go
+++ b/e2e/common/languages/polyglot_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package languages
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,22 +37,22 @@ import (
func TestRunPolyglotExamples(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-runtimes-polyglot"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("run polyglot", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "--name", "polyglot", "files/js-polyglot.js", "files/yaml-polyglot.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "polyglot"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "polyglot", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "polyglot"), TestTimeoutShort).Should(ContainSubstring("Magicpolyglot-yaml"))
- g.Eventually(IntegrationLogs(t, ns, "polyglot"), TestTimeoutShort).Should(ContainSubstring("Magicpolyglot-js"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--name", "polyglot", "files/js-polyglot.js", "files/yaml-polyglot.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "polyglot"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "polyglot", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "polyglot"), TestTimeoutShort).Should(ContainSubstring("Magicpolyglot-yaml"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "polyglot"), TestTimeoutShort).Should(ContainSubstring("Magicpolyglot-js"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/languages/xml_test.go b/e2e/common/languages/xml_test.go
index a53d4da32..90c3ccde0 100644
--- a/e2e/common/languages/xml_test.go
+++ b/e2e/common/languages/xml_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package languages
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,21 +37,21 @@ import (
func TestRunSimpleXmlExamples(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-runtimes-xml"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("run xml", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/xml.xml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "xml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "xml", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "xml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/xml.xml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "xml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "xml", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "xml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/languages/yaml_test.go b/e2e/common/languages/yaml_test.go
index 270445375..6eb6b4482 100644
--- a/e2e/common/languages/yaml_test.go
+++ b/e2e/common/languages/yaml_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package languages
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,21 +37,21 @@ import (
func TestRunSimpleYamlExamples(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-runtimes-yaml"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("run yaml", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/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(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "yaml", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/main_test.go b/e2e/common/main_test.go
index ff84d996c..f71348506 100644
--- a/e2e/common/main_test.go
+++ b/e2e/common/main_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package common
import (
+ "context"
"fmt"
"os"
"testing"
@@ -48,18 +49,19 @@ func TestMain(m *testing.M) {
fmt.Printf("Test setup failed! - %s\n", message)
})
+ ctx := context.TODO()
var t *testing.T
g.Expect(TestClient(t)).ShouldNot(BeNil())
- g.Expect(KamelRunWithID(t, operatorID, ns, "languages/files/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!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "languages/files/Java.java").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(KamelRunWithID(t, operatorID, ns, "languages/files/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(KamelRunWithID(t, ctx, operatorID, ns, "languages/files/yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "yaml", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
os.Exit(m.Run())
}
diff --git a/e2e/common/misc/client_test.go b/e2e/common/misc/client_test.go
index 9a5f44739..54dbbd99d 100644
--- a/e2e/common/misc/client_test.go
+++ b/e2e/common/misc/client_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"testing"
"github.com/stretchr/testify/assert"
@@ -41,32 +42,31 @@ import (
func TestClientFunctionalities(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
-
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
cfg, err := config.GetConfig()
require.NoError(t, err)
camel, err := versioned.NewForConfig(cfg)
require.NoError(t, err)
- lst, err := camel.CamelV1().Integrations(ns).List(TestContext, metav1.ListOptions{})
+ lst, err := camel.CamelV1().Integrations(ns).List(ctx, metav1.ListOptions{})
require.NoError(t, err)
assert.Empty(t, lst.Items)
- integration, err := camel.CamelV1().Integrations(ns).Create(TestContext, &v1.Integration{
+ integration, err := camel.CamelV1().Integrations(ns).Create(ctx, &v1.Integration{
ObjectMeta: metav1.ObjectMeta{
Name: "dummy",
},
}, metav1.CreateOptions{})
require.NoError(t, err)
- lst, err = camel.CamelV1().Integrations(ns).List(TestContext, metav1.ListOptions{})
+ lst, err = camel.CamelV1().Integrations(ns).List(ctx, metav1.ListOptions{})
require.NoError(t, err)
assert.NotEmpty(t, lst.Items)
assert.Equal(t, lst.Items[0].Name, integration.Name)
- err = camel.CamelV1().Integrations(ns).Delete(TestContext, "dummy", metav1.DeleteOptions{})
+ err = camel.CamelV1().Integrations(ns).Delete(ctx, "dummy", metav1.DeleteOptions{})
require.NoError(t, err)
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/misc/cron_test.go b/e2e/common/misc/cron_test.go
index 339af3da7..256ef653c 100644
--- a/e2e/common/misc/cron_test.go
+++ b/e2e/common/misc/cron_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,49 +37,49 @@ import (
func TestRunCronExample(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-cron"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("cron", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/cron.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationCronJob(t, ns, "cron"), TestTimeoutLong).ShouldNot(BeNil())
- g.Eventually(IntegrationConditionStatus(t, ns, "cron", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "cron"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/cron.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationCronJob(t, ctx, ns, "cron"), TestTimeoutLong).ShouldNot(BeNil())
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "cron", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "cron"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!"))
})
t.Run("cron-yaml", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/cron-yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationCronJob(t, ns, "cron-yaml"), TestTimeoutLong).ShouldNot(BeNil())
- g.Eventually(IntegrationConditionStatus(t, ns, "cron-yaml", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "cron-yaml"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/cron-yaml.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationCronJob(t, ctx, ns, "cron-yaml"), TestTimeoutLong).ShouldNot(BeNil())
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "cron-yaml", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "cron-yaml"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!"))
})
t.Run("cron-timer", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/cron-timer.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationCronJob(t, ns, "cron-timer"), TestTimeoutLong).ShouldNot(BeNil())
- g.Eventually(IntegrationConditionStatus(t, ns, "cron-timer", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "cron-timer"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/cron-timer.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationCronJob(t, ctx, ns, "cron-timer"), TestTimeoutLong).ShouldNot(BeNil())
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "cron-timer", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "cron-timer"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!"))
})
t.Run("cron-fallback", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/cron-fallback.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "cron-fallback"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "cron-fallback", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "cron-fallback"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/cron-fallback.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "cron-fallback"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "cron-fallback", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "cron-fallback"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
t.Run("cron-quartz", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/cron-quartz.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "cron-quartz"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "cron-quartz", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "cron-quartz"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/cron-quartz.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "cron-quartz"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "cron-quartz", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "cron-quartz"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/misc/integration_fail_test.go b/e2e/common/misc/integration_fail_test.go
index b2468bea3..cdd731be4 100644
--- a/e2e/common/misc/integration_fail_test.go
+++ b/e2e/common/misc/integration_fail_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"testing"
"time"
@@ -37,158 +38,157 @@ import (
func TestBadRouteIntegration(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-bad-route"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("run bad java route", func(t *testing.T) {
name := RandomizedSuffixName("bad-route")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/BadRoute.java", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/BadRoute.java", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionFalse))
// Make sure the Integration can be scaled
- g.Expect(ScaleIntegration(t, ns, name, 2)).To(Succeed())
+ g.Expect(ScaleIntegration(t, ctx, ns, name, 2)).To(Succeed())
// Check the scale cascades into the Deployment scale
- g.Eventually(IntegrationPods(t, ns, name), TestTimeoutShort).Should(HaveLen(2))
+ g.Eventually(IntegrationPods(t, ctx, ns, name), TestTimeoutShort).Should(HaveLen(2))
// Check it also cascades into the Integration scale subresource Status field
- g.Eventually(IntegrationStatusReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 2)))
// Check the Integration stays in error phase
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
// Kit valid
- kitName := IntegrationKit(t, ns, name)()
- integrationKitNamespace := IntegrationKitNamespace(t, ns, name)()
- g.Eventually(KitPhase(t, integrationKitNamespace, kitName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
+ kitName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
+ g.Eventually(KitPhase(t, ctx, integrationKitNamespace, kitName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
})
t.Run("run missing dependency java route", func(t *testing.T) {
name := RandomizedSuffixName("java-route")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name,
"-d", "mvn:com.example:nonexistent:1.0").Execute()).To(Succeed())
// Integration in error
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseError))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionKitAvailable), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionKitAvailable), TestTimeoutShort).Should(
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionKitAvailable), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionKitAvailable), TestTimeoutShort).Should(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionKitAvailableReason)))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionKitAvailable), TestTimeoutShort).Should(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionKitAvailable), TestTimeoutShort).Should(
WithTransform(IntegrationConditionMessage, ContainSubstring("is in state \"Error\"")))
// Kit in error
- kitName := IntegrationKit(t, ns, name)()
- integrationKitNamespace := IntegrationKitNamespace(t, ns, name)()
- g.Eventually(KitPhase(t, integrationKitNamespace, kitName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseError))
+ kitName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
+ g.Eventually(KitPhase(t, ctx, integrationKitNamespace, kitName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseError))
//Build in error with 5 attempts
- build := Build(t, integrationKitNamespace, kitName)()
+ build := Build(t, ctx, integrationKitNamespace, kitName)()
g.Eventually(build.Status.Phase, TestTimeoutShort).Should(Equal(v1.BuildPhaseError))
g.Eventually(build.Status.Failure.Recovery.Attempt, TestTimeoutShort).Should(Equal(5))
// Fixing the route should reconcile the Integration
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseRunning))
// New Kit success
- kitRecoveryName := IntegrationKit(t, ns, name)()
- integrationKitRecoveryNamespace := IntegrationKitNamespace(t, ns, name)()
- g.Eventually(KitPhase(t, integrationKitRecoveryNamespace, kitRecoveryName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
+ kitRecoveryName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitRecoveryNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
+ g.Eventually(KitPhase(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
g.Expect(kitRecoveryName).NotTo(Equal(kitName))
// New Build success
- buildRecovery := Build(t, integrationKitRecoveryNamespace, kitRecoveryName)()
+ buildRecovery := Build(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName)()
g.Eventually(buildRecovery.Status.Phase, TestTimeoutShort).Should(Equal(v1.BuildPhaseSucceeded))
})
t.Run("run invalid dependency java route", func(t *testing.T) {
name := RandomizedSuffixName("invalid-dependency")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
- "-d", "camel:non-existent").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-d", "camel:non-existent").Execute()).To(Succeed())
// Integration in error with Initialization Failed condition
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseError))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionFalse))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(And(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(And(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionInitializationFailedReason)),
WithTransform(IntegrationConditionMessage, HavePrefix("error during trait customization")),
))
// Kit shouldn't be created
- g.Consistently(IntegrationKit(t, ns, name), 10*time.Second).Should(BeEmpty())
+ g.Consistently(IntegrationKit(t, ctx, ns, name), 10*time.Second).Should(BeEmpty())
// Fixing the route should reconcile the Integration in Initialization Failed condition to Running
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// New Kit success
- kitRecoveryName := IntegrationKit(t, ns, name)()
- integrationKitRecoveryNamespace := IntegrationKitNamespace(t, ns, name)()
- g.Eventually(KitPhase(t, integrationKitRecoveryNamespace, kitRecoveryName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
+ kitRecoveryName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitRecoveryNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
+ g.Eventually(KitPhase(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
// New Build success
- buildRecovery := Build(t, integrationKitRecoveryNamespace, kitRecoveryName)()
+ buildRecovery := Build(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName)()
g.Eventually(buildRecovery.Status.Phase, TestTimeoutShort).Should(Equal(v1.BuildPhaseSucceeded))
})
t.Run("run unresolvable component java route", func(t *testing.T) {
name := RandomizedSuffixName("unresolvable-route")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Unresolvable.java", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Unresolvable.java", "--name", name).Execute()).To(Succeed())
// Integration in error with Initialization Failed condition
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionFalse))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(And(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(And(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionInitializationFailedReason)),
WithTransform(IntegrationConditionMessage, HavePrefix("error during trait customization")),
))
// Kit shouldn't be created
- g.Consistently(IntegrationKit(t, ns, name), 10*time.Second).Should(BeEmpty())
+ g.Consistently(IntegrationKit(t, ctx, ns, name), 10*time.Second).Should(BeEmpty())
// Fixing the route should reconcile the Integration in Initialization Failed condition to Running
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// New Kit success
- kitRecoveryName := IntegrationKit(t, ns, name)()
- integrationKitRecoveryNamespace := IntegrationKitNamespace(t, ns, name)()
- g.Eventually(KitPhase(t, integrationKitRecoveryNamespace, kitRecoveryName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
+ kitRecoveryName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitRecoveryNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
+ g.Eventually(KitPhase(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
// New Build success
- buildRecovery := Build(t, integrationKitRecoveryNamespace, kitRecoveryName)()
+ buildRecovery := Build(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName)()
g.Eventually(buildRecovery.Status.Phase, TestTimeoutShort).Should(Equal(v1.BuildPhaseSucceeded))
})
t.Run("run invalid java route", func(t *testing.T) {
name := RandomizedSuffixName("invalid-java-route")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/InvalidJava.java", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/InvalidJava.java", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionFalse))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Compilation error"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Compilation error"))
// Kit valid
- kitName := IntegrationKit(t, ns, name)()
- integrationKitNamespace := IntegrationKitNamespace(t, ns, name)()
- g.Eventually(KitPhase(t, integrationKitNamespace, kitName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
+ kitName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
+ g.Eventually(KitPhase(t, ctx, integrationKitNamespace, kitName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
// Fixing the route should reconcile the Integration in Initialization Failed condition to Running
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// Kit should not have changed
- kitRecoveryName := IntegrationKit(t, ns, name)()
+ kitRecoveryName := IntegrationKit(t, ctx, ns, name)()
g.Expect(kitRecoveryName).To(Equal(kitName))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/misc/integration_trait_update_test.go b/e2e/common/misc/integration_trait_update_test.go
index d56fee0f1..839c51e58 100644
--- a/e2e/common/misc/integration_trait_update_test.go
+++ b/e2e/common/misc/integration_trait_update_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"testing"
"time"
@@ -36,27 +37,27 @@ import (
func TestTraitUpdates(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-trait-update"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("run and update trait", func(t *testing.T) {
name := RandomizedSuffixName("yaml-route")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml", "--name", name).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.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
var numberOfPods = func(pods *int32) bool {
return *pods >= 1 && *pods <= 2
}
// Adding a property will change the camel trait
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml", "--name", name, "-p", "hello=world").Execute()).To(Succeed())
- g.Consistently(IntegrationPodsNumbers(t, ns, name), TestTimeoutShort, 1*time.Second).Should(Satisfy(numberOfPods))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml", "--name", name, "-p", "hello=world").Execute()).To(Succeed())
+ g.Consistently(IntegrationPodsNumbers(t, ctx, ns, name), TestTimeoutShort, 1*time.Second).Should(Satisfy(numberOfPods))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/misc/kamelet_test.go b/e2e/common/misc/kamelet_test.go
index 6558d4ba8..f9b58f279 100644
--- a/e2e/common/misc/kamelet_test.go
+++ b/e2e/common/misc/kamelet_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,13 +37,13 @@ import (
func TestKameletClasspathLoading(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-kamelet-loading"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
// Store a configmap on the cluster
var cmData = make(map[string]string)
@@ -117,28 +118,23 @@ spec:
constant: "{{contentType}}"
- to: kamelet:sink
`
- CreatePlainTextConfigmap(t, ns, "my-kamelet-cm", cmData)
+ CreatePlainTextConfigmap(t, ctx, ns, "my-kamelet-cm", cmData)
// Basic
t.Run("test basic case", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/TimerKameletIntegration.java", "-t", "kamelets.enabled=false",
- "--resource", "configmap:my-kamelet-cm@/kamelets",
- "-p camel.component.kamelet.location=file:/kamelets",
- "-d", "camel:yaml-dsl",
- // kamelet dependencies
- "-d", "camel:timer").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "timer-kamelet-integration"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "timer-kamelet-integration")).Should(ContainSubstring("important message"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegration.java", "-t", "kamelets.enabled=false", "--resource", "configmap:my-kamelet-cm@/kamelets", "-p camel.component.kamelet.location=file:/kamelets", "-d", "camel:yaml-dsl", "-d", "camel:timer").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "timer-kamelet-integration"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "timer-kamelet-integration")).Should(ContainSubstring("important message"))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, "timer-kamelet-integration")).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, "timer-kamelet-integration")()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, "timer-kamelet-integration")).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, "timer-kamelet-integration")()
kameletsTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "kamelets")
g.Expect(kameletsTrait).ToNot(BeNil())
g.Expect(len(kameletsTrait)).To(Equal(1))
g.Expect(kameletsTrait["enabled"]).To(Equal(false))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/misc/kamelet_update_test.go b/e2e/common/misc/kamelet_update_test.go
index f97eb530c..2be7c7e82 100644
--- a/e2e/common/misc/kamelet_update_test.go
+++ b/e2e/common/misc/kamelet_update_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"testing"
"time"
@@ -37,27 +38,27 @@ const customLabel = "custom-label"
func TestBundleKameletUpdate(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-kamelet-bundle"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- 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.Expect(createBundleKamelet(t, ctx, operatorID, ns, "my-http-sink")()).To(Succeed()) // Going to be replaced
+ g.Expect(createUserKamelet(t, ctx, operatorID, ns, "user-sink")()).To(Succeed()) // Left intact by the operator
- g.Eventually(Kamelet(t, "my-http-sink", ns)).
+ g.Eventually(Kamelet(t, ctx, "my-http-sink", ns)).
Should(WithTransform(KameletLabels, HaveKeyWithValue(customLabel, "true")))
- g.Consistently(Kamelet(t, "user-sink", ns), 5*time.Second, 1*time.Second).
+ g.Consistently(Kamelet(t, ctx, "user-sink", ns), 5*time.Second, 1*time.Second).
Should(WithTransform(KameletLabels, HaveKeyWithValue(customLabel, "true")))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
-func createBundleKamelet(t *testing.T, operatorID string, ns string, name string) func() error {
+func createBundleKamelet(t *testing.T, ctx context.Context, operatorID string, ns string, name string) func() error {
flow := map[string]interface{}{
"from": map[string]interface{}{
"uri": "kamelet:source",
@@ -68,10 +69,10 @@ func createBundleKamelet(t *testing.T, operatorID string, ns string, name string
customLabel: "true",
v1.KameletBundledLabel: "true",
}
- return CreateKamelet(t, operatorID, ns, name, flow, nil, labels)
+ return CreateKamelet(t, operatorID, ctx, ns, name, flow, nil, labels)
}
-func createUserKamelet(t *testing.T, operatorID string, ns string, name string) func() error {
+func createUserKamelet(t *testing.T, ctx context.Context, operatorID string, ns string, name string) func() error {
flow := map[string]interface{}{
"from": map[string]interface{}{
"uri": "kamelet:source",
@@ -81,5 +82,5 @@ func createUserKamelet(t *testing.T, operatorID string, ns string, name string)
labels := map[string]string{
customLabel: "true",
}
- return CreateKamelet(t, operatorID, ns, name, flow, nil, labels)
+ return CreateKamelet(t, operatorID, ctx, ns, name, flow, nil, labels)
}
diff --git a/e2e/common/misc/maven_repository_test.go b/e2e/common/misc/maven_repository_test.go
index 5b2ea10d1..3be75182e 100644
--- a/e2e/common/misc/maven_repository_test.go
+++ b/e2e/common/misc/maven_repository_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,29 +37,25 @@ import (
func TestRunExtraRepository(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-extra-repository"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--maven-repository", "https://maven.repository.redhat.com/ga@id=redhat",
- "--dependency", "mvn:org.jolokia:jolokia-core:1.7.1.redhat-00001",
- "--name", name,
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--maven-repository", "https://maven.repository.redhat.com/ga@id=redhat", "--dependency", "mvn:org.jolokia:jolokia-core:1.7.1.redhat-00001", "--name", name).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("Magicstring!"))
- g.Eventually(Integration(t, ns, name)).Should(WithTransform(IntegrationSpec, And(
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(Integration(t, ctx, ns, name)).Should(WithTransform(IntegrationSpec, And(
HaveExistingField("Repositories"),
HaveField("Repositories", ContainElements("https://maven.repository.redhat.com/ga@id=redhat")),
)))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/misc/pipe_test.go b/e2e/common/misc/pipe_test.go
index e5e4db529..eb79f8208 100644
--- a/e2e/common/misc/pipe_test.go
+++ b/e2e/common/misc/pipe_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -37,75 +38,66 @@ import (
func TestPipe(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-pipe"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
// Error Handler testing
t.Run("test error handler", func(t *testing.T) {
- 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())
+ g.Expect(createErrorProducerKamelet(t, ctx, operatorID, ns, "my-own-error-producer-source")()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, operatorID, ns, "my-own-log-sink")()).To(Succeed())
t.Run("throw error test", func(t *testing.T) {
- g.Expect(KamelBindWithID(t, operatorID, ns,
- "my-own-error-producer-source",
- "my-own-log-sink",
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "my-own-error-producer-source", "my-own-log-sink",
"--error-handler", "sink:my-own-log-sink",
"-p", "source.message=throw Error",
"-p", "sink.loggerName=integrationLogger",
"-p", "error-handler.loggerName=kameletErrorHandler",
// Needed in the test to make sure to do the right string comparison later
"-t", "logging.color=false",
- "--name", "throw-error-binding",
- ).Execute()).To(Succeed())
+ "--name", "throw-error-binding").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "throw-error-binding"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "throw-error-binding"), TestTimeoutShort).Should(ContainSubstring("[kameletErrorHandler] (Camel (camel-1) thread #1 - timer://tick)"))
- g.Eventually(IntegrationLogs(t, ns, "throw-error-binding"), TestTimeoutShort).ShouldNot(ContainSubstring("[integrationLogger] (Camel (camel-1) thread #1 - timer://tick)"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "throw-error-binding"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "throw-error-binding"), TestTimeoutShort).Should(ContainSubstring("[kameletErrorHandler] (Camel (camel-1) thread #1 - timer://tick)"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "throw-error-binding"), TestTimeoutShort).ShouldNot(ContainSubstring("[integrationLogger] (Camel (camel-1) thread #1 - timer://tick)"))
})
t.Run("don't throw error test", func(t *testing.T) {
- g.Expect(KamelBindWithID(t, operatorID, ns,
- "my-own-error-producer-source",
- "my-own-log-sink",
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "my-own-error-producer-source", "my-own-log-sink",
"--error-handler", "sink:my-own-log-sink",
"-p", "source.message=true",
"-p", "sink.loggerName=integrationLogger",
"-p", "error-handler.loggerName=kameletErrorHandler",
// Needed in the test to make sure to do the right string comparison later
"-t", "logging.color=false",
- "--name", "no-error-binding",
- ).Execute()).To(Succeed())
+ "--name", "no-error-binding").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "no-error-binding"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "no-error-binding"), TestTimeoutShort).ShouldNot(ContainSubstring("[kameletErrorHandler] (Camel (camel-1) thread #1 - timer://tick)"))
- g.Eventually(IntegrationLogs(t, ns, "no-error-binding"), TestTimeoutShort).Should(ContainSubstring("[integrationLogger] (Camel (camel-1) thread #1 - timer://tick)"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "no-error-binding"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "no-error-binding"), TestTimeoutShort).ShouldNot(ContainSubstring("[kameletErrorHandler] (Camel (camel-1) thread #1 - timer://tick)"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "no-error-binding"), TestTimeoutShort).Should(ContainSubstring("[integrationLogger] (Camel (camel-1) thread #1 - timer://tick)"))
})
})
//Pipe with traits testing
t.Run("test Pipe with trait", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, operatorID, ns, "my-own-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "my-own-timer-source")()).To(Succeed())
// Log sink kamelet exists from previous test
- g.Expect(KamelBindWithID(t, operatorID, ns,
- "my-own-timer-source",
- "my-own-log-sink",
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "my-own-timer-source", "my-own-log-sink",
"-p", "source.message=hello from test",
"-p", "sink.loggerName=integrationLogger",
"--annotation", "trait.camel.apache.org/camel.properties=[\"camel.prop1=a\",\"camel.prop2=b\"]",
- "--name", "kb-with-traits",
- ).Execute()).To(Succeed())
+ "--name", "kb-with-traits").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "kb-with-traits"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "kb-with-traits"), TestTimeoutShort).Should(ContainSubstring("hello from test"))
- g.Eventually(IntegrationLogs(t, ns, "kb-with-traits"), TestTimeoutShort).Should(ContainSubstring("integrationLogger"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "kb-with-traits"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "kb-with-traits"), TestTimeoutShort).Should(ContainSubstring("hello from test"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "kb-with-traits"), TestTimeoutShort).Should(ContainSubstring("integrationLogger"))
})
// Pipe with wrong spec
@@ -113,22 +105,22 @@ func TestPipe(t *testing.T) {
name := RandomizedSuffixName("bad-klb")
kb := v1.NewPipe(ns, name)
kb.Spec = v1.PipeSpec{}
- _, err := kubernetes.ReplaceResource(TestContext, TestClient(t), &kb)
+ _, err := kubernetes.ReplaceResource(ctx, TestClient(t), &kb)
g.Eventually(err).Should(BeNil())
- g.Eventually(PipePhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.PipePhaseError))
- g.Eventually(PipeConditionStatus(t, ns, name, v1.PipeConditionReady), TestTimeoutShort).ShouldNot(Equal(corev1.ConditionTrue))
- g.Eventually(PipeCondition(t, ns, name, v1.PipeIntegrationConditionError), TestTimeoutShort).Should(
+ g.Eventually(PipePhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.PipePhaseError))
+ g.Eventually(PipeConditionStatus(t, ctx, ns, name, v1.PipeConditionReady), TestTimeoutShort).ShouldNot(Equal(corev1.ConditionTrue))
+ g.Eventually(PipeCondition(t, ctx, ns, name, v1.PipeIntegrationConditionError), TestTimeoutShort).Should(
WithTransform(PipeConditionMessage, And(
ContainSubstring("could not determine source URI"),
ContainSubstring("no ref or URI specified in endpoint"),
)))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
-func createErrorProducerKamelet(t *testing.T, operatorID string, ns string, name string) func() error {
+func createErrorProducerKamelet(t *testing.T, ctx context.Context, operatorID string, ns string, name string) func() error {
props := map[string]v1.JSONSchemaProp{
"message": {
Type: "string",
@@ -156,5 +148,5 @@ func createErrorProducerKamelet(t *testing.T, operatorID string, ns string, name
},
}
- return CreateKamelet(t, operatorID, ns, name, flow, props, nil)
+ return CreateKamelet(t, operatorID, ctx, ns, name, flow, props, nil)
}
diff --git a/e2e/common/misc/pipe_with_image_test.go b/e2e/common/misc/pipe_with_image_test.go
index f898de01b..de47c8cda 100644
--- a/e2e/common/misc/pipe_with_image_test.go
+++ b/e2e/common/misc/pipe_with_image_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -37,71 +38,53 @@ import (
func TestPipeWithImage(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-pipe-image"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
bindingID := "with-image-binding"
t.Run("run with initial image", func(t *testing.T) {
expectedImage := "docker.io/jmalloc/echo-server:0.3.2"
- g.Expect(KamelBindWithID(t, operatorID, ns,
- "my-own-timer-source",
- "my-own-log-sink",
- "--annotation", "trait.camel.apache.org/container.image="+expectedImage,
- "--annotation", "trait.camel.apache.org/jvm.enabled=false",
- "--annotation", "trait.camel.apache.org/kamelets.enabled=false",
- "--annotation", "trait.camel.apache.org/dependencies.enabled=false",
- "--annotation", "test=1",
- "--name", bindingID,
- ).Execute()).To(Succeed())
-
- g.Eventually(IntegrationGeneration(t, ns, bindingID)).
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "my-own-timer-source", "my-own-log-sink", "--annotation", "trait.camel.apache.org/container.image="+expectedImage, "--annotation", "trait.camel.apache.org/jvm.enabled=false", "--annotation", "trait.camel.apache.org/kamelets.enabled=false", "--annotation", "trait.camel.apache.org/dependencies.enabled=false", "--annotation", "test=1", "--name", bindingID).Execute()).To(Succeed())
+
+ g.Eventually(IntegrationGeneration(t, ctx, ns, bindingID)).
Should(gstruct.PointTo(BeNumerically("==", 1)))
- g.Eventually(Integration(t, ns, bindingID)).Should(WithTransform(Annotations, And(
+ g.Eventually(Integration(t, ctx, ns, bindingID)).Should(WithTransform(Annotations, And(
HaveKeyWithValue("test", "1"),
HaveKeyWithValue("trait.camel.apache.org/container.image", expectedImage),
)))
- g.Eventually(IntegrationStatusImage(t, ns, bindingID)).
+ g.Eventually(IntegrationStatusImage(t, ctx, ns, bindingID)).
Should(Equal(expectedImage))
- g.Eventually(IntegrationPodPhase(t, ns, bindingID), TestTimeoutLong).
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, bindingID), TestTimeoutLong).
Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPodImage(t, ns, bindingID)).
+ g.Eventually(IntegrationPodImage(t, ctx, ns, bindingID)).
Should(Equal(expectedImage))
})
t.Run("run with new image", func(t *testing.T) {
expectedImage := "docker.io/jmalloc/echo-server:0.3.3"
- g.Expect(KamelBindWithID(t, operatorID, ns,
- "my-own-timer-source",
- "my-own-log-sink",
- "--annotation", "trait.camel.apache.org/container.image="+expectedImage,
- "--annotation", "trait.camel.apache.org/jvm.enabled=false",
- "--annotation", "trait.camel.apache.org/kamelets.enabled=false",
- "--annotation", "trait.camel.apache.org/dependencies.enabled=false",
- "--annotation", "test=2",
- "--name", bindingID,
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationGeneration(t, ns, bindingID)).
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "my-own-timer-source", "my-own-log-sink", "--annotation", "trait.camel.apache.org/container.image="+expectedImage, "--annotation", "trait.camel.apache.org/jvm.enabled=false", "--annotation", "trait.camel.apache.org/kamelets.enabled=false", "--annotation", "trait.camel.apache.org/dependencies.enabled=false", "--annotation", "test=2", "--name", bindingID).Execute()).To(Succeed())
+ g.Eventually(IntegrationGeneration(t, ctx, ns, bindingID)).
Should(gstruct.PointTo(BeNumerically("==", 1)))
- g.Eventually(Integration(t, ns, bindingID)).Should(WithTransform(Annotations, And(
+ g.Eventually(Integration(t, ctx, ns, bindingID)).Should(WithTransform(Annotations, And(
HaveKeyWithValue("test", "2"),
HaveKeyWithValue("trait.camel.apache.org/container.image", expectedImage),
)))
- g.Eventually(IntegrationStatusImage(t, ns, bindingID)).
+ g.Eventually(IntegrationStatusImage(t, ctx, ns, bindingID)).
Should(Equal(expectedImage))
- g.Eventually(IntegrationPodPhase(t, ns, bindingID), TestTimeoutLong).
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, bindingID), TestTimeoutLong).
Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPodImage(t, ns, bindingID)).
+ g.Eventually(IntegrationPodImage(t, ctx, ns, bindingID)).
Should(Equal(expectedImage))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/misc/registry_maven_wagon_test.go b/e2e/common/misc/registry_maven_wagon_test.go
index 3d590a3e8..9f474eee5 100644
--- a/e2e/common/misc/registry_maven_wagon_test.go
+++ b/e2e/common/misc/registry_maven_wagon_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"fmt"
"path/filepath"
"testing"
@@ -47,13 +48,13 @@ func TestImageRegistryIsAMavenRepository(t *testing.T) {
return
}
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-registry-maven-repo"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("image registry is a maven repository", func(t *testing.T) {
// Create integration that should decrypt an encrypted message to "foobar" and log it
@@ -63,59 +64,55 @@ 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, ctx, operatorID, ns, "files/registry/FoobarDecryption.java",
"--name", name,
"-d", fmt.Sprintf("file://%s", jar),
- "-d", fmt.Sprintf("file://%s", pom),
- ).Execute()).To(Succeed())
+ "-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, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, 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, ctx, operatorID, ns, "files/registry/LaughingRoute.java",
"--name", name,
"-p", "location=/deployments/?filename=laugh.txt",
- "-d", "file://files/registry/laugh.txt",
- ).Execute()).To(Succeed())
+ "-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, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, 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, ctx, operatorID, ns, "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())
+ "-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, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, 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, ctx, operatorID, ns, "files/registry/LaughingRoute.java",
"--name", name,
"-p", "location=files/registry/",
- "-d", fmt.Sprintf("file://files/registry/laughs/?targetPath=files/registry/"),
- ).Execute()).To(Succeed())
+ "-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, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("haha"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("hehe"))
})
t.Run("pom file is extracted from JAR", func(t *testing.T) {
@@ -124,29 +121,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, ctx, operatorID, ns, "files/registry/FoobarDecryption.java",
"--name", name,
- "-d", fmt.Sprintf("file://%s", jar),
- ).Execute()).To(Succeed())
+ "-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, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("foobar"))
})
t.Run("dependency can be used at build time", func(t *testing.T) {
// Create integration that should run a 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,
- "-d", "file://files/registry/classpath/cheese.xsl?targetPath=xslt/cheese.xsl&classpath=true",
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "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, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, 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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/misc/rest_test.go b/e2e/common/misc/rest_test.go
index 1bbfdaf16..680f06adb 100644
--- a/e2e/common/misc/rest_test.go
+++ b/e2e/common/misc/rest_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"fmt"
"io"
"net/http"
@@ -41,43 +42,43 @@ import (
func TestRunRest(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-rest"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
ocp, err := openshift.IsOpenShift(TestClient(t))
require.NoError(t, err)
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/rest-consumer.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "rest-consumer"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/rest-consumer.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "rest-consumer"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
t.Run("Service works", func(t *testing.T) {
name := RandomizedSuffixName("John")
- service := Service(t, ns, "rest-consumer")
+ service := Service(t, ctx, ns, "rest-consumer")
g.Eventually(service, TestTimeoutShort).ShouldNot(BeNil())
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/rest-producer.yaml", "-p", "serviceName=rest-consumer", "-p", "name="+name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "rest-producer"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "rest-consumer"), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("get %s", name)))
- g.Eventually(IntegrationLogs(t, ns, "rest-producer"), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("%s Doe", name)))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/rest-producer.yaml", "-p", "serviceName=rest-consumer", "-p", "name="+name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "rest-producer"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "rest-consumer"), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("get %s", name)))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "rest-producer"), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("%s Doe", name)))
})
if ocp {
t.Run("Route works", func(t *testing.T) {
name := RandomizedSuffixName("Peter")
- route := Route(t, ns, "rest-consumer")
+ route := Route(t, ctx, ns, "rest-consumer")
g.Eventually(route, TestTimeoutShort).ShouldNot(BeNil())
- g.Eventually(RouteStatus(t, ns, "rest-consumer"), TestTimeoutMedium).Should(Equal("True"))
+ g.Eventually(RouteStatus(t, ctx, ns, "rest-consumer"), TestTimeoutMedium).Should(Equal("True"))
url := fmt.Sprintf("http://%s/customers/%s", route().Spec.Host, name)
g.Eventually(httpRequest(url), TestTimeoutMedium).Should(Equal(fmt.Sprintf("%s Doe", name)))
- g.Eventually(IntegrationLogs(t, ns, "rest-consumer"), TestTimeoutShort).Should(ContainSubstring(fmt.Sprintf("get %s", name)))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "rest-consumer"), TestTimeoutShort).Should(ContainSubstring(fmt.Sprintf("get %s", name)))
})
}
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/misc/scale_binding_test.go b/e2e/common/misc/scale_binding_test.go
index dc9bbe3b5..0b1bdd643 100644
--- a/e2e/common/misc/scale_binding_test.go
+++ b/e2e/common/misc/scale_binding_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -42,13 +43,13 @@ import (
func TestPipeScale(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-pipe-scale"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithIDAndKameletCatalog(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithIDAndKameletCatalog(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
ocp, err := openshift.IsOpenShift(TestClient(t))
require.NoError(t, err)
@@ -58,26 +59,26 @@ func TestPipeScale(t *testing.T) {
}
name := RandomizedSuffixName("timer2log")
- g.Expect(KamelBindWithID(t, operatorID, ns, "timer-source?message=HelloPipe", "log-sink", "--name", name).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(PipeConditionStatus(t, ns, name, v1.PipeConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("HelloPipe"))
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "timer-source?message=HelloPipe", "log-sink", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(PipeConditionStatus(t, ctx, ns, name, v1.PipeConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("HelloPipe"))
t.Run("Update Pipe scale spec", func(t *testing.T) {
- g.Expect(ScalePipe(t, ns, name, 3)).To(Succeed())
+ g.Expect(ScalePipe(t, ctx, ns, name, 3)).To(Succeed())
// Check the scale cascades into the Deployment scale
- g.Eventually(IntegrationPods(t, ns, name), TestTimeoutShort).Should(HaveLen(3))
+ g.Eventually(IntegrationPods(t, ctx, ns, name), TestTimeoutShort).Should(HaveLen(3))
// Check it also cascades into the Integration scale subresource Status field
- g.Eventually(IntegrationStatusReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 3)))
// Check it also cascades into the Pipe scale subresource Status field
- g.Eventually(PipeStatusReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(PipeStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 3)))
// Check the readiness condition becomes truthy back
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
// Finally check the readiness condition becomes truthy back onPipe
- g.Eventually(PipeConditionStatus(t, ns, name, v1.PipeConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(PipeConditionStatus(t, ctx, ns, name, v1.PipeConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
})
t.Run("ScalePipe with polymorphic client", func(t *testing.T) {
@@ -86,21 +87,21 @@ func TestPipeScale(t *testing.T) {
// Patch the integration scale subresource
patch := "{\"spec\":{\"replicas\":2}}"
- _, err = scaleClient.Scales(ns).Patch(TestContext, v1.SchemeGroupVersion.WithResource("Pipes"), name, types.MergePatchType, []byte(patch), metav1.PatchOptions{})
+ _, err = scaleClient.Scales(ns).Patch(ctx, v1.SchemeGroupVersion.WithResource("Pipes"), name, types.MergePatchType, []byte(patch), metav1.PatchOptions{})
g.Expect(err).To(BeNil())
// Check the readiness condition is still truthy as down-scaling
- g.Expect(PipeConditionStatus(t, ns, name, v1.PipeConditionReady)()).To(Equal(corev1.ConditionTrue))
+ g.Expect(PipeConditionStatus(t, ctx, ns, name, v1.PipeConditionReady)()).To(Equal(corev1.ConditionTrue))
// Check the Integration scale subresource Spec field
- g.Eventually(IntegrationSpecReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(IntegrationSpecReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 2)))
// Then check it cascades into the Deployment scale
- g.Eventually(IntegrationPods(t, ns, name), TestTimeoutShort).Should(HaveLen(2))
+ g.Eventually(IntegrationPods(t, ctx, ns, name), TestTimeoutShort).Should(HaveLen(2))
// Check it cascades into the Integration scale subresource Status field
- g.Eventually(IntegrationStatusReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 2)))
// Finally check it cascades into the Pipe scale subresource Status field
- g.Eventually(PipeStatusReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(PipeStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 2)))
})
@@ -109,33 +110,33 @@ func TestPipeScale(t *testing.T) {
g.Expect(err).To(BeNil())
// Getter
- PipeScale, err := camel.CamelV1().Pipes(ns).GetScale(TestContext, name, metav1.GetOptions{})
+ PipeScale, err := camel.CamelV1().Pipes(ns).GetScale(ctx, name, metav1.GetOptions{})
g.Expect(err).To(BeNil())
g.Expect(PipeScale.Spec.Replicas).To(BeNumerically("==", 2))
g.Expect(PipeScale.Status.Replicas).To(BeNumerically("==", 2))
// Setter
PipeScale.Spec.Replicas = 1
- _, err = camel.CamelV1().Pipes(ns).UpdateScale(TestContext, name, PipeScale, metav1.UpdateOptions{})
+ _, err = camel.CamelV1().Pipes(ns).UpdateScale(ctx, name, PipeScale, metav1.UpdateOptions{})
g.Expect(err).To(BeNil())
// Check the readiness condition is still truthy as down-scaling inPipe
- g.Expect(PipeConditionStatus(t, ns, name, v1.PipeConditionReady)()).To(Equal(corev1.ConditionTrue))
+ g.Expect(PipeConditionStatus(t, ctx, ns, name, v1.PipeConditionReady)()).To(Equal(corev1.ConditionTrue))
// Check the Pipe scale subresource Spec field
- g.Eventually(PipeSpecReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(PipeSpecReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 1)))
// Check the readiness condition is still truthy as down-scaling
- g.Expect(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady)()).To(Equal(corev1.ConditionTrue))
+ g.Expect(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady)()).To(Equal(corev1.ConditionTrue))
// Check the Integration scale subresource Spec field
- g.Eventually(IntegrationSpecReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(IntegrationSpecReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 1)))
// Then check it cascades into the Deployment scale
- g.Eventually(IntegrationPods(t, ns, name), TestTimeoutShort).Should(HaveLen(1))
+ g.Eventually(IntegrationPods(t, ctx, ns, name), TestTimeoutShort).Should(HaveLen(1))
// Finally check it cascades into the Integration scale subresource Status field
- g.Eventually(IntegrationStatusReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 1)))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/misc/scale_integration_test.go b/e2e/common/misc/scale_integration_test.go
index c3b697427..d2fb9a37d 100644
--- a/e2e/common/misc/scale_integration_test.go
+++ b/e2e/common/misc/scale_integration_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"fmt"
"testing"
@@ -41,31 +42,31 @@ import (
func TestIntegrationScale(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-integration-scale"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name).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("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
t.Run("Update integration scale spec", func(t *testing.T) {
- g.Expect(ScaleIntegration(t, ns, name, 3)).To(Succeed())
+ g.Expect(ScaleIntegration(t, ctx, ns, name, 3)).To(Succeed())
// Check the readiness condition becomes falsy
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
// Check the scale cascades into the Deployment scale
- g.Eventually(IntegrationPods(t, ns, name), TestTimeoutShort).Should(HaveLen(3))
+ g.Eventually(IntegrationPods(t, ctx, ns, name), TestTimeoutShort).Should(HaveLen(3))
// Check it also cascades into the Integration scale subresource Status field
- g.Eventually(IntegrationStatusReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 3)))
// Finally check the readiness condition becomes truthy back
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
})
t.Run("Scale integration with polymorphic client", func(t *testing.T) {
@@ -74,18 +75,18 @@ func TestIntegrationScale(t *testing.T) {
// Patch the integration scale subresource
patch := "{\"spec\":{\"replicas\":2}}"
- _, err = scaleClient.Scales(ns).Patch(TestContext, v1.SchemeGroupVersion.WithResource("integrations"), name, types.MergePatchType, []byte(patch), metav1.PatchOptions{})
+ _, err = scaleClient.Scales(ns).Patch(ctx, v1.SchemeGroupVersion.WithResource("integrations"), name, types.MergePatchType, []byte(patch), metav1.PatchOptions{})
g.Expect(err).To(BeNil())
// Check the readiness condition is still truthy as down-scaling
- g.Expect(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady)()).To(Equal(corev1.ConditionTrue))
+ g.Expect(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady)()).To(Equal(corev1.ConditionTrue))
// Check the Integration scale subresource Spec field
- g.Eventually(IntegrationSpecReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(IntegrationSpecReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 2)))
// Then check it cascades into the Deployment scale
- g.Eventually(IntegrationPods(t, ns, name), TestTimeoutShort).Should(HaveLen(2))
+ g.Eventually(IntegrationPods(t, ctx, ns, name), TestTimeoutShort).Should(HaveLen(2))
// Finally check it cascades into the Integration scale subresource Status field
- g.Eventually(IntegrationStatusReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 2)))
})
@@ -94,46 +95,46 @@ func TestIntegrationScale(t *testing.T) {
g.Expect(err).To(BeNil())
// Getter
- integrationScale, err := camel.CamelV1().Integrations(ns).GetScale(TestContext, name, metav1.GetOptions{})
+ integrationScale, err := camel.CamelV1().Integrations(ns).GetScale(ctx, name, metav1.GetOptions{})
g.Expect(err).To(BeNil())
g.Expect(integrationScale.Spec.Replicas).To(BeNumerically("==", 2))
g.Expect(integrationScale.Status.Replicas).To(BeNumerically("==", 2))
// Setter
integrationScale.Spec.Replicas = 1
- integrationScale, err = camel.CamelV1().Integrations(ns).UpdateScale(TestContext, name, integrationScale, metav1.UpdateOptions{})
+ integrationScale, err = camel.CamelV1().Integrations(ns).UpdateScale(ctx, name, integrationScale, metav1.UpdateOptions{})
g.Expect(err).To(BeNil())
// Check the readiness condition is still truthy as down-scaling
- g.Expect(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady)()).To(Equal(corev1.ConditionTrue))
+ g.Expect(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady)()).To(Equal(corev1.ConditionTrue))
// Check the Integration scale subresource Spec field
- g.Eventually(IntegrationSpecReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(IntegrationSpecReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 1)))
// Then check it cascades into the Deployment scale
- g.Eventually(IntegrationPods(t, ns, name), TestTimeoutShort).Should(HaveLen(1))
+ g.Eventually(IntegrationPods(t, ctx, ns, name), TestTimeoutShort).Should(HaveLen(1))
// Finally check it cascades into the Integration scale subresource Status field
- g.Eventually(IntegrationStatusReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 1)))
})
t.Run("Scale integration with external image", func(t *testing.T) {
- image := IntegrationPodImage(t, ns, name)()
+ image := IntegrationPodImage(t, ctx, ns, name)()
g.Expect(image).NotTo(BeEmpty())
// Save resources by deleting the integration
- g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed())
-
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", "pre-built", "-t", fmt.Sprintf("container.image=%s", image)).Execute()).To(Succeed())
- g.Eventually(IntegrationPhase(t, ns, "pre-built"), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationPodPhase(t, ns, "pre-built"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Expect(ScaleIntegration(t, ns, "pre-built", 0)).To(Succeed())
- g.Eventually(IntegrationPod(t, ns, "pre-built"), TestTimeoutMedium).Should(BeNil())
- g.Expect(ScaleIntegration(t, ns, "pre-built", 1)).To(Succeed())
- g.Eventually(IntegrationPhase(t, ns, "pre-built"), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationPodPhase(t, ns, "pre-built"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
-
- g.Expect(Kamel(t, "delete", "pre-built", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", "pre-built", "-t", fmt.Sprintf("container.image=%s", image)).Execute()).To(Succeed())
+ g.Eventually(IntegrationPhase(t, ctx, ns, "pre-built"), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "pre-built"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(ScaleIntegration(t, ctx, ns, "pre-built", 0)).To(Succeed())
+ g.Eventually(IntegrationPod(t, ctx, ns, "pre-built"), TestTimeoutMedium).Should(BeNil())
+ g.Expect(ScaleIntegration(t, ctx, ns, "pre-built", 1)).To(Succeed())
+ g.Eventually(IntegrationPhase(t, ctx, ns, "pre-built"), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "pre-built"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+
+ g.Expect(Kamel(t, ctx, "delete", "pre-built", "-n", ns).Execute()).To(Succeed())
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/misc/structured_logs_test.go b/e2e/common/misc/structured_logs_test.go
index 47d7d59ec..da6765bde 100644
--- a/e2e/common/misc/structured_logs_test.go
+++ b/e2e/common/misc/structured_logs_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package misc
import (
+ "context"
"fmt"
"testing"
@@ -37,22 +38,20 @@ import (
func TestStructuredLogs(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-structured-logs"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "logging.format=json").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.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "logging.format=json").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- pod := OperatorPod(t, ns)()
+ pod := OperatorPod(t, ctx, ns)()
g.Expect(pod).NotTo(BeNil())
// pod.Namespace could be different from ns if using global operator
@@ -60,15 +59,15 @@ func TestStructuredLogs(t *testing.T) {
logOptions := &corev1.PodLogOptions{
Container: "camel-k-operator",
}
- logs, err := StructuredLogs(t, pod.Namespace, pod.Name, logOptions, false)
+ logs, err := StructuredLogs(t, ctx, pod.Namespace, pod.Name, logOptions, false)
g.Expect(err).To(BeNil())
g.Expect(logs).NotTo(BeEmpty())
- it := Integration(t, ns, name)()
+ it := Integration(t, ctx, ns, name)()
g.Expect(it).NotTo(BeNil())
- build := Build(t, IntegrationKitNamespace(t, ns, name)(), IntegrationKit(t, ns, name)())()
+ build := Build(t, ctx, IntegrationKitNamespace(t, ctx, ns, name)(), IntegrationKit(t, ctx, ns, name)())()
g.Expect(build).NotTo(BeNil())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/runtimes/runtimes_test.go b/e2e/common/runtimes/runtimes_test.go
index fa43dd530..45829d674 100644
--- a/e2e/common/runtimes/runtimes_test.go
+++ b/e2e/common/runtimes/runtimes_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package runtimes
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,48 +37,48 @@ import (
func TestSourceLessIntegrations(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-runtimes"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
var cmData = make(map[string]string)
cmData["my-file.txt"] = "Hello World!"
- CreatePlainTextConfigmap(t, ns, "my-cm-sourceless", cmData)
+ CreatePlainTextConfigmap(t, ctx, ns, "my-cm-sourceless", cmData)
t.Run("Camel Main", func(t *testing.T) {
itName := "my-camel-main-v1"
- g.Expect(KamelRunWithID(t, operatorID, ns, "--image", "docker.io/squakez/my-camel-main:1.0.0", "--resource", "configmap:my-cm-sourceless@/tmp/app/data").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, itName), TestTimeoutShort).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, itName, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationCondition(t, ns, itName, v1.IntegrationConditionTraitInfo)().Message).Should(Equal("explicitly disabled by the platform: integration kit was not created via Camel K operator"))
- g.Eventually(IntegrationLogs(t, ns, itName), TestTimeoutShort).Should(ContainSubstring(cmData["my-file.txt"]))
- g.Eventually(IntegrationLogs(t, ns, itName), TestTimeoutShort).Should(ContainSubstring("Apache Camel (Main)"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--image", "docker.io/squakez/my-camel-main:1.0.0", "--resource", "configmap:my-cm-sourceless@/tmp/app/data").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, itName), TestTimeoutShort).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, itName, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationCondition(t, ctx, ns, itName, v1.IntegrationConditionTraitInfo)().Message).Should(Equal("explicitly disabled by the platform: integration kit was not created via Camel K operator"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, itName), TestTimeoutShort).Should(ContainSubstring(cmData["my-file.txt"]))
+ g.Eventually(IntegrationLogs(t, ctx, ns, itName), TestTimeoutShort).Should(ContainSubstring("Apache Camel (Main)"))
})
t.Run("Camel Spring Boot", func(t *testing.T) {
itName := "my-camel-sb-v1"
- g.Expect(KamelRunWithID(t, operatorID, ns, "--image", "docker.io/squakez/my-camel-sb:1.0.0", "--resource", "configmap:my-cm-sourceless@/tmp/app/data").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, itName), TestTimeoutShort).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, itName, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationCondition(t, ns, itName, v1.IntegrationConditionTraitInfo)().Message).Should(Equal("explicitly disabled by the platform: integration kit was not created via Camel K operator"))
- g.Eventually(IntegrationLogs(t, ns, itName), TestTimeoutShort).Should(ContainSubstring(cmData["my-file.txt"]))
- g.Eventually(IntegrationLogs(t, ns, itName), TestTimeoutShort).Should(ContainSubstring("Spring Boot"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--image", "docker.io/squakez/my-camel-sb:1.0.0", "--resource", "configmap:my-cm-sourceless@/tmp/app/data").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, itName), TestTimeoutShort).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, itName, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationCondition(t, ctx, ns, itName, v1.IntegrationConditionTraitInfo)().Message).Should(Equal("explicitly disabled by the platform: integration kit was not created via Camel K operator"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, itName), TestTimeoutShort).Should(ContainSubstring(cmData["my-file.txt"]))
+ g.Eventually(IntegrationLogs(t, ctx, ns, itName), TestTimeoutShort).Should(ContainSubstring("Spring Boot"))
})
t.Run("Camel Quarkus", func(t *testing.T) {
itName := "my-camel-quarkus-v1"
- g.Expect(KamelRunWithID(t, operatorID, ns, "--image", "docker.io/squakez/my-camel-quarkus:1.0.0", "--resource", "configmap:my-cm-sourceless@/tmp/app/data").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, itName), TestTimeoutShort).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, itName, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationCondition(t, ns, itName, v1.IntegrationConditionTraitInfo)().Message).Should(Equal("explicitly disabled by the platform: integration kit was not created via Camel K operator"))
- g.Eventually(IntegrationLogs(t, ns, itName), TestTimeoutShort).Should(ContainSubstring(cmData["my-file.txt"]))
- g.Eventually(IntegrationLogs(t, ns, itName), TestTimeoutShort).Should(ContainSubstring("powered by Quarkus"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--image", "docker.io/squakez/my-camel-quarkus:1.0.0", "--resource", "configmap:my-cm-sourceless@/tmp/app/data").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, itName), TestTimeoutShort).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, itName, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationCondition(t, ctx, ns, itName, v1.IntegrationConditionTraitInfo)().Message).Should(Equal("explicitly disabled by the platform: integration kit was not created via Camel K operator"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, itName), TestTimeoutShort).Should(ContainSubstring(cmData["my-file.txt"]))
+ g.Eventually(IntegrationLogs(t, ctx, ns, itName), TestTimeoutShort).Should(ContainSubstring("powered by Quarkus"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/affinity_test.go b/e2e/common/traits/affinity_test.go
index 8621cd8fb..3b99863f5 100644
--- a/e2e/common/traits/affinity_test.go
+++ b/e2e/common/traits/affinity_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"fmt"
"testing"
@@ -39,16 +40,16 @@ import (
func TestAffinityTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-affinity"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
var hostname string
- if node, err := selectSchedulableNode(t); err == nil {
+ if node, err := selectSchedulableNode(t, ctx); err == nil {
hostname = node.Labels["kubernetes.io/hostname"]
} else {
// if 'get nodes' is not allowed, just skip tests for node affinity
@@ -58,15 +59,12 @@ func TestAffinityTrait(t *testing.T) {
if hostname != "" {
t.Run("Run Java with node affinity", func(t *testing.T) {
name1 := RandomizedSuffixName("java1")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name1,
- "-t", "affinity.enabled=true",
- "-t", fmt.Sprintf("affinity.node-affinity-labels=kubernetes.io/hostname in(%s)", hostname)).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name1), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name1, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name1), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
-
- pod := IntegrationPod(t, ns, name1)()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name1, "-t", "affinity.enabled=true", "-t", fmt.Sprintf("affinity.node-affinity-labels=kubernetes.io/hostname in(%s)", hostname)).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name1), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name1, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name1), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+
+ pod := IntegrationPod(t, ctx, ns, name1)()
g.Expect(pod.Spec.Affinity).NotTo(BeNil())
g.Expect(pod.Spec.Affinity.NodeAffinity).To(Equal(&corev1.NodeAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: nodeSelector("kubernetes.io/hostname", corev1.NodeSelectorOpIn, hostname),
@@ -74,28 +72,25 @@ func TestAffinityTrait(t *testing.T) {
g.Expect(pod.Spec.NodeName).To(Equal(hostname))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, name1)).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, name1)()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, name1)).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, name1)()
affinityTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "affinity")
g.Expect(affinityTrait).NotTo(BeNil())
g.Expect(len(affinityTrait)).To(Equal(2))
g.Expect(affinityTrait["enabled"]).To(Equal(true))
g.Expect(affinityTrait["nodeAffinityLabels"]).NotTo(BeNil())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
t.Run("Run Java with pod affinity", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", "java2",
- "-t", "affinity.enabled=true",
- "-t", "affinity.pod-affinity-labels=camel.apache.org/integration").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "java2"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "java2", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "java2"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
-
- pod := IntegrationPod(t, ns, "java2")()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", "java2", "-t", "affinity.enabled=true", "-t", "affinity.pod-affinity-labels=camel.apache.org/integration").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "java2"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "java2", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "java2"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+
+ pod := IntegrationPod(t, ctx, ns, "java2")()
g.Expect(pod.Spec.Affinity).NotTo(BeNil())
g.Expect(pod.Spec.Affinity.PodAffinity).To(Equal(&corev1.PodAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{
@@ -103,19 +98,16 @@ func TestAffinityTrait(t *testing.T) {
},
}))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Run Java with pod anti affinity", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", "java3",
- "-t", "affinity.enabled=true",
- "-t", "affinity.pod-anti-affinity-labels=camel.apache.org/integration").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "java3"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "java3", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "java3"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
-
- pod := IntegrationPod(t, ns, "java3")()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", "java3", "-t", "affinity.enabled=true", "-t", "affinity.pod-anti-affinity-labels=camel.apache.org/integration").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "java3"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "java3", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "java3"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+
+ pod := IntegrationPod(t, ctx, ns, "java3")()
g.Expect(pod.Spec.Affinity).NotTo(BeNil())
g.Expect(pod.Spec.Affinity.PodAntiAffinity).To(Equal(&corev1.PodAntiAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{
@@ -123,13 +115,13 @@ func TestAffinityTrait(t *testing.T) {
},
}))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
})
}
-func selectSchedulableNode(t *testing.T) (*corev1.Node, error) {
- nodes, err := TestClient(t).CoreV1().Nodes().List(TestContext, metav1.ListOptions{})
+func selectSchedulableNode(t *testing.T, ctx context.Context) (*corev1.Node, error) {
+ nodes, err := TestClient(t).CoreV1().Nodes().List(ctx, metav1.ListOptions{})
if err != nil {
return nil, err
}
diff --git a/e2e/common/traits/builder_test.go b/e2e/common/traits/builder_test.go
index 0470b4bb0..e52dc1447 100644
--- a/e2e/common/traits/builder_test.go
+++ b/e2e/common/traits/builder_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"fmt"
"testing"
@@ -38,99 +39,96 @@ import (
func TestBuilderTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-builder"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Run build strategy routine", func(t *testing.T) {
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "builder.order-strategy=sequential",
- "-t", "builder.strategy=routine").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "builder.order-strategy=sequential", "-t", "builder.strategy=routine").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("Magicstring!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationKitName := IntegrationKit(t, ns, name)()
- integrationKitNamespace := IntegrationKitNamespace(t, ns, name)()
+ integrationKitName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
builderKitName := fmt.Sprintf("camel-k-%s-builder", integrationKitName)
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().Strategy, TestTimeoutShort).Should(Equal(v1.BuildStrategyRoutine))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().OrderStrategy, TestTimeoutShort).Should(Equal(v1.BuildOrderStrategySequential))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().Strategy, TestTimeoutShort).Should(Equal(v1.BuildStrategyRoutine))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().OrderStrategy, TestTimeoutShort).Should(Equal(v1.BuildOrderStrategySequential))
// Default resource CPU Check
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().RequestCPU, TestTimeoutShort).Should(Equal(""))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().LimitCPU, TestTimeoutShort).Should(Equal(""))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().RequestMemory, TestTimeoutShort).Should(Equal(""))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().LimitMemory, TestTimeoutShort).Should(Equal(""))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().RequestCPU, TestTimeoutShort).Should(Equal(""))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().LimitCPU, TestTimeoutShort).Should(Equal(""))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().RequestMemory, TestTimeoutShort).Should(Equal(""))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().LimitMemory, TestTimeoutShort).Should(Equal(""))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName), TestTimeoutShort).Should(BeNil())
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName), TestTimeoutShort).Should(BeNil())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Run build order strategy dependencies", func(t *testing.T) {
name := RandomizedSuffixName("java-dependencies-strategy")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java",
"--name", name,
// This is required in order to avoid reusing a Kit already existing (which is the default behavior)
"--build-property", "strategy=dependencies",
"-t", "builder.order-strategy=dependencies").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("Magicstring!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationKitName := IntegrationKit(t, ns, name)()
- integrationKitNamespace := IntegrationKitNamespace(t, ns, name)()
+ integrationKitName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
builderKitName := fmt.Sprintf("camel-k-%s-builder", integrationKitName)
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().Strategy, TestTimeoutShort).Should(Equal(v1.BuildStrategyRoutine))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().OrderStrategy, TestTimeoutShort).Should(Equal(v1.BuildOrderStrategyDependencies))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().Strategy, TestTimeoutShort).Should(Equal(v1.BuildStrategyRoutine))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().OrderStrategy, TestTimeoutShort).Should(Equal(v1.BuildOrderStrategyDependencies))
// Default resource CPU Check
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().RequestCPU, TestTimeoutShort).Should(Equal(""))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().LimitCPU, TestTimeoutShort).Should(Equal(""))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().RequestMemory, TestTimeoutShort).Should(Equal(""))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().LimitMemory, TestTimeoutShort).Should(Equal(""))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName), TestTimeoutShort).Should(BeNil())
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().RequestCPU, TestTimeoutShort).Should(Equal(""))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().LimitCPU, TestTimeoutShort).Should(Equal(""))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().RequestMemory, TestTimeoutShort).Should(Equal(""))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().LimitMemory, TestTimeoutShort).Should(Equal(""))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName), TestTimeoutShort).Should(BeNil())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Run build order strategy fifo", func(t *testing.T) {
name := RandomizedSuffixName("java-fifo-strategy")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java",
"--name", name,
// This is required in order to avoid reusing a Kit already existing (which is the default behavior)
"--build-property", "strategy=fifo",
"-t", "builder.order-strategy=fifo").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("Magicstring!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationKitName := IntegrationKit(t, ns, name)()
- integrationKitNamespace := IntegrationKitNamespace(t, ns, name)()
+ integrationKitName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
builderKitName := fmt.Sprintf("camel-k-%s-builder", integrationKitName)
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().Strategy, TestTimeoutShort).Should(Equal(v1.BuildStrategyRoutine))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().OrderStrategy, TestTimeoutShort).Should(Equal(v1.BuildOrderStrategyFIFO))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().Strategy, TestTimeoutShort).Should(Equal(v1.BuildStrategyRoutine))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().OrderStrategy, TestTimeoutShort).Should(Equal(v1.BuildOrderStrategyFIFO))
// Default resource CPU Check
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().RequestCPU, TestTimeoutShort).Should(Equal(""))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().LimitCPU, TestTimeoutShort).Should(Equal(""))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().RequestMemory, TestTimeoutShort).Should(Equal(""))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().LimitMemory, TestTimeoutShort).Should(Equal(""))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().RequestCPU, TestTimeoutShort).Should(Equal(""))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().LimitCPU, TestTimeoutShort).Should(Equal(""))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().RequestMemory, TestTimeoutShort).Should(Equal(""))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().LimitMemory, TestTimeoutShort).Should(Equal(""))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName), TestTimeoutShort).Should(BeNil())
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName), TestTimeoutShort).Should(BeNil())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Run build resources configuration", func(t *testing.T) {
name := RandomizedSuffixName("java-resource-config")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java",
"--name", name,
// This is required in order to avoid reusing a Kit already existing (which is the default behavior)
"--build-property", "resources=new-build",
@@ -141,147 +139,132 @@ func TestBuilderTrait(t *testing.T) {
"-t", "builder.strategy=pod",
).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("Magicstring!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationKitName := IntegrationKit(t, ns, name)()
- integrationKitNamespace := IntegrationKitNamespace(t, ns, name)()
+ integrationKitName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
builderKitName := fmt.Sprintf("camel-k-%s-builder", integrationKitName)
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().Strategy, TestTimeoutShort).Should(Equal(v1.BuildStrategyPod))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().OrderStrategy, TestTimeoutShort).Should(Equal(v1.BuildOrderStrategySequential))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().RequestCPU, TestTimeoutShort).Should(Equal("500m"))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().LimitCPU, TestTimeoutShort).Should(Equal("1000m"))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().RequestMemory, TestTimeoutShort).Should(Equal("2Gi"))
- g.Eventually(BuildConfig(t, integrationKitNamespace, integrationKitName)().LimitMemory, TestTimeoutShort).Should(Equal("3Gi"))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().Strategy, TestTimeoutShort).Should(Equal(v1.BuildStrategyPod))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().OrderStrategy, TestTimeoutShort).Should(Equal(v1.BuildOrderStrategySequential))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().RequestCPU, TestTimeoutShort).Should(Equal("500m"))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().LimitCPU, TestTimeoutShort).Should(Equal("1000m"))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().RequestMemory, TestTimeoutShort).Should(Equal("2Gi"))
+ g.Eventually(BuildConfig(t, ctx, integrationKitNamespace, integrationKitName)().LimitMemory, TestTimeoutShort).Should(Equal("3Gi"))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName), TestTimeoutShort).ShouldNot(BeNil())
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName), TestTimeoutShort).ShouldNot(BeNil())
// Let's assert we set the resources on the builder container
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Name, TestTimeoutShort).Should(Equal("builder"))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Resources.Requests.Cpu().String(), TestTimeoutShort).Should(Equal("500m"))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Resources.Limits.Cpu().String(), TestTimeoutShort).Should(Equal("1"))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Resources.Requests.Memory().String(), TestTimeoutShort).Should(Equal("2Gi"))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Resources.Limits.Memory().String(), TestTimeoutShort).Should(Equal("3Gi"))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Name, TestTimeoutShort).Should(Equal("builder"))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Resources.Requests.Cpu().String(), TestTimeoutShort).Should(Equal("500m"))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Resources.Limits.Cpu().String(), TestTimeoutShort).Should(Equal("1"))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Resources.Requests.Memory().String(), TestTimeoutShort).Should(Equal("2Gi"))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Resources.Limits.Memory().String(), TestTimeoutShort).Should(Equal("3Gi"))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Run custom pipeline task", func(t *testing.T) {
name := RandomizedSuffixName("java-pipeline")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "builder.tasks=custom1;alpine;tree",
- "-t", "builder.tasks=custom2;alpine;cat maven/pom.xml",
- "-t", "builder.strategy=pod",
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "builder.tasks=custom1;alpine;tree", "-t", "builder.tasks=custom2;alpine;cat maven/pom.xml", "-t", "builder.strategy=pod").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationKitName := IntegrationKit(t, ns, name)()
- integrationKitNamespace := IntegrationKitNamespace(t, ns, name)()
+ integrationKitName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
builderKitName := fmt.Sprintf("camel-k-%s-builder", integrationKitName)
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName), TestTimeoutShort).ShouldNot(BeNil())
- g.Eventually(len(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers), TestTimeoutShort).Should(Equal(4))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Name, TestTimeoutShort).Should(Equal("builder"))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers[1].Name, TestTimeoutShort).Should(Equal("custom1"))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers[2].Name, TestTimeoutShort).Should(Equal("custom2"))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName), TestTimeoutShort).ShouldNot(BeNil())
+ g.Eventually(len(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers), TestTimeoutShort).Should(Equal(4))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Name, TestTimeoutShort).Should(Equal("builder"))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers[1].Name, TestTimeoutShort).Should(Equal("custom1"))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers[2].Name, TestTimeoutShort).Should(Equal("custom2"))
// Check containers conditions
- g.Eventually(Build(t, integrationKitNamespace, integrationKitName), TestTimeoutShort).ShouldNot(BeNil())
+ g.Eventually(Build(t, ctx, integrationKitNamespace, integrationKitName), TestTimeoutShort).ShouldNot(BeNil())
g.Eventually(
- Build(t, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Container custom1 succeeded")).Status,
+ Build(t, ctx, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Container custom1 succeeded")).Status,
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
g.Eventually(
- Build(t, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Container custom1 succeeded")).Message,
+ Build(t, ctx, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Container custom1 succeeded")).Message,
TestTimeoutShort).Should(ContainSubstring("generated-bytecode.jar"))
- g.Eventually(Build(t, integrationKitNamespace, integrationKitName), TestTimeoutShort).ShouldNot(BeNil())
+ g.Eventually(Build(t, ctx, integrationKitNamespace, integrationKitName), TestTimeoutShort).ShouldNot(BeNil())
g.Eventually(
- Build(t, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Container custom2 succeeded")).Status,
+ Build(t, ctx, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Container custom2 succeeded")).Status,
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
g.Eventually(
- Build(t, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Container custom2 succeeded")).Message,
+ Build(t, ctx, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Container custom2 succeeded")).Message,
TestTimeoutShort).Should(ContainSubstring("</project>"))
// Check logs
- g.Eventually(Logs(t, integrationKitNamespace, builderKitName, corev1.PodLogOptions{Container: "custom1"})).Should(ContainSubstring(`generated-bytecode.jar`))
- g.Eventually(Logs(t, integrationKitNamespace, builderKitName, corev1.PodLogOptions{Container: "custom2"})).Should(ContainSubstring(`<artifactId>camel-k-runtime-bom</artifactId>`))
+ g.Eventually(Logs(t, ctx, integrationKitNamespace, builderKitName, corev1.PodLogOptions{Container: "custom1"})).Should(ContainSubstring(`generated-bytecode.jar`))
+ g.Eventually(Logs(t, ctx, integrationKitNamespace, builderKitName, corev1.PodLogOptions{Container: "custom2"})).Should(ContainSubstring(`<artifactId>camel-k-runtime-bom</artifactId>`))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Run custom pipeline task error", func(t *testing.T) {
name := RandomizedSuffixName("java-error")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "builder.tasks=custom1;alpine;cat missingfile.txt",
- "-t", "builder.strategy=pod",
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "builder.tasks=custom1;alpine;cat missingfile.txt", "-t", "builder.strategy=pod").Execute()).To(Succeed())
- g.Eventually(IntegrationPhase(t, ns, name)).Should(Equal(v1.IntegrationPhaseBuildingKit))
- integrationKitName := IntegrationKit(t, ns, name)()
- integrationKitNamespace := IntegrationKitNamespace(t, ns, name)()
+ g.Eventually(IntegrationPhase(t, ctx, ns, name)).Should(Equal(v1.IntegrationPhaseBuildingKit))
+ integrationKitName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
// Check containers conditions
- g.Eventually(Build(t, integrationKitNamespace, integrationKitName), TestTimeoutLong).ShouldNot(BeNil())
- g.Eventually(BuildConditions(t, integrationKitNamespace, integrationKitName), TestTimeoutLong).ShouldNot(BeNil())
- g.Eventually(BuildCondition(t, integrationKitNamespace, integrationKitName, v1.BuildConditionType("Container custom1 succeeded")), TestTimeoutMedium).ShouldNot(BeNil())
+ g.Eventually(Build(t, ctx, integrationKitNamespace, integrationKitName), TestTimeoutLong).ShouldNot(BeNil())
+ g.Eventually(BuildConditions(t, ctx, integrationKitNamespace, integrationKitName), TestTimeoutLong).ShouldNot(BeNil())
+ g.Eventually(BuildCondition(t, ctx, integrationKitNamespace, integrationKitName, v1.BuildConditionType("Container custom1 succeeded")), TestTimeoutMedium).ShouldNot(BeNil())
g.Eventually(
- BuildCondition(t, integrationKitNamespace, integrationKitName, v1.BuildConditionType("Container custom1 succeeded"))().Status,
+ BuildCondition(t, ctx, integrationKitNamespace, integrationKitName, v1.BuildConditionType("Container custom1 succeeded"))().Status,
TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
g.Eventually(
- BuildCondition(t, integrationKitNamespace, integrationKitName, v1.BuildConditionType("Container custom1 succeeded"))().Message,
+ BuildCondition(t, ctx, integrationKitNamespace, integrationKitName, v1.BuildConditionType("Container custom1 succeeded"))().Message,
TestTimeoutShort).Should(ContainSubstring("No such file or directory"))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Run maven profile", func(t *testing.T) {
name := RandomizedSuffixName("java-maven-profile")
mavenProfile1Cm := newMavenProfileConfigMap(ns, "maven-profile-owasp", "owasp-profile")
- g.Expect(TestClient(t).Create(TestContext, mavenProfile1Cm)).To(Succeed())
+ g.Expect(TestClient(t).Create(ctx, mavenProfile1Cm)).To(Succeed())
mavenProfile2Cm := newMavenProfileConfigMap(ns, "maven-profile-dependency", "dependency-profile")
- g.Expect(TestClient(t).Create(TestContext, mavenProfile2Cm)).To(Succeed())
+ g.Expect(TestClient(t).Create(ctx, mavenProfile2Cm)).To(Succeed())
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "builder.maven-profiles=configmap:maven-profile-owasp/owasp-profile",
- "-t", "builder.maven-profiles=configmap:maven-profile-dependency/dependency-profile",
- "-t", "builder.tasks=custom1;alpine;cat maven/pom.xml",
- "-t", "builder.strategy=pod",
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "builder.maven-profiles=configmap:maven-profile-owasp/owasp-profile", "-t", "builder.maven-profiles=configmap:maven-profile-dependency/dependency-profile", "-t", "builder.tasks=custom1;alpine;cat maven/pom.xml", "-t", "builder.strategy=pod").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- integrationKitName := IntegrationKit(t, ns, name)()
- integrationKitNamespace := IntegrationKitNamespace(t, ns, name)()
+ integrationKitName := IntegrationKit(t, ctx, ns, name)()
+ integrationKitNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
builderKitName := fmt.Sprintf("camel-k-%s-builder", integrationKitName)
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName), TestTimeoutShort).ShouldNot(BeNil())
- g.Eventually(len(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers), TestTimeoutShort).Should(Equal(3))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Name, TestTimeoutShort).Should(Equal("builder"))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers[1].Name, TestTimeoutShort).Should(Equal("custom1"))
- g.Eventually(BuilderPod(t, integrationKitNamespace, builderKitName)().Spec.InitContainers[2].Name, TestTimeoutShort).Should(Equal("package"))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName), TestTimeoutShort).ShouldNot(BeNil())
+ g.Eventually(len(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers), TestTimeoutShort).Should(Equal(3))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Name, TestTimeoutShort).Should(Equal("builder"))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers[1].Name, TestTimeoutShort).Should(Equal("custom1"))
+ g.Eventually(BuilderPod(t, ctx, integrationKitNamespace, builderKitName)().Spec.InitContainers[2].Name, TestTimeoutShort).Should(Equal("package"))
// Check containers conditions
- g.Eventually(Build(t, integrationKitNamespace, integrationKitName), TestTimeoutShort).ShouldNot(BeNil())
+ g.Eventually(Build(t, ctx, integrationKitNamespace, integrationKitName), TestTimeoutShort).ShouldNot(BeNil())
g.Eventually(
- Build(t, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Container custom1 succeeded")).Status,
+ Build(t, ctx, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Container custom1 succeeded")).Status,
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
g.Eventually(
- Build(t, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Container custom1 succeeded")).Message,
+ Build(t, ctx, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Container custom1 succeeded")).Message,
TestTimeoutShort).Should(ContainSubstring("</project>"))
// Check logs
- g.Eventually(Logs(t, integrationKitNamespace, builderKitName, corev1.PodLogOptions{Container: "custom1"})).Should(ContainSubstring(`<id>owasp-profile</id>`))
- g.Eventually(Logs(t, integrationKitNamespace, builderKitName, corev1.PodLogOptions{Container: "custom1"})).Should(ContainSubstring(`<id>dependency-profile</id>`))
+ g.Eventually(Logs(t, ctx, integrationKitNamespace, builderKitName, corev1.PodLogOptions{Container: "custom1"})).Should(ContainSubstring(`<id>owasp-profile</id>`))
+ g.Eventually(Logs(t, ctx, integrationKitNamespace, builderKitName, corev1.PodLogOptions{Container: "custom1"})).Should(ContainSubstring(`<id>dependency-profile</id>`))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
- g.Expect(TestClient(t).Delete(TestContext, mavenProfile1Cm)).To(Succeed())
- g.Expect(TestClient(t).Delete(TestContext, mavenProfile2Cm)).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(TestClient(t).Delete(ctx, mavenProfile1Cm)).To(Succeed())
+ g.Expect(TestClient(t).Delete(ctx, mavenProfile2Cm)).To(Succeed())
})
})
}
diff --git a/e2e/common/traits/camel_test.go b/e2e/common/traits/camel_test.go
index 439bca8f2..e854b53b6 100644
--- a/e2e/common/traits/camel_test.go
+++ b/e2e/common/traits/camel_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,43 +37,38 @@ import (
func TestCamelTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-camel"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("properties changes should not rebuild", func(t *testing.T) {
- g.Expect(Kamel(t, "reset", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "reset", "-n", ns).Execute()).To(Succeed())
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
// checking the integration status
- 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("Magicstring!"))
- integrationKit := IntegrationKit(t, ns, name)()
-
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-p", "a=1",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutShort).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("Magicstring!"))
- g.Eventually(IntegrationKit(t, ns, name)).Should(Equal(integrationKit))
-
- g.Expect(Kamel(t, "delete", name, "-n", ns).Execute()).To(Succeed())
- g.Eventually(Integration(t, ns, name), TestTimeoutLong).Should(BeNil())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ integrationKit := IntegrationKit(t, ctx, ns, name)()
+
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-p", "a=1").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationKit(t, ctx, ns, name)).Should(Equal(integrationKit))
+
+ g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
+ g.Eventually(Integration(t, ctx, ns, name), TestTimeoutLong).Should(BeNil())
})
// Clean-up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/container_test.go b/e2e/common/traits/container_test.go
index 12e1937f2..1365d139b 100644
--- a/e2e/common/traits/container_test.go
+++ b/e2e/common/traits/container_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -37,35 +38,28 @@ import (
func TestContainerTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-container"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Container image pull policy and resources configuration", func(t *testing.T) {
name := RandomizedSuffixName("java1")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "-t", "container.image-pull-policy=Always",
- "-t", "container.request-cpu=0.005",
- "-t", "container.request-memory=100Mi",
- "-t", "container.limit-cpu=200m",
- "-t", "container.limit-memory=500Mi",
- "--name", name,
- ).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("Magicstring!"))
- g.Eventually(IntegrationPodHas(t, ns, name, func(pod *corev1.Pod) bool {
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "-t", "container.image-pull-policy=Always", "-t", "container.request-cpu=0.005", "-t", "container.request-memory=100Mi", "-t", "container.limit-cpu=200m", "-t", "container.limit-memory=500Mi", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationPodHas(t, ctx, ns, name, func(pod *corev1.Pod) bool {
if len(pod.Spec.Containers) != 1 {
return false
}
imagePullPolicy := pod.Spec.Containers[0].ImagePullPolicy
return imagePullPolicy == "Always"
}), TestTimeoutShort).Should(BeTrue())
- g.Eventually(IntegrationPodHas(t, ns, name, func(pod *corev1.Pod) bool {
+ g.Eventually(IntegrationPodHas(t, ctx, ns, name, func(pod *corev1.Pod) bool {
if len(pod.Spec.Containers) != 1 {
return false
}
@@ -73,7 +67,7 @@ func TestContainerTrait(t *testing.T) {
requestsCpu := pod.Spec.Containers[0].Resources.Requests.Cpu()
return limitsCpu != nil && limitsCpu.String() == "200m" && requestsCpu != nil && requestsCpu.String() == "5m"
}), TestTimeoutShort).Should(BeTrue())
- g.Eventually(IntegrationPodHas(t, ns, name, func(pod *corev1.Pod) bool {
+ g.Eventually(IntegrationPodHas(t, ctx, ns, name, func(pod *corev1.Pod) bool {
if len(pod.Spec.Containers) != 1 {
return false
}
@@ -87,14 +81,11 @@ func TestContainerTrait(t *testing.T) {
t.Run("Container name", func(t *testing.T) {
name := RandomizedSuffixName("java2")
containerName := "my-container-name"
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "-t", "container.name="+containerName,
- "--name", name,
- ).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("Magicstring!"))
- g.Eventually(IntegrationPodHas(t, ns, name, func(pod *corev1.Pod) bool {
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "-t", "container.name="+containerName, "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationPodHas(t, ctx, ns, name, func(pod *corev1.Pod) bool {
if len(pod.Spec.Containers) != 1 {
return false
}
@@ -103,8 +94,8 @@ func TestContainerTrait(t *testing.T) {
}), TestTimeoutShort).Should(BeTrue())
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, name)).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, name)()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, name)).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, name)()
containerTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "container")
g.Expect(containerTrait).ToNot(BeNil())
g.Expect(len(containerTrait)).To(Equal(1))
@@ -113,6 +104,6 @@ func TestContainerTrait(t *testing.T) {
})
// Clean-up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/deployment_test.go b/e2e/common/traits/deployment_test.go
index 68d57b6b5..37fb099ca 100644
--- a/e2e/common/traits/deployment_test.go
+++ b/e2e/common/traits/deployment_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"testing"
appsv1 "k8s.io/api/apps/v1"
@@ -40,26 +41,24 @@ import (
func TestRecreateDeploymentStrategyTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-deployment"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Run with Recreate Deployment Strategy", func(t *testing.T) {
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "deployment.strategy="+string(appsv1.RecreateDeploymentStrategyType)).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "deployment.strategy="+string(appsv1.RecreateDeploymentStrategyType)).
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("Magicstring!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(Deployment(t, ns, name), TestTimeoutMedium).Should(PointTo(MatchFields(IgnoreExtras,
+ g.Eventually(Deployment(t, ctx, ns, name), TestTimeoutMedium).Should(PointTo(MatchFields(IgnoreExtras,
Fields{
"Spec": MatchFields(IgnoreExtras,
Fields{
@@ -72,39 +71,38 @@ func TestRecreateDeploymentStrategyTrait(t *testing.T) {
))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, name)).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, name)()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, name)).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, name)()
deploymentTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "deployment")
g.Expect(deploymentTrait).ToNot(BeNil())
g.Expect(len(deploymentTrait)).To(Equal(1))
g.Expect(deploymentTrait["strategy"]).To(Equal(string(appsv1.RecreateDeploymentStrategyType)))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestRollingUpdateDeploymentStrategyTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-deployment-rolling"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Run with RollingUpdate Deployment Strategy", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "-t", "deployment.strategy="+string(appsv1.RollingUpdateDeploymentStrategyType)).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "-t", "deployment.strategy="+string(appsv1.RollingUpdateDeploymentStrategyType)).
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!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Eventually(Deployment(t, ns, "java"), TestTimeoutMedium).Should(PointTo(MatchFields(IgnoreExtras,
+ g.Eventually(Deployment(t, ctx, ns, "java"), TestTimeoutMedium).Should(PointTo(MatchFields(IgnoreExtras,
Fields{
"Spec": MatchFields(IgnoreExtras,
Fields{
@@ -117,6 +115,6 @@ func TestRollingUpdateDeploymentStrategyTrait(t *testing.T) {
))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/error_handler_test.go b/e2e/common/traits/error_handler_test.go
index 3292750f7..5e727b508 100644
--- a/e2e/common/traits/error_handler_test.go
+++ b/e2e/common/traits/error_handler_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,27 +37,21 @@ import (
func TestErrorHandlerTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-errorhandler"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Run errored integration with error handler", func(t *testing.T) {
name := RandomizedSuffixName("error-handler")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/ErroredRoute.java",
- "--name", name,
- "-t", "error-handler.enabled=true",
- "-t", "error-handler.ref=defaultErrorHandler",
- "-p", "camel.beans.defaultErrorHandler=#class:org.apache.camel.builder.DeadLetterChannelBuilder",
- "-p", "camel.beans.defaultErrorHandler.deadLetterUri=log:my-special-error-handler-in-place?level=ERROR&showCaughtException=false&showBody=false&showBodyType=false&showExchangePattern=false",
- ).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).ShouldNot(ContainSubstring("InvalidPayloadException"))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("my-special-error-handler-in-place"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/ErroredRoute.java", "--name", name, "-t", "error-handler.enabled=true", "-t", "error-handler.ref=defaultErrorHandler", "-p", "camel.beans.defaultErrorHandler=#class:org.apache.camel.builder.DeadLetterChannelBuilder", "-p", "camel.beans.defaultErrorHandler.deadLetterUri=log:my-special-error-handler-in-place?level=ERROR&showCaughtException=false&showBody=false&showBodyType=false&showExchangePattern=false").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).ShouldNot(ContainSubstring("InvalidPayloadException"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("my-special-error-handler-in-place"))
})
})
}
diff --git a/e2e/common/traits/errored_trait_test.go b/e2e/common/traits/errored_trait_test.go
index 9d967d2df..a113e021e 100644
--- a/e2e/common/traits/errored_trait_test.go
+++ b/e2e/common/traits/errored_trait_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,23 +37,20 @@ import (
func TestErroredTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-error"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Integration trait should fail", func(t *testing.T) {
name := RandomizedSuffixName("it-errored")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "kamelets.list=missing",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(And(
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "kamelets.list=missing").Execute()).To(Succeed())
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(And(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionInitializationFailedReason)),
WithTransform(IntegrationConditionMessage, HavePrefix("error during trait customization")),
))
@@ -60,28 +58,25 @@ func TestErroredTrait(t *testing.T) {
t.Run("Pipe trait should fail", func(t *testing.T) {
name := RandomizedSuffixName("kb-errored")
- g.Expect(KamelBindWithID(t, operatorID, ns, "timer:foo", "log:bar",
- "--name", name,
- "-t", "kamelets.list=missing",
- ).Execute()).To(Succeed())
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "timer:foo", "log:bar", "--name", name, "-t", "kamelets.list=missing").Execute()).To(Succeed())
// Pipe
- g.Eventually(PipePhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.PipePhaseError))
- g.Eventually(PipeConditionStatus(t, ns, name, v1.PipeConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
- g.Eventually(PipeCondition(t, ns, name, v1.PipeConditionReady), TestTimeoutShort).Should(
+ g.Eventually(PipePhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.PipePhaseError))
+ g.Eventually(PipeConditionStatus(t, ctx, ns, name, v1.PipeConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
+ g.Eventually(PipeCondition(t, ctx, ns, name, v1.PipeConditionReady), TestTimeoutShort).Should(
WithTransform(PipeConditionMessage, And(
ContainSubstring("error during trait customization"),
ContainSubstring("[missing] not found"),
)))
// Integration related
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(And(
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(And(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionInitializationFailedReason)),
WithTransform(IntegrationConditionMessage, HavePrefix("error during trait customization")),
))
})
// Clean up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/health_test.go b/e2e/common/traits/health_test.go
index 0f2ff7bf9..7e1cd608c 100644
--- a/e2e/common/traits/health_test.go
+++ b/e2e/common/traits/health_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"encoding/json"
"fmt"
"strings"
@@ -45,51 +46,44 @@ import (
func TestHealthTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-health"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Readiness condition with stopped route scaled", func(t *testing.T) {
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "-t", "health.enabled=true",
- // Enable Jolokia for the test to stop the Camel route
- "-t", "jolokia.enabled=true",
- "-t", "jolokia.use-ssl-client-authentication=false",
- "-t", "jolokia.protocol=http",
- "--name", name,
- ).Execute()).To(Succeed())
-
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "-t", "health.enabled=true", "-t", "jolokia.enabled=true", "-t", "jolokia.use-ssl-client-authentication=false", "-t", "jolokia.protocol=http", "--name", name).Execute()).To(Succeed())
+
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(ScaleIntegration(t, ns, name, 3)).To(Succeed())
+ g.Expect(ScaleIntegration(t, ctx, ns, name, 3)).To(Succeed())
// Check the readiness condition becomes falsy
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
// Check the scale cascades into the Deployment scale
- g.Eventually(IntegrationPods(t, ns, name), TestTimeoutShort).Should(HaveLen(3))
+ g.Eventually(IntegrationPods(t, ctx, ns, name), TestTimeoutShort).Should(HaveLen(3))
// Check it also cascades into the Integration scale subresource Status field
- g.Eventually(IntegrationStatusReplicas(t, ns, name), TestTimeoutShort).
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 3)))
// Finally check the readiness condition becomes truthy back
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, name)).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, name)()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, name)).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, name)()
healthTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "health")
g.Expect(healthTrait).ToNot(BeNil())
g.Expect(len(healthTrait)).To(Equal(1))
g.Expect(healthTrait["enabled"]).To(Equal(true))
- pods := IntegrationPods(t, ns, name)()
+ pods := IntegrationPods(t, ctx, ns, name)()
for i, pod := range pods {
// Stop the Camel route
@@ -104,19 +98,19 @@ func TestHealthTrait(t *testing.T) {
response, err := TestClient(t).CoreV1().RESTClient().Post().
AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/jolokia/", ns, pod.Name)).
Body(body).
- DoRaw(TestContext)
+ DoRaw(ctx)
g.Expect(err).To(BeNil())
g.Expect(response).To(ContainSubstring(`"status":200`))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionFalse))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(And(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(And(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionRuntimeNotReadyReason)),
WithTransform(IntegrationConditionMessage, Equal(fmt.Sprintf("%d/3 pods are not ready", i+1)))))
}
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(
Satisfy(func(c *v1.IntegrationCondition) bool {
if c.Status != corev1.ConditionFalse {
return false
@@ -153,30 +147,23 @@ func TestHealthTrait(t *testing.T) {
return true
}))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
// Clean-up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Readiness condition with stopped route", func(t *testing.T) {
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "-t", "health.enabled=true",
- // Enable Jolokia for the test to stop the Camel route
- "-t", "jolokia.enabled=true",
- "-t", "jolokia.use-ssl-client-authentication=false",
- "-t", "jolokia.protocol=http",
- "--name", name,
- ).Execute()).To(Succeed())
-
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "-t", "health.enabled=true", "-t", "jolokia.enabled=true", "-t", "jolokia.use-ssl-client-authentication=false", "-t", "jolokia.protocol=http", "--name", name).Execute()).To(Succeed())
+
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- pod := IntegrationPod(t, ns, name)()
+ pod := IntegrationPod(t, ctx, ns, name)()
// Stop the Camel route
request := map[string]string{
@@ -190,12 +177,12 @@ func TestHealthTrait(t *testing.T) {
response, err := TestClient(t).CoreV1().RESTClient().Post().
AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/jolokia/", ns, pod.Name)).
Body(body).
- DoRaw(TestContext)
+ DoRaw(ctx)
g.Expect(err).To(BeNil())
g.Expect(response).To(ContainSubstring(`"status":200`))
// Check the ready condition has turned false
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionFalse))
// And it contains details about the runtime state
@@ -210,11 +197,11 @@ func TestHealthTrait(t *testing.T) {
// status: "False"
// type: Ready
//
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(And(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(And(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionRuntimeNotReadyReason)),
WithTransform(IntegrationConditionMessage, Equal("1/1 pods are not ready"))))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(
Satisfy(func(c *v1.IntegrationCondition) bool {
if c.Status != corev1.ConditionFalse {
return false
@@ -247,10 +234,10 @@ func TestHealthTrait(t *testing.T) {
return data["check.kind"].(string) == "READINESS" && data["route.status"].(string) == "Stopped"
}))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
// Clean-up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Readiness condition with stopped binding", func(t *testing.T) {
@@ -258,27 +245,17 @@ func TestHealthTrait(t *testing.T) {
source := RandomizedSuffixName("my-health-timer-source")
sink := RandomizedSuffixName("my-health-log-sink")
- g.Expect(CreateTimerKamelet(t, operatorID, ns, source)()).To(Succeed())
- g.Expect(CreateLogKamelet(t, operatorID, ns, sink)()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, source)()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, operatorID, ns, sink)()).To(Succeed())
- g.Expect(KamelBindWithID(t, operatorID, ns,
- source,
- sink,
- "-p", "source.message=Magicstring!",
- "-p", "sink.loggerName=binding",
- "--annotation", "trait.camel.apache.org/health.enabled=true",
- "--annotation", "trait.camel.apache.org/jolokia.enabled=true",
- "--annotation", "trait.camel.apache.org/jolokia.use-ssl-client-authentication=false",
- "--annotation", "trait.camel.apache.org/jolokia.protocol=http",
- "--name", name,
- ).Execute()).To(Succeed())
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, source, sink, "-p", "source.message=Magicstring!", "-p", "sink.loggerName=binding", "--annotation", "trait.camel.apache.org/health.enabled=true", "--annotation", "trait.camel.apache.org/jolokia.enabled=true", "--annotation", "trait.camel.apache.org/jolokia.use-ssl-client-authentication=false", "--annotation", "trait.camel.apache.org/jolokia.protocol=http", "--name", name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- pod := IntegrationPod(t, ns, name)()
+ pod := IntegrationPod(t, ctx, ns, name)()
// Stop the Camel route
request := map[string]string{
@@ -292,21 +269,21 @@ func TestHealthTrait(t *testing.T) {
response, err := TestClient(t).CoreV1().RESTClient().Post().
AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/jolokia/", ns, pod.Name)).
Body(body).
- DoRaw(TestContext)
+ DoRaw(ctx)
g.Expect(err).To(BeNil())
g.Expect(response).To(ContainSubstring(`"status":200`))
// Check the ready condition has turned false
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionFalse))
// And it contains details about the runtime state
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(And(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(And(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionRuntimeNotReadyReason)),
WithTransform(IntegrationConditionMessage, Equal("1/1 pods are not ready"))))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(
Satisfy(func(c *v1.IntegrationCondition) bool {
if c.Status != corev1.ConditionFalse {
return false
@@ -339,7 +316,7 @@ func TestHealthTrait(t *testing.T) {
return data["check.kind"].(string) == "READINESS" && data["route.status"].(string) == "Stopped" && data["route.id"].(string) == "binding"
}))
- g.Eventually(PipeCondition(t, ns, name, camelv1.PipeConditionReady), TestTimeoutLong).Should(
+ g.Eventually(PipeCondition(t, ctx, ns, name, camelv1.PipeConditionReady), TestTimeoutLong).Should(
Satisfy(func(c *camelv1.PipeCondition) bool {
if c.Status != corev1.ConditionFalse {
return false
@@ -373,31 +350,28 @@ func TestHealthTrait(t *testing.T) {
}))
// Clean-up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
- g.Expect(DeleteKamelet(t, ns, source)).To(Succeed())
- g.Expect(DeleteKamelet(t, ns, sink)).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(DeleteKamelet(t, ctx, ns, source)).To(Succeed())
+ g.Expect(DeleteKamelet(t, ctx, ns, sink)).To(Succeed())
})
t.Run("Readiness condition with never ready route", func(t *testing.T) {
name := RandomizedSuffixName("never-ready")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/NeverReady.java",
- "--name", name,
- "-t", "health.enabled=true",
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/NeverReady.java", "--name", name, "-t", "health.enabled=true").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
- g.Consistently(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), 1*time.Minute).
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Consistently(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), 1*time.Minute).
Should(Equal(corev1.ConditionFalse))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseError))
// Check that the error message is propagated from health checks even if deployment never becomes ready
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(And(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(And(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionRuntimeNotReadyReason)),
WithTransform(IntegrationConditionMessage, Equal("1/1 pods are not ready"))))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(
Satisfy(func(c *v1.IntegrationCondition) bool {
if c.Status != corev1.ConditionFalse {
return false
@@ -434,23 +408,18 @@ func TestHealthTrait(t *testing.T) {
t.Run("Startup condition with never ready route", func(t *testing.T) {
name := RandomizedSuffixName("startup-probe-never-ready-route")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/NeverReady.java",
- "--name", name,
- "-t", "health.enabled=true",
- "-t", "health.startup-probe-enabled=true",
- "-t", "health.startup-timeout=60",
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/NeverReady.java", "--name", name, "-t", "health.enabled=true", "-t", "health.startup-probe-enabled=true", "-t", "health.startup-timeout=60").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
- g.Consistently(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), 1*time.Minute).Should(Equal(corev1.ConditionFalse))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseError))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Consistently(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), 1*time.Minute).Should(Equal(corev1.ConditionFalse))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseError))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(And(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(And(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionRuntimeNotReadyReason)),
WithTransform(IntegrationConditionMessage, Equal("1/1 pods are not ready"))))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(
Satisfy(func(c *v1.IntegrationCondition) bool {
if c.Status != corev1.ConditionFalse {
return false
@@ -496,17 +465,12 @@ func TestHealthTrait(t *testing.T) {
t.Run("Startup condition with ready route", func(t *testing.T) {
name := RandomizedSuffixName("startup-probe-ready-route")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "health.enabled=true",
- "-t", "health.startup-probe-enabled=true",
- "-t", "health.startup-timeout=60",
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "health.enabled=true", "-t", "health.startup-probe-enabled=true", "-t", "health.startup-timeout=60").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPhase(t, ns, name), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
- g.Eventually(IntegrationCondition(t, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(And(
+ g.Eventually(IntegrationCondition(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(And(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionDeploymentReadyReason)),
WithTransform(IntegrationConditionMessage, Equal("1/1 ready replicas"))))
@@ -519,6 +483,6 @@ func TestHealthTrait(t *testing.T) {
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/istio_test.go b/e2e/common/traits/istio_test.go
index 97cafe4b5..bfe419efb 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 (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -37,32 +38,30 @@ import (
func TestIstioTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-istio"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Run Java with Istio", func(t *testing.T) {
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "istio.enabled=true").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("Magicstring!"))
-
- pod := IntegrationPod(t, ns, name)()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "istio.enabled=true").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+
+ pod := IntegrationPod(t, ctx, ns, name)()
g.Expect(pod.ObjectMeta.Annotations).NotTo(BeNil())
annotations := pod.ObjectMeta.Annotations
g.Expect(annotations["sidecar.istio.io/inject"]).To(Equal("true"))
g.Expect(annotations["traffic.sidecar.istio.io/includeOutboundIPRanges"]).To(Equal("10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, name)).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, name)()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, name)).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, name)()
istioTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "istio")
g.Expect(istioTrait).ToNot(BeNil())
g.Expect(len(istioTrait)).To(Equal(1))
@@ -70,6 +69,6 @@ func TestIstioTrait(t *testing.T) {
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/jolokia_test.go b/e2e/common/traits/jolokia_test.go
index 470732744..bb62cb096 100644
--- a/e2e/common/traits/jolokia_test.go
+++ b/e2e/common/traits/jolokia_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"fmt"
"testing"
@@ -38,35 +39,30 @@ import (
func TestJolokiaTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-jolokia"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Run Java with Jolokia", func(t *testing.T) {
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "jolokia.enabled=true",
- "-t", "jolokia.use-ssl-client-authentication=false",
- "-t", "jolokia.protocol=http",
- "-t", "jolokia.extended-client-check=false").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("Magicstring!"))
-
- pod := IntegrationPod(t, ns, name)
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "jolokia.enabled=true", "-t", "jolokia.use-ssl-client-authentication=false", "-t", "jolokia.protocol=http", "-t", "jolokia.extended-client-check=false").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+
+ pod := IntegrationPod(t, ctx, ns, name)
response, err := TestClient(t).CoreV1().RESTClient().Get().
- AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/jolokia/", ns, pod().Name)).DoRaw(TestContext)
+ AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/jolokia/", ns, pod().Name)).DoRaw(ctx)
g.Expect(err).To(BeNil())
g.Expect(response).To(ContainSubstring(`"status":200`))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, name)).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, name)()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, name)).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, name)()
jolokiaTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "jolokia")
g.Expect(jolokiaTrait).ToNot(BeNil())
g.Expect(len(jolokiaTrait)).To(Equal(4))
@@ -77,6 +73,6 @@ func TestJolokiaTrait(t *testing.T) {
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/jvm_test.go b/e2e/common/traits/jvm_test.go
index 329c90f90..958763f79 100644
--- a/e2e/common/traits/jvm_test.go
+++ b/e2e/common/traits/jvm_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"os"
"testing"
@@ -39,13 +40,13 @@ import (
func TestJVMTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-jvm"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
// Store a configmap holding a jar
var cmData = make(map[string][]byte)
@@ -53,27 +54,24 @@ func TestJVMTrait(t *testing.T) {
source, err := os.ReadFile("./files/jvm/sample-1.0.jar")
require.NoError(t, err)
cmData["sample-1.0.jar"] = source
- err = CreateBinaryConfigmap(t, ns, "my-deps", cmData)
+ err = CreateBinaryConfigmap(t, ctx, ns, "my-deps", cmData)
require.NoError(t, err)
t.Run("JVM trait classpath", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "./files/jvm/Classpath.java",
- "--resource", "configmap:my-deps",
- "-t", "jvm.classpath=/etc/camel/resources/my-deps/sample-1.0.jar",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/jvm/Classpath.java", "--resource", "configmap:my-deps", "-t", "jvm.classpath=/etc/camel/resources/my-deps/sample-1.0.jar").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, "classpath")).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, "classpath")()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, "classpath")).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, "classpath")()
jvmTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "jvm")
g.Expect(jvmTrait).ToNot(BeNil())
g.Expect(len(jvmTrait)).To(Equal(1))
g.Expect(jvmTrait["classpath"]).To(Equal("/etc/camel/resources/my-deps/sample-1.0.jar"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/kamelet_test.go b/e2e/common/traits/kamelet_test.go
index d04d84803..bd744ea2a 100644
--- a/e2e/common/traits/kamelet_test.go
+++ b/e2e/common/traits/kamelet_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,13 +37,13 @@ import (
func TestKameletTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-kamelet"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("discover kamelet capabilities", func(t *testing.T) {
template := map[string]interface{}{
@@ -55,22 +56,22 @@ func TestKameletTrait(t *testing.T) {
},
},
}
- g.Expect(CreateKamelet(t, operatorID, ns, "capabilities-webhook-source", template, nil, nil)()).To(Succeed())
+ g.Expect(CreateKamelet(t, operatorID, ctx, 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())
- 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("Started capabilities-webhook-source-1 (platform-http:///webhook)"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/webhook.yaml", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Started capabilities-webhook-source-1 (platform-http:///webhook)"))
// Verify Integration capabilities
- g.Eventually(IntegrationStatusCapabilities(t, ns, name), TestTimeoutShort).Should(ContainElements("platform-http"))
+ g.Eventually(IntegrationStatusCapabilities(t, ctx, ns, name), TestTimeoutShort).Should(ContainElements("platform-http"))
// Verify expected resources from Kamelet (Service in this case)
- service := Service(t, ns, name)
+ service := Service(t, ctx, ns, name)
g.Eventually(service, TestTimeoutShort).ShouldNot(BeNil())
})
// Clean-up
- g.Expect(DeleteKamelet(t, ns, "capabilities-webhook-source")).To(Succeed())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(DeleteKamelet(t, ctx, ns, "capabilities-webhook-source")).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/master_test.go b/e2e/common/traits/master_test.go
index 014b26c33..96541a8cc 100644
--- a/e2e/common/traits/master_test.go
+++ b/e2e/common/traits/master_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"testing"
"time"
@@ -38,47 +39,36 @@ import (
func TestMasterTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-master"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("master works", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Master.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "master"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "master"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Master.java").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "master"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "master"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("only one integration with master runs", func(t *testing.T) {
nameFirst := RandomizedSuffixName("first")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Master.java",
- "--name", nameFirst,
- "--label", "leader-group=same",
- "-t", "master.label-key=leader-group",
- "-t", "master.label-value=same",
- "-t", "owner.target-labels=leader-group").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, nameFirst), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, nameFirst), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Master.java", "--name", nameFirst, "--label", "leader-group=same", "-t", "master.label-key=leader-group", "-t", "master.label-value=same", "-t", "owner.target-labels=leader-group").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, nameFirst), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, nameFirst), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// Start a second integration with the same lock (it should not start the route)
nameSecond := RandomizedSuffixName("second")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Master.java",
- "--name", nameSecond,
- "--label", "leader-group=same",
- "-t", "master.label-key=leader-group",
- "-t", "master.label-value=same",
- "-t", "master.resource-name=first-lock",
- "-t", "owner.target-labels=leader-group").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, nameSecond), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, nameSecond), TestTimeoutShort).Should(ContainSubstring("started in"))
- g.Eventually(IntegrationLogs(t, ns, nameSecond), 30*time.Second).ShouldNot(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Master.java", "--name", nameSecond, "--label", "leader-group=same", "-t", "master.label-key=leader-group", "-t", "master.label-value=same", "-t", "master.resource-name=first-lock", "-t", "owner.target-labels=leader-group").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, nameSecond), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, nameSecond), TestTimeoutShort).Should(ContainSubstring("started in"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, nameSecond), 30*time.Second).ShouldNot(ContainSubstring("Magicstring!"))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, nameFirst)).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, nameFirst)()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, nameFirst)).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, nameFirst)()
builderTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "addons", "master")
g.Expect(builderTrait).ToNot(BeNil())
g.Expect(len(builderTrait)).To(Equal(2))
@@ -86,6 +76,6 @@ func TestMasterTrait(t *testing.T) {
g.Expect(builderTrait["labelValue"]).To(Equal("same"))
})
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/openapi_test.go b/e2e/common/traits/openapi_test.go
index e761d632a..ef3de8e35 100644
--- a/e2e/common/traits/openapi_test.go
+++ b/e2e/common/traits/openapi_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"io/ioutil"
"testing"
@@ -38,38 +39,34 @@ import (
func TestOpenAPI(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-openapi"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
openapiContent, err := ioutil.ReadFile("./files/openapi/petstore-api.yaml")
require.NoError(t, err)
var cmDataProps = make(map[string]string)
cmDataProps["petstore-api.yaml"] = string(openapiContent)
- CreatePlainTextConfigmap(t, ns, "my-openapi", cmDataProps)
+ CreatePlainTextConfigmap(t, ctx, ns, "my-openapi", cmDataProps)
- g.Expect(KamelRunWithID(t, operatorID, ns,
- "--name", "petstore",
- "--open-api", "configmap:my-openapi",
- "files/openapi/petstore.groovy",
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--name", "petstore", "--open-api", "configmap:my-openapi", "files/openapi/petstore.groovy").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "petstore"), TestTimeoutLong).
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "petstore"), TestTimeoutLong).
Should(Equal(corev1.PodRunning))
- g.Eventually(DeploymentWithIntegrationLabel(t, ns, "petstore"), TestTimeoutLong).
+ g.Eventually(DeploymentWithIntegrationLabel(t, ctx, ns, "petstore"), TestTimeoutLong).
Should(Not(BeNil()))
- g.Eventually(IntegrationLogs(t, ns, "petstore"), TestTimeoutMedium).
+ g.Eventually(IntegrationLogs(t, ctx, ns, "petstore"), TestTimeoutMedium).
Should(ContainSubstring("Started listPets (rest://get:/v1:/pets)"))
- g.Eventually(IntegrationLogs(t, ns, "petstore"), TestTimeoutMedium).
+ g.Eventually(IntegrationLogs(t, ctx, ns, "petstore"), TestTimeoutMedium).
Should(ContainSubstring("Started createPets (rest://post:/v1:/pets)"))
- g.Eventually(IntegrationLogs(t, ns, "petstore"), TestTimeoutMedium).
+ g.Eventually(IntegrationLogs(t, ctx, ns, "petstore"), TestTimeoutMedium).
Should(ContainSubstring("Started showPetById (rest://get:/v1:/pets/%7BpetId%7D)"))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/pdb_test.go b/e2e/common/traits/pdb_test.go
index bd6e91a2e..86e873ae3 100644
--- a/e2e/common/traits/pdb_test.go
+++ b/e2e/common/traits/pdb_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"net/http"
"testing"
@@ -45,28 +46,24 @@ import (
func TestPodDisruptionBudgetTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-pdb"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "pdb.enabled=true",
- "-t", "pdb.min-available=2",
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "pdb.enabled=true", "-t", "pdb.min-available=2").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("Magicstring!"))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, name)).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, name)()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, name)).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, name)()
pdbTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "pdb")
g.Expect(pdbTrait).ToNot(BeNil())
g.Expect(len(pdbTrait)).To(Equal(2))
@@ -74,12 +71,12 @@ func TestPodDisruptionBudgetTrait(t *testing.T) {
g.Expect(pdbTrait["minAvailable"]).To(Equal("2"))
// Check PodDisruptionBudget
- g.Eventually(podDisruptionBudget(t, ns, name), TestTimeoutShort).ShouldNot(BeNil())
- pdb := podDisruptionBudget(t, ns, name)()
+ g.Eventually(podDisruptionBudget(t, ctx, ns, name), TestTimeoutShort).ShouldNot(BeNil())
+ pdb := podDisruptionBudget(t, ctx, ns, name)()
// Assert PDB Spec
g.Expect(pdb.Spec.MinAvailable).To(PointTo(Equal(intstr.FromInt(2))))
// Assert PDB Status
- g.Eventually(podDisruptionBudget(t, ns, name), TestTimeoutShort).
+ g.Eventually(podDisruptionBudget(t, ctx, ns, name), TestTimeoutShort).
Should(MatchFieldsP(IgnoreExtras, Fields{
"Status": MatchFields(IgnoreExtras, Fields{
"ObservedGeneration": BeNumerically("==", 1),
@@ -91,17 +88,17 @@ func TestPodDisruptionBudgetTrait(t *testing.T) {
}))
// Scale Integration
- g.Expect(ScaleIntegration(t, ns, name, 2)).To(Succeed())
- g.Eventually(IntegrationPods(t, ns, name), TestTimeoutMedium).Should(HaveLen(2))
- g.Eventually(IntegrationStatusReplicas(t, ns, name), TestTimeoutShort).
+ g.Expect(ScaleIntegration(t, ctx, ns, name, 2)).To(Succeed())
+ g.Eventually(IntegrationPods(t, ctx, ns, name), TestTimeoutMedium).Should(HaveLen(2))
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(PointTo(BeNumerically("==", 2)))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
// Check PodDisruptionBudget
- pdb = podDisruptionBudget(t, ns, name)()
+ pdb = podDisruptionBudget(t, ctx, ns, name)()
g.Expect(pdb).NotTo(BeNil())
// Assert PDB Status according to the scale change
- g.Eventually(podDisruptionBudget(t, ns, name), TestTimeoutShort).
+ g.Eventually(podDisruptionBudget(t, ctx, ns, name), TestTimeoutShort).
Should(MatchFieldsP(IgnoreExtras, Fields{
"Status": MatchFields(IgnoreExtras, Fields{
"ObservedGeneration": BeNumerically("==", 1),
@@ -113,9 +110,9 @@ func TestPodDisruptionBudgetTrait(t *testing.T) {
}))
// Eviction attempt
- pods := IntegrationPods(t, ns, name)()
+ pods := IntegrationPods(t, ctx, ns, name)()
g.Expect(pods).To(HaveLen(2))
- err := TestClient(t).CoreV1().Pods(ns).EvictV1(TestContext, &policyv1.Eviction{
+ err := TestClient(t).CoreV1().Pods(ns).EvictV1(ctx, &policyv1.Eviction{
ObjectMeta: metav1.ObjectMeta{
Name: pods[0].Name,
},
@@ -139,26 +136,26 @@ func TestPodDisruptionBudgetTrait(t *testing.T) {
// Scale Integration to Scale > PodDisruptionBudgetSpec.MinAvailable
// for the eviction request to succeed once replicas are ready
- g.Expect(ScaleIntegration(t, ns, name, 3)).To(Succeed())
- g.Eventually(IntegrationPods(t, ns, name), TestTimeoutMedium).Should(HaveLen(3))
- g.Eventually(IntegrationStatusReplicas(t, ns, name), TestTimeoutShort).
+ g.Expect(ScaleIntegration(t, ctx, ns, name, 3)).To(Succeed())
+ g.Eventually(IntegrationPods(t, ctx, ns, name), TestTimeoutMedium).Should(HaveLen(3))
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
Should(PointTo(BeNumerically("==", 3)))
- g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- pods = IntegrationPods(t, ns, name)()
+ pods = IntegrationPods(t, ctx, ns, name)()
g.Expect(pods).To(HaveLen(3))
- g.Expect(TestClient(t).CoreV1().Pods(ns).EvictV1(TestContext, &policyv1.Eviction{
+ g.Expect(TestClient(t).CoreV1().Pods(ns).EvictV1(ctx, &policyv1.Eviction{
ObjectMeta: metav1.ObjectMeta{
Name: pods[0].Name,
},
})).To(Succeed())
// Clean up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
-func podDisruptionBudget(t *testing.T, ns string, name string) func() *policyv1.PodDisruptionBudget {
+func podDisruptionBudget(t *testing.T, ctx context.Context, ns string, name string) func() *policyv1.PodDisruptionBudget {
return func() *policyv1.PodDisruptionBudget {
pdb := policyv1.PodDisruptionBudget{
TypeMeta: metav1.TypeMeta{
@@ -170,7 +167,7 @@ func podDisruptionBudget(t *testing.T, ns string, name string) func() *policyv1.
Name: name,
},
}
- err := TestClient(t).Get(TestContext, ctrl.ObjectKeyFromObject(&pdb), &pdb)
+ err := TestClient(t).Get(ctx, ctrl.ObjectKeyFromObject(&pdb), &pdb)
if err != nil && k8serrors.IsNotFound(err) {
return nil
} else if err != nil {
diff --git a/e2e/common/traits/pod_test.go b/e2e/common/traits/pod_test.go
index fbe662c8e..54726a574 100644
--- a/e2e/common/traits/pod_test.go
+++ b/e2e/common/traits/pod_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -36,13 +37,13 @@ import (
func TestPodTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-pod"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
tc := []struct {
name string
@@ -55,10 +56,10 @@ func TestPodTrait(t *testing.T) {
//nolint: thelper
assertions: func(t *testing.T, ns string, name string) {
// check that integrations is working and reading data created by sidecar container
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Content from the sidecar container"))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Content from the sidecar container"))
// check that env var is injected
- g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("hello from the template"))
- pod := IntegrationPod(t, ns, name)()
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("hello from the template"))
+ pod := IntegrationPod(t, ctx, ns, name)()
// check if ENV variable is applied
envValue := getEnvVar("TEST_VARIABLE", pod.Spec)
@@ -70,7 +71,7 @@ func TestPodTrait(t *testing.T) {
templateName: "files/template-with-supplemental-groups.yaml",
//nolint: thelper
assertions: func(t *testing.T, ns string, name string) {
- g.Eventually(IntegrationPodHas(t, ns, name, func(pod *corev1.Pod) bool {
+ g.Eventually(IntegrationPodHas(t, ctx, ns, name, func(pod *corev1.Pod) bool {
if pod.Spec.SecurityContext == nil {
return false
}
@@ -91,23 +92,20 @@ func TestPodTrait(t *testing.T) {
test := tc[i]
t.Run(test.name, func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/PodTest.groovy",
- "--name", name,
- "--pod-template", test.templateName,
- ).Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PodTest.groovy", "--name", name, "--pod-template", test.templateName).Execute()).To(Succeed())
// check integration is deployed
- 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(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
test.assertions(t, ns, name)
// Clean up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/prometheus_test.go b/e2e/common/traits/prometheus_test.go
index 1937e1de8..d50e27059 100644
--- a/e2e/common/traits/prometheus_test.go
+++ b/e2e/common/traits/prometheus_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"fmt"
"testing"
@@ -46,37 +47,35 @@ import (
func TestPrometheusTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-prometheus"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
ocp, err := openshift.IsOpenShift(TestClient(t))
require.NoError(t, err)
// Do not create PodMonitor for the time being as CI test runs on OCP 3.11
createPodMonitor := false
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "-t", "prometheus.enabled=true",
- "-t", fmt.Sprintf("prometheus.pod-monitor=%v", createPodMonitor)).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!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "-t", "prometheus.enabled=true", "-t", fmt.Sprintf("prometheus.pod-monitor=%v", createPodMonitor)).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, "java")).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, "java")()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, "java")).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, "java")()
prometheusTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "prometheus")
g.Expect(prometheusTrait).ToNot(BeNil())
g.Expect(len(prometheusTrait)).To(Equal(2))
g.Expect(prometheusTrait["enabled"]).To(Equal(true))
g.Expect(prometheusTrait["podMonitor"]).ToNot(BeNil())
t.Run("Metrics endpoint works", func(t *testing.T) {
- pod := IntegrationPod(t, ns, "java")
+ pod := IntegrationPod(t, ctx, ns, "java")
response, err := TestClient(t).CoreV1().RESTClient().Get().
- AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/q/metrics", ns, pod().Name)).DoRaw(TestContext)
+ AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/q/metrics", ns, pod().Name)).DoRaw(ctx)
if err != nil {
assert.Fail(t, err.Error())
}
@@ -85,23 +84,23 @@ func TestPrometheusTrait(t *testing.T) {
if ocp && createPodMonitor {
t.Run("PodMonitor is created", func(t *testing.T) {
- sm := podMonitor(t, ns, "java")
+ sm := podMonitor(t, ctx, ns, "java")
g.Eventually(sm, TestTimeoutShort).ShouldNot(BeNil())
})
}
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
-func podMonitor(t *testing.T, ns string, name string) func() *monitoringv1.PodMonitor {
+func podMonitor(t *testing.T, ctx context.Context, ns string, name string) func() *monitoringv1.PodMonitor {
return func() *monitoringv1.PodMonitor {
pm := monitoringv1.PodMonitor{}
key := ctrl.ObjectKey{
Namespace: ns,
Name: name,
}
- err := TestClient(t).Get(TestContext, key, &pm)
+ err := TestClient(t).Get(ctx, key, &pm)
if err != nil && k8serrors.IsNotFound(err) {
return nil
} else if err != nil {
diff --git a/e2e/common/traits/pull_secret_test.go b/e2e/common/traits/pull_secret_test.go
index 989e67b97..7436cfec1 100644
--- a/e2e/common/traits/pull_secret_test.go
+++ b/e2e/common/traits/pull_secret_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -38,47 +39,44 @@ import (
func TestPullSecretTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-pull-secret"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
ocp, err := openshift.IsOpenShift(TestClient(t))
g.Expect(err).To(BeNil())
t.Run("Image pull secret is set on pod", func(t *testing.T) {
name := RandomizedSuffixName("java1")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
- "-t", "pull-secret.enabled=true",
- "-t", "pull-secret.secret-name=dummy-secret").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "pull-secret.enabled=true", "-t", "pull-secret.secret-name=dummy-secret").Execute()).To(Succeed())
// pod may not run because the pull secret is dummy
- g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Or(Equal(corev1.PodRunning), Equal(corev1.PodPending)))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Or(Equal(corev1.PodRunning), Equal(corev1.PodPending)))
- pod := IntegrationPod(t, ns, name)()
+ pod := IntegrationPod(t, ctx, ns, name)()
g.Expect(pod.Spec.ImagePullSecrets).NotTo(BeEmpty())
g.Expect(pod.Spec.ImagePullSecrets[0].Name).To(Equal("dummy-secret"))
})
t.Run("Explicitly disable image pull secret", func(t *testing.T) {
name := RandomizedSuffixName("java2")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
- "-t", "pull-secret.enabled=false").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("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "pull-secret.enabled=false").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, name)).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, name)()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, name)).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, name)()
pullSecretTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "pull-secret")
g.Expect(pullSecretTrait).ToNot(BeNil())
g.Expect(len(pullSecretTrait)).To(Equal(1))
g.Expect(pullSecretTrait["enabled"]).To(Equal(false))
- pod := IntegrationPod(t, ns, name)()
+ pod := IntegrationPod(t, ctx, ns, name)()
if ocp {
// OpenShift `default` service account has imagePullSecrets so it's always set
g.Expect(pod.Spec.ImagePullSecrets).NotTo(BeEmpty())
@@ -91,18 +89,18 @@ func TestPullSecretTrait(t *testing.T) {
// OpenShift always has an internal registry so image pull secret is set by default
t.Run("Image pull secret is automatically set by default", func(t *testing.T) {
name := RandomizedSuffixName("java3")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name).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("Magicstring!"))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- pod := IntegrationPod(t, ns, name)()
+ pod := IntegrationPod(t, ctx, ns, name)()
g.Expect(pod.Spec.ImagePullSecrets).NotTo(BeEmpty())
g.Expect(pod.Spec.ImagePullSecrets[0].Name).To(HavePrefix("default-dockercfg-"))
})
}
// Clean-up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/route_test.go b/e2e/common/traits/route_test.go
index 3df769452..ce31bfa61 100644
--- a/e2e/common/traits/route_test.go
+++ b/e2e/common/traits/route_test.go
@@ -24,6 +24,7 @@ package traits
import (
"bytes"
+ "context"
"crypto/rand"
"crypto/rsa"
"crypto/tls"
@@ -74,13 +75,13 @@ var skipClientTLSVerification = true
func TestRunRoutes(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-route"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns, "--trait-profile=openshift")).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--trait-profile=openshift")).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
ocp, err := openshift.IsOpenShift(TestClient(t))
if !ocp {
@@ -91,7 +92,7 @@ func TestRunRoutes(t *testing.T) {
// create a test secret of type tls with certificates
// this secret is used to setupt the route TLS object across diferent tests
- secret, err := createSecret(t, ns)
+ secret, err := createSecret(t, ctx, ns)
require.NoError(t, err)
// they refer to the certificates create in the secret and are reused the different tests
@@ -102,45 +103,41 @@ func TestRunRoutes(t *testing.T) {
// Insecure Route / No TLS
// =============================
t.Run("Route unsecure http works", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/PlatformHttpServer.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- route := Route(t, ns, integrationName)
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ route := Route(t, ctx, ns, integrationName)
g.Eventually(route, TestTimeoutMedium).ShouldNot(BeNil())
// must wait a little time after route is created, before doing an http request,
// otherwise the route is unavailable and the http request will fail
time.Sleep(waitBeforeHttpRequest)
url := fmt.Sprintf("http://%s/hello?name=Simple", route().Spec.Host)
g.Eventually(httpRequest(url, false), TestTimeoutShort).Should(Equal("Hello Simple"))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
})
// =============================
// TLS Route Edge
// =============================
t.Run("Route Edge https works", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/PlatformHttpServer.java", "-t", "route.tls-termination=edge").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- route := Route(t, ns, integrationName)
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "route.tls-termination=edge").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ route := Route(t, ctx, ns, integrationName)
g.Eventually(route, TestTimeoutMedium).ShouldNot(BeNil())
// must wait a little time after route is created, before an http request,
// otherwise the route is unavailable and the http request will fail
time.Sleep(waitBeforeHttpRequest)
url := fmt.Sprintf("https://%s/hello?name=TLS_Edge", route().Spec.Host)
g.Eventually(httpRequest(url, true), TestTimeoutShort).Should(Equal("Hello TLS_Edge"))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
})
// =============================
// TLS Route Edge with custom certificate
// =============================
t.Run("Route Edge (custom certificate) https works", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/PlatformHttpServer.java",
- "-t", "route.tls-termination=edge",
- "-t", "route.tls-certificate-secret="+refCert,
- "-t", "route.tls-key-secret="+refKey,
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- route := Route(t, ns, integrationName)
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "route.tls-termination=edge", "-t", "route.tls-certificate-secret="+refCert, "-t", "route.tls-key-secret="+refKey).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ route := Route(t, ctx, ns, integrationName)
g.Eventually(route, TestTimeoutMedium).ShouldNot(BeNil())
// must wait a little time after route is created, before an http request,
// otherwise the route is unavailable and the http request will fail
@@ -148,24 +145,16 @@ func TestRunRoutes(t *testing.T) {
code := "TLS_EdgeCustomCertificate"
url := fmt.Sprintf("https://%s/hello?name=%s", route().Spec.Host, code)
g.Eventually(httpRequest(url, true), TestTimeoutShort).Should(Equal("Hello " + code))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
})
// =============================
// TLS Route Passthrough
// =============================
t.Run("Route passthrough https works", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/PlatformHttpServer.java",
- // the --resource mounts the certificates inside secret as files in the integration pod
- "--resource", "secret:"+secretName+"@/etc/ssl/"+secretName,
- // quarkus platform-http uses these two properties to setup the HTTP endpoint with TLS support
- "-p", "quarkus.http.ssl.certificate.file=/etc/ssl/"+secretName+"/tls.crt",
- "-p", "quarkus.http.ssl.certificate.key-file=/etc/ssl/"+secretName+"/tls.key",
- "-t", "route.tls-termination=passthrough",
- "-t", "container.port=8443",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- route := Route(t, ns, integrationName)
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "--resource", "secret:"+secretName+"@/etc/ssl/"+secretName, "-p", "quarkus.http.ssl.certificate.file=/etc/ssl/"+secretName+"/tls.crt", "-p", "quarkus.http.ssl.certificate.key-file=/etc/ssl/"+secretName+"/tls.key", "-t", "route.tls-termination=passthrough", "-t", "container.port=8443").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ route := Route(t, ctx, ns, integrationName)
g.Eventually(route, TestTimeoutMedium).ShouldNot(BeNil())
// must wait a little time after route is created, before an http request,
// otherwise the route is unavailable and the http request will fail
@@ -173,29 +162,17 @@ func TestRunRoutes(t *testing.T) {
code := "TLS_Passthrough"
url := fmt.Sprintf("https://%s/hello?name=%s", route().Spec.Host, code)
g.Eventually(httpRequest(url, true), TestTimeoutShort).Should(Equal("Hello " + code))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
})
// =============================
// TLS Route Reencrypt
// =============================
t.Run("Route Reencrypt https works", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/PlatformHttpServer.java",
- // the --resource mounts the certificates inside secret as files in the integration pod
- "--resource", "secret:"+secretName+"@/etc/ssl/"+secretName,
- // quarkus platform-http uses these two properties to setup the HTTP endpoint with TLS support
- "-p", "quarkus.http.ssl.certificate.file=/etc/ssl/"+secretName+"/tls.crt",
- "-p", "quarkus.http.ssl.certificate.key-file=/etc/ssl/"+secretName+"/tls.key",
- "-t", "route.tls-termination=reencrypt",
- // the destination CA certificate which the route service uses to validate the HTTP endpoint TLS certificate
- "-t", "route.tls-destination-ca-certificate-secret="+refCert,
- "-t", "route.tls-certificate-secret="+refCert,
- "-t", "route.tls-key-secret="+refKey,
- "-t", "container.port=8443",
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
-
- route := Route(t, ns, integrationName)
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "--resource", "secret:"+secretName+"@/etc/ssl/"+secretName, "-p", "quarkus.http.ssl.certificate.file=/etc/ssl/"+secretName+"/tls.crt", "-p", "quarkus.http.ssl.certificate.key-file=/etc/ssl/"+secretName+"/tls.key", "-t", "route.tls-termination=reencrypt", "-t", "route.tls-destination-ca-certificate-secret="+refCert, "-t", "route.tls-certificate-secret="+refCert, "-t", "route.tls-key-secret="+refKey, "-t", [...]
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+
+ route := Route(t, ctx, ns, integrationName)
g.Eventually(route, TestTimeoutMedium).ShouldNot(BeNil())
// must wait a little time after route is created, before an http request,
// otherwise the route is unavailable and the http request will fail
@@ -203,14 +180,13 @@ func TestRunRoutes(t *testing.T) {
code := "TLS_Reencrypt"
url := fmt.Sprintf("https://%s/hello?name=%s", route().Spec.Host, code)
g.Eventually(httpRequest(url, true), TestTimeoutShort).Should(Equal("Hello " + code))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
})
t.Run("Route annotations added", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/PlatformHttpServer.java",
- "-t", "route.annotations.'haproxy.router.openshift.io/balance'=roundrobin").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- route := RouteFull(t, ns, integrationName)()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "route.annotations.'haproxy.router.openshift.io/balance'=roundrobin").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ route := RouteFull(t, ctx, ns, integrationName)()
g.Eventually(route, TestTimeoutMedium).ShouldNot(BeNil())
// must wait a little time after route is created, before an http request,
// otherwise the route is unavailable and the http request will fail
@@ -219,16 +195,16 @@ func TestRunRoutes(t *testing.T) {
g.Expect(annotations["haproxy.router.openshift.io/balance"]).To(Equal("roundrobin"))
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, integrationName)).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, integrationName)()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, integrationName)).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, integrationName)()
routeTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "route")
g.Expect(routeTrait).ToNot(BeNil())
g.Expect(len(routeTrait)).To(Equal(1))
g.Expect(routeTrait["enabled"]).To(Equal(true))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
})
- g.Expect(TestClient(t).Delete(TestContext, &secret)).To(Succeed())
+ g.Expect(TestClient(t).Delete(ctx, &secret)).To(Succeed())
})
}
@@ -280,8 +256,8 @@ func httpClient(tlsEnabled bool, timeout time.Duration) (*http.Client, error) {
return &client, nil
}
-func createSecret(t *testing.T, ns string) (corev1.Secret, error) {
- keyCertPair := generateSampleKeyAndCertificate(t, ns)
+func createSecret(t *testing.T, ctx context.Context, ns string) (corev1.Secret, error) {
+ keyCertPair := generateSampleKeyAndCertificate(t, ctx, ns)
sec := corev1.Secret{
TypeMeta: metav1.TypeMeta{
Kind: "Secret",
@@ -297,12 +273,12 @@ func createSecret(t *testing.T, ns string) (corev1.Secret, error) {
corev1.TLSCertKey: keyCertPair.Certificate,
},
}
- return sec, TestClient(t).Create(TestContext, &sec)
+ return sec, TestClient(t).Create(ctx, &sec)
}
-func generateSampleKeyAndCertificate(t *testing.T, ns string) keyCertificatePair {
+func generateSampleKeyAndCertificate(t *testing.T, ctx context.Context, ns string) keyCertificatePair {
serialNumber := big.NewInt(util.RandomInt63())
- domainName, err := ClusterDomainName(t)
+ domainName, err := ClusterDomainName(t, ctx)
if err != nil {
fmt.Printf("Error retrieving cluster domain object, then the http client request will skip TLS validation: %s\n", err)
skipClientTLSVerification = true
diff --git a/e2e/common/traits/service_binding_test.go b/e2e/common/traits/service_binding_test.go
index 8eca83f10..b5862d2fa 100644
--- a/e2e/common/traits/service_binding_test.go
+++ b/e2e/common/traits/service_binding_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"fmt"
"testing"
@@ -38,13 +39,13 @@ import (
func TestServiceBindingTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-service-binding"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Integration Service Binding", func(t *testing.T) {
// Create our mock service config
@@ -69,17 +70,14 @@ 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(TestClient(t).Create(ctx, service)).To(Succeed())
// Create integration and bind it to our service
name := RandomizedSuffixName("service-binding")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/ServiceBinding.java",
- "--name", name,
- "--connect", serviceRef,
- ).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(fmt.Sprintf("%s:%s", host, port)))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/ServiceBinding.java", "--name", name, "--connect", serviceRef).Execute()).To(Succeed())
+
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring(fmt.Sprintf("%s:%s", host, port)))
})
t.Run("Binding Service Binding", func(t *testing.T) {
@@ -102,16 +100,14 @@ 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, 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())
- g.Eventually(IntegrationPodPhase(t, ns, "my-timer-source-to-log"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ns, "my-timer-source-to-log")).Should(ContainSubstring("Body: Hello+world"))
+ g.Expect(TestClient(t).Create(ctx, service)).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "my-timer-source")()).To(Succeed())
+ g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "my-timer-source", "log:info", "-p", "source.message=Hello+world", "--connect", serviceRef).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "my-timer-source-to-log"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, "my-timer-source-to-log")).Should(ContainSubstring("Body: Hello+world"))
})
// Clean up
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/service_test.go b/e2e/common/traits/service_test.go
index ea776dd1c..e18e23735 100644
--- a/e2e/common/traits/service_test.go
+++ b/e2e/common/traits/service_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -37,95 +38,87 @@ import (
func TestServiceTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-service"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("NodePort service", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/PlatformHttpServer.java",
- "-t", "service.enabled=true",
- "-t", "service.node-port=true").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "service.enabled=true", "-t", "service.node-port=true").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
//
// Service names can vary with the ExternalName Service
// sometimes being created first and being given the root name
//
- g.Eventually(ServicesByType(t, ns, corev1.ServiceTypeNodePort), TestTimeoutLong).ShouldNot(BeEmpty())
+ g.Eventually(ServicesByType(t, ctx, ns, corev1.ServiceTypeNodePort), TestTimeoutLong).ShouldNot(BeEmpty())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Default service (ClusterIP)", func(t *testing.T) {
// Service trait is enabled by default
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/PlatformHttpServer.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
//
// Service names can vary with the ExternalName Service
// sometimes being created first and being given the root name
//
- g.Eventually(ServicesByType(t, ns, corev1.ServiceTypeClusterIP), TestTimeoutLong).ShouldNot(BeEmpty())
+ g.Eventually(ServicesByType(t, ctx, ns, corev1.ServiceTypeClusterIP), TestTimeoutLong).ShouldNot(BeEmpty())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("NodePort service from Type", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/PlatformHttpServer.java",
- "-t", "service.enabled=true",
- "-t", "service.type=NodePort").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "service.enabled=true", "-t", "service.type=NodePort").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
//
// Service names can vary with the ExternalName Service
// sometimes being created first and being given the root name
//
- g.Eventually(ServicesByType(t, ns, corev1.ServiceTypeNodePort), TestTimeoutLong).ShouldNot(BeEmpty())
+ g.Eventually(ServicesByType(t, ctx, ns, corev1.ServiceTypeNodePort), TestTimeoutLong).ShouldNot(BeEmpty())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("ClusterIP service from Type", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/PlatformHttpServer.java",
- "-t", "service.enabled=true",
- "-t", "service.type=ClusterIP").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "service.enabled=true", "-t", "service.type=ClusterIP").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
//
// Service names can vary with the ExternalName Service
// sometimes being created first and being given the root name
//
- g.Eventually(ServicesByType(t, ns, corev1.ServiceTypeClusterIP), TestTimeoutLong).ShouldNot(BeEmpty())
+ g.Eventually(ServicesByType(t, ctx, ns, corev1.ServiceTypeClusterIP), TestTimeoutLong).ShouldNot(BeEmpty())
// check integration schema does not contains unwanted default trait value.
- g.Eventually(UnstructuredIntegration(t, ns, "platform-http-server")).ShouldNot(BeNil())
- unstructuredIntegration := UnstructuredIntegration(t, ns, "platform-http-server")()
+ g.Eventually(UnstructuredIntegration(t, ctx, ns, "platform-http-server")).ShouldNot(BeNil())
+ unstructuredIntegration := UnstructuredIntegration(t, ctx, ns, "platform-http-server")()
serviceTrait, _, _ := unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", "service")
g.Expect(serviceTrait).ToNot(BeNil())
g.Expect(len(serviceTrait)).To(Equal(2))
g.Expect(serviceTrait["enabled"]).To(Equal(true))
g.Expect(serviceTrait["type"]).To(Equal("ClusterIP"))
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("LoadBalancer service from Type", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/PlatformHttpServer.java",
- "-t", "service.enabled=true",
- "-t", "service.type=LoadBalancer").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ns, "platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "service.enabled=true", "-t", "service.type=LoadBalancer").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, "platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
//
// Service names can vary with the ExternalName Service
// sometimes being created first and being given the root name
//
- g.Eventually(ServicesByType(t, ns, corev1.ServiceTypeLoadBalancer), TestTimeoutLong).ShouldNot(BeEmpty())
+ g.Eventually(ServicesByType(t, ctx, ns, corev1.ServiceTypeLoadBalancer), TestTimeoutLong).ShouldNot(BeEmpty())
- g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
})
}
diff --git a/e2e/common/traits/toleration_test.go b/e2e/common/traits/toleration_test.go
index e47330f73..98e8def88 100644
--- a/e2e/common/traits/toleration_test.go
+++ b/e2e/common/traits/toleration_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "context"
"testing"
. "github.com/onsi/gomega"
@@ -38,26 +39,22 @@ import (
func TestTolerationTrait(t *testing.T) {
t.Parallel()
- WithNewTestNamespace(t, func(g *WithT, ns string) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-traits-toleration"
- g.Expect(CopyCamelCatalog(t, ns, operatorID)).To(Succeed())
- g.Expect(CopyIntegrationKits(t, ns, operatorID)).To(Succeed())
- g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
+ g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
+ g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+ g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Run Java with node toleration operation exists", func(t *testing.T) {
name := RandomizedSuffixName("java1")
- g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
- "--name", name,
- "-t", "toleration.enabled=true",
- "-t", "toleration.taints=camel.apache.org/master:NoExecute:300",
- ).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("Magicstring!"))
-
- pod := IntegrationPod(t, ns, name)()
+ g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "toleration.enabled=true", "-t", "toleration.taints=camel.apache.org/master:NoExecute:300").Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+
+ pod := IntegrationPod(t, ctx, ns, name)()
g.Expect(pod.Spec.Tolerations).NotTo(BeNil())
g.Expect(pod.Spec.Tolerations).To(ContainElement(corev1.Toleration{
@@ -70,16 +67,12 @@ func TestTolerationTrait(t *testing.T) {
t.Run("Run Java with node toleration operation equals", func(t *testing.T) {
name := RandomizedSuffixName("java2")
... 5265 lines suppressed ...