You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2024/07/02 07:35:32 UTC
(camel-k) 03/24: chore(e2e): restructure tests to embed a global operator
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit e917739312525be41a0273c65aee694a32d4dd20
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Wed Jun 19 16:31:20 2024 +0200
chore(e2e): restructure tests to embed a global operator
---
.github/actions/e2e-builder/action.yml | 76 ----
.github/actions/e2e-builder/exec-tests.sh | 135 -------
.github/actions/e2e-common/exec-tests.sh | 2 +
.github/actions/e2e-knative-yaks/exec-tests.sh | 3 +
.github/actions/e2e-knative/exec-tests.sh | 3 +
.github/actions/e2e-native/exec-tests.sh | 3 +
.github/actions/e2e-telemetry/exec-tests.sh | 3 +
.github/workflows/builder.yml | 79 ----
e2e/advanced/build_order_strategy_test.go | 4 +-
e2e/{builder => advanced}/build_test.go | 2 +-
e2e/{builder => advanced}/files/example.yaml | 0
e2e/advanced/promote_test.go | 8 +-
e2e/{builder => advanced}/registry_test.go | 2 +-
e2e/common/cli/bind_test.go | 16 +-
e2e/common/cli/config_test.go | 2 +-
e2e/common/cli/delete_test.go | 14 +-
e2e/common/cli/describe_test.go | 15 +-
e2e/common/cli/dev_mode_test.go | 25 +-
e2e/common/cli/duplicate_parameters_test.go | 56 ---
e2e/common/cli/get_test.go | 10 +-
e2e/common/cli/log_test.go | 4 +-
e2e/common/cli/main_test.go | 65 ----
e2e/common/cli/run_test.go | 69 +---
e2e/common/config/config_reload_test.go | 49 +--
e2e/common/config/config_test.go | 190 ++-------
e2e/common/config/kamelet_config_test.go | 159 ++------
e2e/common/config/pipe_config_test.go | 40 +-
e2e/common/languages/groovy_test.go | 12 +-
e2e/common/languages/java_test.go | 12 +-
e2e/common/languages/js_test.go | 12 +-
e2e/common/languages/kotlin_test.go | 12 +-
e2e/common/languages/polyglot_test.go | 12 +-
e2e/common/languages/xml_test.go | 12 +-
e2e/common/languages/yaml_test.go | 12 +-
e2e/common/main_test.go | 70 ----
e2e/common/misc/client_test.go | 3 -
e2e/common/misc/cron_test.go | 19 +-
e2e/common/misc/integration_fail_test.go | 28 +-
e2e/common/misc/integration_trait_update_test.go | 14 +-
e2e/common/misc/kamelet_test.go | 13 +-
e2e/common/misc/kamelet_update_test.go | 22 +-
e2e/common/misc/maven_repository_test.go | 12 +-
e2e/common/misc/pipe_test.go | 159 +++++++-
e2e/common/misc/pipe_with_image_test.go | 94 -----
e2e/common/misc/registry_maven_wagon_test.go | 148 -------
e2e/common/misc/rest_test.go | 15 +-
e2e/common/misc/scale_binding_test.go | 142 -------
e2e/common/misc/scale_integration_test.go | 15 +-
e2e/common/misc/structured_logs_test.go | 19 +-
e2e/common/runtimes/runtimes_test.go | 16 +-
e2e/common/traits/affinity_test.go | 87 ++---
e2e/common/traits/builder_test.go | 115 +-----
e2e/common/traits/camel_test.go | 21 +-
e2e/common/traits/container_test.go | 16 +-
e2e/common/traits/deployment_test.go | 24 +-
e2e/common/traits/error_handler_test.go | 10 +-
e2e/common/traits/errored_trait_test.go | 15 +-
e2e/common/traits/gc_test.go | 17 +-
e2e/common/traits/health_test.go | 37 +-
e2e/common/traits/istio_test.go | 13 +-
e2e/common/traits/jolokia_test.go | 12 +-
e2e/common/traits/jvm_test.go | 16 +-
e2e/common/traits/kamelet_test.go | 16 +-
e2e/common/traits/master_test.go | 16 +-
e2e/common/traits/openapi_test.go | 19 +-
e2e/common/traits/pdb_test.go | 13 +-
e2e/common/traits/pod_test.go | 15 +-
e2e/common/traits/prometheus_test.go | 12 +-
e2e/common/traits/pull_secret_test.go | 17 +-
e2e/common/traits/route_test.go | 23 +-
e2e/common/traits/service_binding_test.go | 17 +-
e2e/common/traits/service_test.go | 33 +-
e2e/common/traits/toleration_test.go | 17 +-
e2e/install/cli/files/Java.java | 28 --
e2e/install/cli/files/timer-kamelet-usage.yaml | 21 -
e2e/install/cli/files/yaml.yaml | 28 --
e2e/install/cli/global_kamelet_test.go | 74 ----
e2e/install/cli/global_test.go | 170 --------
e2e/install/cli/install_test.go | 223 -----------
e2e/install/cli/maven_ca_secret_test.go | 468 -----------------------
e2e/install/cli/uninstall_test.go | 158 --------
e2e/knative/kamelet_test.go | 2 +-
e2e/native/native_binding_test.go | 68 ----
e2e/native/native_test.go | 51 +--
e2e/native/native_with_sources_test.go | 22 +-
e2e/support/test_support.go | 37 +-
script/Makefile | 35 +-
87 files changed, 490 insertions(+), 3383 deletions(-)
diff --git a/.github/actions/e2e-builder/action.yml b/.github/actions/e2e-builder/action.yml
deleted file mode 100644
index 1b96084cd..000000000
--- a/.github/actions/e2e-builder/action.yml
+++ /dev/null
@@ -1,76 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-name: e2e-builder
-description: 'End-to-End tests for builder use-cases'
-
-inputs:
- cluster-config-data:
- description: 'The configuration of the underlying cluster (if cluster-type is custom)'
- required: false
- cluster-kube-config-data:
- description: 'Base16 encoded kube config - required for custom cluster type only'
- required: false
- publisher:
- description: 'The publishing strategy to be used'
- required: true
-
-runs:
- using: "composite"
-
- steps:
- - id: prepare-env
- name: Prepare Test Environment
- uses: ./.github/actions/kamel-prepare-env
-
- - id: config-cluster
- name: Configure Platform
- uses: ./.github/actions/kamel-config-cluster
- with:
- cluster-config-data: ${{ inputs.cluster-config-data }}
- cluster-kube-config-data: ${{ inputs.cluster-kube-config-data }}
-
- - id: build-kamel
- name: Build Kamel
- uses: ./.github/actions/kamel-build
- with:
- image-registry-push-host: ${{ steps.config-cluster.outputs.cluster-image-registry-push-host }}
- image-registry-pull-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
- image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
- # Builds the bundle if an OLM is available - depends on cluster being tested
- build-bundle: ${{ steps.config-cluster.outputs.cluster-has-olm }}
- # Both can be empty and so catalog source will not be created
- catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }}
- catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
-
- - id: run-it
- name: Run IT
- shell: bash
- env:
- KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY: ${{ inputs.publisher }}
- run: |
- ./.github/actions/e2e-builder/exec-tests.sh \
- -b "${{ steps.config-cluster.outputs.cluster-catalog-source-name }}" \
- -c "${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}" \
- -g "${{ steps.config-cluster.outputs.cluster-global-operator-namespace }}" \
- -i "${{ steps.config-cluster.outputs.cluster-image-namespace }}" \
- -l "${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}" \
- -n "${{ steps.build-kamel.outputs.build-binary-local-image-name }}" \
- -q "${{ env.CAMEL_K_LOG_LEVEL }}" \
- -s "${{steps.config-cluster.outputs.cluster-image-registry-insecure }}" \
- -v "${{ steps.build-kamel.outputs.build-binary-local-image-version }}" \
- -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}"
diff --git a/.github/actions/e2e-builder/exec-tests.sh b/.github/actions/e2e-builder/exec-tests.sh
deleted file mode 100755
index f995ef77a..000000000
--- a/.github/actions/e2e-builder/exec-tests.sh
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/bin/bash
-
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-####
-#
-# Execute the builder tests
-#
-####
-
-set -e
-
-while getopts ":b:c:g:i:l:n:q:s:v:x:" opt; do
- case "${opt}" in
- b)
- BUILD_CATALOG_SOURCE_NAME=${OPTARG}
- ;;
- c)
- BUILD_CATALOG_SOURCE_NAMESPACE=${OPTARG}
- ;;
- g)
- GLOBAL_OPERATOR_NAMESPACE=${OPTARG}
- ;;
- i)
- IMAGE_NAMESPACE=${OPTARG}
- ;;
- l)
- REGISTRY_PULL_HOST=${OPTARG}
- ;;
- n)
- IMAGE_NAME=${OPTARG}
- ;;
- q)
- LOG_LEVEL=${OPTARG}
- ;;
- s)
- REGISTRY_INSECURE=${OPTARG}
- ;;
- v)
- IMAGE_VERSION=${OPTARG}
- ;;
- x)
- SAVE_FAILED_TEST_NS=${OPTARG}
- ;;
- :)
- echo "ERROR: Option -$OPTARG requires an argument"
- exit 1
- ;;
- \?)
- echo "ERROR: Invalid option -$OPTARG"
- exit 1
- ;;
- esac
-done
-shift $((OPTIND-1))
-
-if [ -z "${IMAGE_NAME}" ]; then
- echo "Error: local-image-name not defined"
- exit 1
-fi
-
-if [ -z "${IMAGE_VERSION}" ]; then
- echo "Error: local-image-version not defined"
- exit 1
-fi
-
-if [ -z "${IMAGE_NAMESPACE}" ]; then
- echo "Error: image-namespace not defined"
- exit 1
-fi
-
-if [ -z "${REGISTRY_PULL_HOST}" ]; then
- echo "Error: image-registry-pull-host not defined"
- exit 1
-fi
-
-if [ -z "${REGISTRY_INSECURE}" ]; then
- echo "Error: image-registry-insecure not defined"
- exit 1
-fi
-
-# Cluster environment
-export CUSTOM_IMAGE=${IMAGE_NAME}
-export CUSTOM_VERSION=${IMAGE_VERSION}
-
-#
-# If bundle has been built and installed then use it
-#
-if [ -n "${BUILD_CATALOG_SOURCE_NAMESPACE}" ]; then
- export KAMEL_INSTALL_OLM_SOURCE=${BUILD_CATALOG_SOURCE_NAME}
- export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${BUILD_CATALOG_SOURCE_NAMESPACE}
- export KAMEL_INSTALL_OLM_CHANNEL="${NEW_XY_CHANNEL}"
-fi
-
-export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
-export KAMEL_INSTALL_REGISTRY=${REGISTRY_PULL_HOST}
-export KAMEL_INSTALL_REGISTRY_INSECURE=${REGISTRY_INSECURE}
-export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
-
-# Will only have an effect if olm=false
-# since, for OLM, the csv determines the policy
-# (see kamel-build-bundle/build-bundle-image.sh)
-export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
-
-export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}"
-if [ "${LOG_LEVEL}" == "debug" ]; then
- export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}"
-fi
-export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
-export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
-export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS}
-
-if [ -n "${GLOBAL_OPERATOR_NAMESPACE}" ]; then
- export CAMEL_K_GLOBAL_OPERATOR_NS="${GLOBAL_OPERATOR_NAMESPACE}"
-else
- export CAMEL_K_GLOBAL_OPERATOR_NS="default"
-fi
-
-# Then run integration tests
-DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-builder
diff --git a/.github/actions/e2e-common/exec-tests.sh b/.github/actions/e2e-common/exec-tests.sh
index 3f68f0572..61f7e0786 100755
--- a/.github/actions/e2e-common/exec-tests.sh
+++ b/.github/actions/e2e-common/exec-tests.sh
@@ -147,6 +147,8 @@ if [ "${SMOKE_TEST_ONLY}" == "true" ]; then
elif [ "${CUSTOM_INSTALL_TEST}" == "true" ]; then
DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-advanced || exit_code=1
else
+ kubectl create ns camel-k
+ REGISTRY="${KAMEL_INSTALL_REGISTRY}" make install-k8s-global
DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-common || exit_code=1
fi
set +e
diff --git a/.github/actions/e2e-knative-yaks/exec-tests.sh b/.github/actions/e2e-knative-yaks/exec-tests.sh
index 1f711c94b..4eb8e5860 100755
--- a/.github/actions/e2e-knative-yaks/exec-tests.sh
+++ b/.github/actions/e2e-knative-yaks/exec-tests.sh
@@ -122,5 +122,8 @@ export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS}
+kubectl create ns camel-k
+REGISTRY="${KAMEL_INSTALL_REGISTRY}" make install-k8s-global
+
# Then run integration tests
yaks test e2e/yaks/common
diff --git a/.github/actions/e2e-knative/exec-tests.sh b/.github/actions/e2e-knative/exec-tests.sh
index 9390d5fa4..27d5106d7 100755
--- a/.github/actions/e2e-knative/exec-tests.sh
+++ b/.github/actions/e2e-knative/exec-tests.sh
@@ -134,5 +134,8 @@ else
export CAMEL_K_GLOBAL_OPERATOR_NS="default"
fi
+kubectl create ns camel-k
+REGISTRY="${KAMEL_INSTALL_REGISTRY}" make install-k8s-global
+
# Then run integration tests
DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-knative
diff --git a/.github/actions/e2e-native/exec-tests.sh b/.github/actions/e2e-native/exec-tests.sh
index fe84ace5c..00d3f1eb4 100755
--- a/.github/actions/e2e-native/exec-tests.sh
+++ b/.github/actions/e2e-native/exec-tests.sh
@@ -127,5 +127,8 @@ if [ "${LOG_LEVEL}" == "debug" ]; then
export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}"
fi
+kubectl create ns camel-k
+REGISTRY="${KAMEL_INSTALL_REGISTRY}" make install-k8s-global
+
# Then run integration tests
DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-quarkus-native
diff --git a/.github/actions/e2e-telemetry/exec-tests.sh b/.github/actions/e2e-telemetry/exec-tests.sh
index d5567a04f..ebe1ed4fb 100755
--- a/.github/actions/e2e-telemetry/exec-tests.sh
+++ b/.github/actions/e2e-telemetry/exec-tests.sh
@@ -131,6 +131,9 @@ else
export CAMEL_K_GLOBAL_OPERATOR_NS="default"
fi
+kubectl create ns camel-k
+REGISTRY="${KAMEL_INSTALL_REGISTRY}" make install-k8s-global
+
# Then run all integration telemetry test rather than ending on first failure
set -e
exit_code=0
diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml
deleted file mode 100644
index 4bce8e392..000000000
--- a/.github/workflows/builder.yml
+++ /dev/null
@@ -1,79 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-name: builder
-
-env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- CAMEL_K_TEST_TIMEOUT_VERY_LONG: 15m
-
-on:
- pull_request:
- branches:
- - main
- - "release-*"
- paths-ignore:
- - 'docs/**'
- - 'java/**'
- - 'proposals/**'
- - '**.adoc'
- - '**.md'
- - 'KEYS'
- - 'LICENSE'
- - 'NOTICE'
- push:
- branches:
- - main
- - "release-*"
- paths-ignore:
- - 'docs/**'
- - 'java/**'
- - 'proposals/**'
- - '**.adoc'
- - '**.md'
- - 'KEYS'
- - 'LICENSE'
- - 'NOTICE'
- workflow_dispatch:
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
- cancel-in-progress: true
-
-jobs:
- builder-it:
- runs-on: ubuntu-latest
-
- strategy:
- fail-fast: false
- matrix:
- publisher: ["Jib"]
-
- steps:
-
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- persist-credentials: false
- submodules: recursive
-
- - name: Builder Tests
- uses: ./.github/actions/e2e-builder
- with:
- cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
- cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }}
- publisher: ${{ matrix.publisher }}
diff --git a/e2e/advanced/build_order_strategy_test.go b/e2e/advanced/build_order_strategy_test.go
index adfba154b..5a2031410 100644
--- a/e2e/advanced/build_order_strategy_test.go
+++ b/e2e/advanced/build_order_strategy_test.go
@@ -44,7 +44,7 @@ func TestRunBuildOrderStrategyMatchingDependencies(t *testing.T) {
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, ctx, operatorID, ns, "timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKameletWithID(t, ctx, operatorID, ns, "timer-source")()).To(Succeed())
integrationA := RandomizedSuffixName("java-a")
g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", integrationA).Execute()).To(Succeed())
@@ -115,7 +115,7 @@ func TestRunBuildOrderStrategyFIFO(t *testing.T) {
g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--build-order-strategy", string(v1.BuildOrderStrategyFIFO))).To(Succeed())
g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKameletWithID(t, ctx, operatorID, ns, "timer-source")()).To(Succeed())
integrationA := RandomizedSuffixName("java-a")
g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java",
diff --git a/e2e/builder/build_test.go b/e2e/advanced/build_test.go
similarity index 99%
rename from e2e/builder/build_test.go
rename to e2e/advanced/build_test.go
index 0ed06c7e0..4bf2d60d7 100644
--- a/e2e/builder/build_test.go
+++ b/e2e/advanced/build_test.go
@@ -20,7 +20,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-package builder
+package advanced
import (
"context"
diff --git a/e2e/builder/files/example.yaml b/e2e/advanced/files/example.yaml
similarity index 100%
rename from e2e/builder/files/example.yaml
rename to e2e/advanced/files/example.yaml
diff --git a/e2e/advanced/promote_test.go b/e2e/advanced/promote_test.go
index dc0116320..f8523720f 100644
--- a/e2e/advanced/promote_test.go
+++ b/e2e/advanced/promote_test.go
@@ -72,14 +72,14 @@ func TestKamelCLIPromote(t *testing.T) {
})
t.Run("kamelet integration dev", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, ctx, operatorDevID, nsDev, "my-own-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKameletWithID(t, ctx, operatorDevID, nsDev, "my-own-timer-source")()).To(Succeed())
g.Expect(KamelRunWithID(t, ctx, operatorDevID, nsDev, "./files/timer-kamelet-usage.yaml").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, ctx, operatorDevID, nsDev, "kb-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKameletWithID(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"))
@@ -148,7 +148,7 @@ func TestKamelCLIPromote(t *testing.T) {
})
t.Run("kamelet integration promotion", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, ctx, operatorProdID, nsProd, "my-own-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKameletWithID(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"))
@@ -161,7 +161,7 @@ func TestKamelCLIPromote(t *testing.T) {
})
t.Run("binding promotion", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, ctx, operatorProdID, nsProd, "kb-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKameletWithID(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"))
diff --git a/e2e/builder/registry_test.go b/e2e/advanced/registry_test.go
similarity index 99%
rename from e2e/builder/registry_test.go
rename to e2e/advanced/registry_test.go
index c8fcbb05c..717f68e83 100644
--- a/e2e/builder/registry_test.go
+++ b/e2e/advanced/registry_test.go
@@ -20,7 +20,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-package builder
+package advanced
import (
"context"
diff --git a/e2e/common/cli/bind_test.go b/e2e/common/cli/bind_test.go
index 90daf7fdb..0b736412e 100644
--- a/e2e/common/cli/bind_test.go
+++ b/e2e/common/cli/bind_test.go
@@ -36,31 +36,25 @@ import (
func TestKamelCLIBind(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
kameletName := "test-timer-source"
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, kameletName)()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, kameletName)()).To(Succeed())
t.Run("bind timer to log", func(t *testing.T) {
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns, kameletName, "log:info", "-p", "source.message=helloTest").Execute()).To(Succeed())
+ g.Expect(KamelBind(t, ctx, 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.Expect(KamelBind(t, ctx, 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, ctx, operatorID, ns, operatorNS+"/timer-source", "log:info").Execute()).NotTo(Succeed())
- })
-
t.Run("bind uris", func(t *testing.T) {
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "timer:foo", "log:bar").Execute()).To(Succeed())
+ g.Expect(KamelBind(t, ctx, 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, ctx, operatorID, ns, "timer:foo", "log:bar", "--service-account", "my-service-account").Execute()).To(Succeed())
+ g.Expect(KamelBind(t, ctx, 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, 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 e29297616..deb385709 100644
--- a/e2e/common/cli/config_test.go
+++ b/e2e/common/cli/config_test.go
@@ -48,7 +48,7 @@ func TestKamelCLIConfig(t *testing.T) {
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, ctx, "run", "--operator-id", operatorID, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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).
diff --git a/e2e/common/cli/delete_test.go b/e2e/common/cli/delete_test.go
index 2ed2aba0e..ab73a5f1f 100644
--- a/e2e/common/cli/delete_test.go
+++ b/e2e/common/cli/delete_test.go
@@ -36,7 +36,7 @@ import (
func TestKamelCLIDelete(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
t.Run("delete running integration", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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())
@@ -44,15 +44,15 @@ func TestKamelCLIDelete(t *testing.T) {
})
t.Run("delete building integration", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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())
@@ -64,8 +64,8 @@ func TestKamelCLIDelete(t *testing.T) {
})
t.Run("delete all integrations", func(t *testing.T) {
- 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.Expect(KamelRun(t, ctx, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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())
@@ -74,7 +74,5 @@ func TestKamelCLIDelete(t *testing.T) {
g.Eventually(Integration(t, ctx, ns, "java")).Should(BeNil())
g.Eventually(IntegrationPod(t, ctx, ns, "java"), TestTimeoutLong).Should(BeNil())
})
-
- 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 f4cf6ce9b..21659b539 100644
--- a/e2e/common/cli/describe_test.go
+++ b/e2e/common/cli/describe_test.go
@@ -24,7 +24,6 @@ package cli
import (
"context"
- "fmt"
"regexp"
"testing"
@@ -38,7 +37,7 @@ import (
func TestKamelCliDescribe(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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) {
@@ -70,17 +69,5 @@ func TestKamelCliDescribe(t *testing.T) {
g.Expect(kit).To(ContainSubstring("Dependencies:"))
})
- t.Run("Test kamel describe integration platform", func(t *testing.T) {
- 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 + ".*")
- g.Expect(platform).To(MatchRegexp(r.String()))
-
- r, _ = regexp.Compile("(?sm).*Runtime Version:\\s+" + defaults.DefaultRuntimeVersion + ".*")
- g.Expect(platform).To(MatchRegexp(r.String()))
- })
-
- 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 ef98b95bf..c31f0f13c 100644
--- a/e2e/common/cli/dev_mode_test.go
+++ b/e2e/common/cli/dev_mode_test.go
@@ -34,6 +34,7 @@ import (
. "github.com/apache/camel-k/v2/e2e/support"
"github.com/apache/camel-k/v2/e2e/support/util"
+ "github.com/apache/camel-k/v2/pkg/platform"
)
func TestRunDevMode(t *testing.T) {
@@ -48,7 +49,7 @@ func TestRunDevMode(t *testing.T) {
file := util.MakeTempCopy(t, "files/yaml.yaml")
name := RandomizedSuffixName("yaml")
- kamelRun := KamelRunWithContext(t, ctx, operatorID, ns, file, "--name", name, "--dev")
+ kamelRun := KamelRunWithContext(t, ctx, platform.DefaultPlatformName, ns, file, "--name", name, "--dev")
kamelRun.SetOut(pipew)
logScanner := util.NewLogScanner(ctx, piper, `integration "`+name+`" in phase Running`, "Magicstring!", "Magicjordan!")
@@ -56,7 +57,7 @@ func TestRunDevMode(t *testing.T) {
args := os.Args
defer func() { os.Args = args }()
- os.Args = []string{"kamel", "run", "-n", ns, "--operator-id", operatorID, file, "--name", name, "--dev"}
+ os.Args = []string{"kamel", "run", "-n", ns, "--operator-id", platform.DefaultPlatformName, file, "--name", name, "--dev"}
go kamelRun.Execute()
g.Eventually(logScanner.IsFound(`integration "`+name+`" in phase Running`), TestTimeoutMedium).Should(BeTrue())
@@ -76,7 +77,7 @@ func TestRunDevMode(t *testing.T) {
remoteFile := "https://raw.githubusercontent.com/apache/camel-k/b29333f0a878d5d09fb3965be8fe586d77dd95d0/e2e/common/files/yaml.yaml"
name := RandomizedSuffixName("yaml")
- kamelRun := KamelRunWithContext(t, ctx, operatorID, ns, remoteFile, "--name", name, "--dev")
+ kamelRun := KamelRunWithContext(t, ctx, platform.DefaultPlatformName, ns, remoteFile, "--name", name, "--dev")
kamelRun.SetOut(pipew)
logScanner := util.NewLogScanner(ctx, piper, "Magicstring!")
@@ -84,7 +85,7 @@ func TestRunDevMode(t *testing.T) {
args := os.Args
defer func() { os.Args = args }()
- os.Args = []string{"kamel", "run", "-n", ns, "--operator-id", operatorID, remoteFile, "--name", name, "--dev"}
+ os.Args = []string{"kamel", "run", "-n", ns, "--operator-id", platform.DefaultPlatformName, remoteFile, "--name", name, "--dev"}
go kamelRun.Execute()
@@ -94,17 +95,11 @@ func TestRunDevMode(t *testing.T) {
// This test makes sure that `kamel run --dev` runs in seconds after initial build is
// already done for the same integration.
t.Run("dev mode rebuild in seconds", func(t *testing.T) {
- /*
- * !!! NOTE !!!
- * If you find this test flaky, instead of thinking it as simply unstable, investigate
- * why it does not finish in a few seconds and remove the bottlenecks which are lagging
- * the integration startup.
- */
name := RandomizedSuffixName("yaml")
// First run (warm up)
- 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.Expect(KamelRun(t, ctx, ns, "files/yaml.yaml", "--name", name).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutShort).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())
@@ -119,7 +114,7 @@ func TestRunDevMode(t *testing.T) {
file := util.MakeTempCopy(t, "files/yaml.yaml")
- kamelRun := KamelRunWithContext(t, ctx, operatorID, ns, file, "--name", name, "--dev")
+ kamelRun := KamelRunWithContext(t, ctx, platform.DefaultPlatformName, ns, file, "--name", name, "--dev")
kamelRun.SetOut(pipew)
logScanner := util.NewLogScanner(ctx, piper, `integration "`+name+`" in phase Running`, "Magicstring!")
@@ -127,7 +122,7 @@ func TestRunDevMode(t *testing.T) {
args := os.Args
defer func() { os.Args = args }()
- os.Args = []string{"kamel", "run", "-n", ns, "--operator-id", operatorID, file, "--name", name, "--dev"}
+ os.Args = []string{"kamel", "run", "-n", ns, "--operator-id", platform.DefaultPlatformName, file, "--name", name, "--dev"}
go kamelRun.Execute()
@@ -136,7 +131,5 @@ func TestRunDevMode(t *testing.T) {
g.Eventually(logScanner.IsFound(`integration "`+name+`" in phase Running`), timeout).Should(BeTrue())
g.Eventually(logScanner.IsFound("Magicstring!"), timeout).Should(BeTrue())
})
-
- 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
deleted file mode 100644
index 4882d96aa..000000000
--- a/e2e/common/cli/duplicate_parameters_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cli
-
-import (
- "context"
- "testing"
-
- . "github.com/onsi/gomega"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- "github.com/apache/camel-k/v2/pkg/cmd"
-)
-
-func TestDuplicateParameters(t *testing.T) {
- g := NewWithT(t)
-
- ctx, cancel := context.WithCancel(TestContext())
- defer cancel()
-
- // run kamel to output the traits/configuration structure in json format to check the processed values
- // the telemetry.enabled is false inside JavaDuplicateParams.java, so we can check the output of this trait as true.
- cmdParams := []string{"kamel", "run", "files/JavaDuplicateParams.java",
- "-o", "json",
- "-t", "telemetry.enabled=true", "--trait", "pull-secret.enabled=true",
- "--property", "prop1=true", "-p", "prop2=true",
- "--force"}
- comm, _, _ := cmd.NewKamelWithModelineCommand(ctx, cmdParams)
-
- // the command is executed inside GetOutputString function
- commOutput := GetOutputString(comm)
-
- outParams :=
- `"traits":{"affinity":{"enabled":true},"camel":{"properties":["prop1 = true","prop2 = true","foo = bar"]},"pull-secret":{"enabled":true},"addons":{"telemetry":{"enabled":true}}}`
- g.Expect(commOutput).To(ContainSubstring(outParams))
-}
diff --git a/e2e/common/cli/get_test.go b/e2e/common/cli/get_test.go
index 88dbb71eb..18ec7912f 100644
--- a/e2e/common/cli/get_test.go
+++ b/e2e/common/cli/get_test.go
@@ -38,7 +38,7 @@ func TestKamelCLIGet(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
t.Run("get integration", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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
@@ -47,13 +47,11 @@ func TestKamelCLIGet(t *testing.T) {
kitNamespace := IntegrationKitNamespace(t, ctx, ns, "yaml")()
regex := fmt.Sprintf("^NAME\tPHASE\tKIT\n\\s*yaml\tRunning\t(%s/%s|%s)", kitNamespace, kitName, kitName)
g.Eventually(GetOutputString(Kamel(t, ctx, "get", "-n", ns))).Should(MatchRegexp(regex))
-
- 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, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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))
@@ -74,7 +72,5 @@ func TestKamelCLIGet(t *testing.T) {
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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/cli/log_test.go b/e2e/common/cli/log_test.go
index 38a2d34d7..f2e1aa7b3 100644
--- a/e2e/common/cli/log_test.go
+++ b/e2e/common/cli/log_test.go
@@ -36,7 +36,7 @@ import (
func TestKamelCLILog(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
t.Run("check integration log", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml", "--name", "log-yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, ctx, ns, "log-yaml")(), "\n")[0]
@@ -53,7 +53,5 @@ func TestKamelCLILog(t *testing.T) {
g.Eventually(logsCLI).Should(ContainSubstring("Monitoring pod " + podName))
g.Eventually(logsCLI).Should(ContainSubstring(lastLine))
})
-
- 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
deleted file mode 100644
index 3213ac0c0..000000000
--- a/e2e/common/cli/main_test.go
+++ /dev/null
@@ -1,65 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cli
-
-import (
- "fmt"
- "os"
- "testing"
-
- "github.com/apache/camel-k/v2/pkg/util/boolean"
-
- . "github.com/onsi/gomega"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
-)
-
-func TestMain(m *testing.M) {
- justCompile := GetEnvOrDefault("CAMEL_K_E2E_JUST_COMPILE", boolean.FalseString)
- if justCompile == "true" {
- os.Exit(m.Run())
- }
-
- g := NewGomega(func(message string, callerSkip ...int) {
- fmt.Printf("Test setup failed! - %s\n", message)
- })
-
- var t *testing.T
-
- g.Expect(TestClient(t)).ShouldNot(BeNil())
- ctx := TestContext()
-
- // Install global operator for tests in this package, all tests must use this operatorID
- 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, ctx, operatorNS))
- g.Expect(DeleteNamespace(t, ctx, operatorNS)).To(Succeed())
-
- os.Exit(exitCode)
-}
diff --git a/e2e/common/cli/run_test.go b/e2e/common/cli/run_test.go
index 57491b44e..7b4e67e67 100644
--- a/e2e/common/cli/run_test.go
+++ b/e2e/common/cli/run_test.go
@@ -44,28 +44,26 @@ func TestKamelCLIRun(t *testing.T) {
t.Run("Examples from GitHub", func(t *testing.T) {
t.Run("Java", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns,
+ g.Expect(KamelRun(t, ctx, ns,
"github:apache/camel-k-examples/generic-examples/languages/Sample.java").Execute()).To(Succeed())
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, 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, ctx, operatorID, ns,
+ g.Expect(KamelRun(t, ctx, ns,
"https://raw.githubusercontent.com/apache/camel-k-examples/main/generic-examples/languages/Sample.java").Execute()).
To(Succeed())
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, 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, ctx, operatorID, ns,
+ g.Expect(KamelRun(t, ctx, ns,
"github:apache/camel-k-examples/generic-examples/languages/Sample.java?branch=main").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, "sample"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationConditionStatus(t, ctx, ns, "sample", v1.IntegrationConditionReady), TestTimeoutShort).
@@ -80,7 +78,7 @@ func TestKamelCLIRun(t *testing.T) {
t.Run("Gist (ID)", func(t *testing.T) {
name := RandomizedSuffixName("github-gist-id")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--name", name,
+ g.Expect(KamelRun(t, ctx, ns, "--name", name,
"gist:e2c3f9a5fd0d9e79b21b04809786f17a").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).
@@ -92,7 +90,7 @@ func TestKamelCLIRun(t *testing.T) {
t.Run("Gist (URL)", func(t *testing.T) {
name := RandomizedSuffixName("github-gist-url")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--name", name,
+ g.Expect(KamelRun(t, ctx, ns, "--name", name,
"https://gist.github.com/lburgazzoli/e2c3f9a5fd0d9e79b21b04809786f17a").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).
@@ -105,21 +103,18 @@ func TestKamelCLIRun(t *testing.T) {
// Revert GITHUB TOKEN
os.Setenv("GITHUB_TOKEN", os.Getenv("GITHUB_TOKEN_TMP"))
os.Unsetenv("GITHUB_TOKEN_TMP")
-
- // Clean up
- 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, ctx, operatorID, ns, "files/run.yaml", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magic default"))
// Re-run the Integration with an updated configuration
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/run.yaml", "--name", name, "-p", "property=value").Execute()).
+ g.Expect(KamelRun(t, ctx, ns, "files/run.yaml", "--name", name, "-p", "property=value").Execute()).
To(Succeed())
// Check the Deployment has progressed successfully
@@ -134,37 +129,32 @@ func TestKamelCLIRun(t *testing.T) {
g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magic value"))
-
- // Clean up
- 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, ctx, operatorID, ns, "files/glob/run*", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, 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, ctx, operatorID, ns, "files/glob/Java*", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, 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, ctx, operatorID, ns, "files/glob/*", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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))
@@ -175,45 +165,6 @@ func TestKamelCLIRun(t *testing.T) {
g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
- // Clean up
- g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
- })
- })
-
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- t.Run("Run with http dependency", func(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, ctx, operatorID, ns, "--skip-operator-setup")).To(Succeed())
- g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
-
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "../traits/files/jvm/Classpath.java",
- "-d", sampleJar,
- ).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!"))
- })
-
- g.Eventually(DeleteIntegrations(t, ctx, ns), TestTimeoutLong).Should(Equal(0))
- })
-
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- t.Run("Run with http dependency using options", func(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, ctx, operatorID, ns, "--skip-operator-setup")).To(Succeed())
- g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
-
- 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, 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, ctx, ns), TestTimeoutLong).Should(Equal(0))
})
}
diff --git a/e2e/common/config/config_reload_test.go b/e2e/common/config/config_reload_test.go
index f829c8589..b96805318 100644
--- a/e2e/common/config/config_reload_test.go
+++ b/e2e/common/config/config_reload_test.go
@@ -24,7 +24,6 @@ package config
import (
"context"
- "fmt"
"strconv"
"testing"
@@ -38,22 +37,14 @@ import (
func TestConfigmapHotReload(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-config-hot-reload"
- 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("config-configmap-route")
var cmData = make(map[string]string)
cmData["my-configmap-key"] = "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.yaml",
+ g.Expect(KamelRun(t, ctx, ns, "./files/config-configmap-route.yaml",
"--config", "configmap:my-hot-cm",
"-t", "mount.hot-reload=true",
"--name", name).Execute()).To(Succeed())
@@ -64,27 +55,19 @@ func TestConfigmapHotReload(t *testing.T) {
cmData["my-configmap-key"] = "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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestConfigmapHotReloadDefault(t *testing.T) {
+ t.Parallel()
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-config-hot-reload-default"
- 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("config-configmap-route")
var cmData = make(map[string]string)
cmData["my-configmap-key"] = "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.yaml",
+ g.Expect(KamelRun(t, ctx, ns, "./files/config-configmap-route.yaml",
"--config", "configmap:my-hot-cm-2",
"--name", name).Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
@@ -94,27 +77,19 @@ func TestConfigmapHotReloadDefault(t *testing.T) {
cmData["my-configmap-key"] = "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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestSecretHotReload(t *testing.T) {
+ t.Parallel()
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-secret-hot-reload"
- 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("config-secret-route")
var secData = make(map[string]string)
secData["my-secret-key"] = "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.yaml",
+ g.Expect(KamelRun(t, ctx, ns, "./files/config-secret-route.yaml",
"--config", "secret:my-hot-sec",
"-t", "mount.hot-reload=true",
"--name", name).Execute()).To(Succeed())
@@ -125,31 +100,24 @@ func TestSecretHotReload(t *testing.T) {
secData["my-secret-key"] = "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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestConfigmapWithOwnerRefHotReloadDefault(t *testing.T) {
+ t.Parallel()
CheckConfigmapWithOwnerRef(t, false)
}
func TestConfigmapWithOwnerRefHotReload(t *testing.T) {
+ t.Parallel()
CheckConfigmapWithOwnerRef(t, true)
}
func CheckConfigmapWithOwnerRef(t *testing.T, hotreload bool) {
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, 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("config-configmap-route")
cmName := RandomizedSuffixName("my-hot-cm-")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-configmap-route.yaml",
+ g.Expect(KamelRun(t, ctx, ns, "./files/config-configmap-route.yaml",
"--config", "configmap:"+cmName,
"--name", name,
"-t", "mount.hot-reload="+strconv.FormatBool(hotreload)).Execute()).To(Succeed())
@@ -167,6 +135,5 @@ func CheckConfigmapWithOwnerRef(t *testing.T, hotreload bool) {
} else {
g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutLong).Should(Not(ContainSubstring("my configmap content updated")))
}
- 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 aa191b73d..d70cd702d 100644
--- a/e2e/common/config/config_test.go
+++ b/e2e/common/config/config_test.go
@@ -39,137 +39,82 @@ func TestRunConfigExamples(t *testing.T) {
t.Parallel()
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-config"
- 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))
-
- /*
- kamel run --dev -p my.message=test-property ./e2e/common/config/files/property-route.yaml
- */
-
t.Run("Simple property", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-route.yaml", "-p", "my.message=test-property").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/property-route.yaml", "-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())
})
- /*
- kamel run --dev -p file:./e2e/common/config/files/my.properties ./e2e/common/config/files/property-file-route.yaml
- */
-
t.Run("Property file", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-file-route.yaml", "--property", "file:./files/my.properties").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/property-file-route.yaml", "--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())
})
- /*
- kamel run --dev -p my.key.2=universe -p file:./e2e/common/config/files/my.properties ./e2e/common/config/files/property-file-route.yaml
- */
-
t.Run("Property precedence", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-file-route.yaml", "-p", "my.key.2=universe", "-p", "file:./files/my.properties").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/property-file-route.yaml", "-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())
})
- /*
- kubectl create configmap my-cm-test-property --from-literal=my.message="my-configmap-property-value"
-
- kamel run --dev -p configmap:my-cm-test-property ./e2e/common/config/files/property-route.yaml
- */
-
t.Run("Property from ConfigMap", func(t *testing.T) {
var cmData = make(map[string]string)
cmData["my.message"] = "my-configmap-property-value"
err := CreatePlainTextConfigmap(t, ctx, ns, "my-cm-test-property", cmData)
g.Expect(err).To(BeNil())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-route.yaml", "-p", "configmap:my-cm-test-property").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/property-route.yaml", "-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())
})
- /*
- kubectl create configmap my-cm-test-properties --from-literal=my.properties="my.message=my-configmap-property-entry"
-
- kamel run --dev -p configmap:my-cm-test-properties ./e2e/common/config/files/property-route.yaml
- */
-
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"
err := CreatePlainTextConfigmap(t, ctx, ns, "my-cm-test-properties", cmData)
g.Expect(err).To(BeNil())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-route.yaml", "-p", "configmap:my-cm-test-properties").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/property-route.yaml", "-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())
})
- /*
- kubectl create secret generic my-sec-test-property --from-literal=my.message="my-secret-property-value"
-
- kamel run --dev -p secret:my-sec-test-property ./e2e/common/config/files/property-route.yaml
- */
-
t.Run("Property from Secret", func(t *testing.T) {
var secData = make(map[string]string)
secData["my.message"] = "my-secret-property-value"
err := CreatePlainTextSecret(t, ctx, ns, "my-sec-test-property", secData)
g.Expect(err).To(BeNil())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-route.yaml", "-p", "secret:my-sec-test-property").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/property-route.yaml", "-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())
})
- /*
- kubectl create secret generic my-sec-test-properties --from-literal=my.properties="my.message=my-secret-property-entry"
-
- kamel run --dev --name property-route-secret -p secret:my-sec-test-properties ./e2e/common/config/files/property-route.yaml
- */
-
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"
err := CreatePlainTextSecret(t, ctx, ns, "my-sec-test-properties", secData)
g.Expect(err).To(BeNil())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-route.yaml", "--name", "property-route-secret", "-p", "secret:my-sec-test-properties").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/property-route.yaml", "--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"))
})
- /*
- kubectl create secret generic my-sec-inlined --from-literal=my-message="my-secret-external-value"
-
- kamel run --dev -t mount.configs=secret:my-sec-inlined ./e2e/common/config/files/property-secret-route.yaml
- */
-
t.Run("Property from Secret inlined", func(t *testing.T) {
var secData = make(map[string]string)
secData["my-message"] = "my-secret-external-value"
err := CreatePlainTextSecret(t, ctx, ns, "my-sec-inlined", secData)
g.Expect(err).To(BeNil())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/property-secret-route.yaml", "-t", "mount.configs=secret:my-sec-inlined").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/property-secret-route.yaml", "-t", "mount.configs=secret:my-sec-inlined").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"))
@@ -181,9 +126,6 @@ func TestRunConfigExamples(t *testing.T) {
g.Expect(mountTrait).ToNot(BeNil())
g.Expect(len(mountTrait)).To(Equal(1))
g.Expect(mountTrait["configs"]).ToNot(BeNil())
-
- g.Expect(Kamel(t, ctx, "delete", "property-secret-route", "-n", ns).Execute()).To(Succeed())
-
})
// Configmap
@@ -205,63 +147,37 @@ func TestRunConfigExamples(t *testing.T) {
err = CreatePlainTextConfigmap(t, ctx, ns, "my-cm-multi", cmDataMulti)
g.Expect(err).To(BeNil())
- /*
- kamel run --dev --config configmap:my-cm ./e2e/common/config/files/config-configmap-route.yaml
- */
-
t.Run("Config configmap", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-configmap-route.yaml", "--config", "configmap:my-cm").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/config-configmap-route.yaml", "--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"]))
})
- /*
- kamel run --dev --resource configmap:my-cm ./e2e/common/config/files/resource-configmap-route.yaml
- */
-
t.Run("Resource configmap", func(t *testing.T) {
// We can reuse the configmap created previously
-
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/resource-configmap-route.yaml", "--resource", "configmap:my-cm").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/resource-configmap-route.yaml", "--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"]))
})
- /*
- kamel run --dev --resource configmap:my-cm@/tmp/app ./e2e/common/config/files/resource-configmap-location-route.yaml
- */
-
t.Run("Resource configmap with destination", func(t *testing.T) {
- // We can reuse the configmap created previously
-
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/resource-configmap-location-route.yaml", "--resource", "configmap:my-cm@/tmp/app").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/resource-configmap-location-route.yaml", "--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"]))
})
- /*
- kamel run --dev --resource configmap:my-cm-multi/my-configmap-key-2@/tmp/app/test.txt ./e2e/common/config/files/resource-configmap-key-location-route.yaml
- */
-
t.Run("Resource configmap with filtered key and destination", func(t *testing.T) {
// We'll use the configmap containing 2 values filtering only 1 key
-
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/resource-configmap-key-location-route.yaml", "--resource", "configmap:my-cm-multi/my-configmap-key-2@/tmp/app/test.txt").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/resource-configmap-key-location-route.yaml", "--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"]))
})
- /*
- kubectl create configmap my-cm-properties --from-literal=my.key.1=hello --from-literal=my.key.2=world
-
- kamel run --dev --config configmap:my-cm-properties ./e2e/common/config/files/config-configmap-properties-route.yaml
- */
-
t.Run("Config configmap as property file", func(t *testing.T) {
// Store a configmap as property file
var cmDataProps = make(map[string]string)
@@ -269,7 +185,7 @@ func TestRunConfigExamples(t *testing.T) {
err = CreatePlainTextConfigmap(t, ctx, ns, "my-cm-properties", cmDataProps)
g.Expect(err).To(BeNil())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-configmap-properties-route.yaml", "--config", "configmap:my-cm-properties").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/config-configmap-properties-route.yaml", "--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"))
@@ -294,27 +210,18 @@ func TestRunConfigExamples(t *testing.T) {
err = CreatePlainTextSecret(t, ctx, ns, "my-sec-multi", secDataMulti)
g.Expect(err).To(BeNil())
- /*
- kamel run --dev --config secret:my-sec ./e2e/common/config/files/config-secret-route.yaml
- */
-
t.Run("Config secret", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-secret-route.yaml", "--config", "secret:my-sec").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/config-secret-route.yaml", "--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"]))
})
- /*
- kamel run --dev --resource secret:my-sec ./e2e/common/config/files/resource-secret-route.yaml
- */
-
t.Run("Resource secret", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/resource-secret-route.yaml", "--resource", "secret:my-sec").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/resource-secret-route.yaml", "--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())
})
/*
@@ -322,144 +229,95 @@ func TestRunConfigExamples(t *testing.T) {
*/
t.Run("Secret with filtered key", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/config-secret-key-route.yaml", "--config", "secret:my-sec-multi/my-secret-key-2").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/config-secret-key-route.yaml", "--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
- /*
- kamel run --dev --build-property quarkus.application.name=my-super-application ./e2e/common/config/files/build-property-route.yaml
- */
-
t.Run("Build time property", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-route.yaml", "--build-property", "quarkus.application.name=my-super-application").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/build-property-route.yaml", "--build-property", "quarkus.application.name=my-super-application").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, "build-property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
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
})
- /*
- kamel run --dev --name build-property-route-updated --build-property quarkus.application.name=my-super-application-updated ./e2e/common/config/files/build-property-route.yaml
- */
-
// We need to check also that the property (which is available in the IntegrationKit) is correctly replaced and that we don't reuse the same kit
t.Run("Build time property updated", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-route.yaml", "--name", "build-property-route-updated", "--build-property", "quarkus.application.name=my-super-application-updated").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/build-property-route.yaml", "--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, 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())
})
- /*
- kamel run --dev --build-property file:./e2e/common/config/files/quarkus.properties ./e2e/common/config/files/build-property-file-route.yaml
- */
-
// Build-Properties file
t.Run("Build time property file", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-file-route.yaml", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/build-property-file-route.yaml", "--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())
})
- /*
- kamel run --dev --name build-property-file-route-precedence --build-property quarkus.application.name=my-overridden-application --build-property file:./e2e/common/config/files/quarkus.properties ./e2e/common/config/files/build-property-file-route.yaml
- */
-
t.Run("Build time property file with precedence", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-file-route.yaml", "--name", "build-property-file-route-precedence", "--build-property", "quarkus.application.name=my-overridden-application", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/build-property-file-route.yaml", "--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())
})
- /*
- kubectl create configmap my-cm-test-build-property --from-literal=quarkus.application.name="my-cool-application"
-
- kamel run --dev --build-property configmap:my-cm-test-build-property ./e2e/common/config/files/build-property-file-route.yaml
- */
-
t.Run("Build time property from ConfigMap", func(t *testing.T) {
var cmData = make(map[string]string)
cmData["quarkus.application.name"] = "my-cool-application"
err = CreatePlainTextConfigmap(t, ctx, ns, "my-cm-test-build-property", cmData)
g.Expect(err).To(BeNil())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-file-route.yaml", "--build-property", "configmap:my-cm-test-build-property").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/build-property-file-route.yaml", "--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())
})
- /*
- kubectl create configmap my-cm-test-build-properties --from-literal=my.properties="quarkus.application.name=my-super-cool-application"
-
- kamel run --dev --name build-property-file-route-cm --build-property configmap:my-cm-test-build-properties ./e2e/common/config/files/build-property-file-route.yaml
- */
-
t.Run("Build time property from ConfigMap as property file", func(t *testing.T) {
var cmData = make(map[string]string)
cmData["my.properties"] = "quarkus.application.name=my-super-cool-application"
err = CreatePlainTextConfigmap(t, ctx, ns, "my-cm-test-build-properties", cmData)
g.Expect(err).To(BeNil())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-file-route.yaml", "--name", "build-property-file-route-cm", "--build-property", "configmap:my-cm-test-build-properties").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/build-property-file-route.yaml", "--name", "build-property-file-route-cm", "--build-property", "configmap:my-cm-test-build-properties").Execute()).To(Succeed())
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())
})
- /*
- kubectl create secret generic my-sec-test-build-property --from-literal=quarkus.application.name="my-great-application"
-
- kamel run --dev --build-property secret:my-sec-test-build-property ./e2e/common/config/files/build-property-file-route.yaml
- */
-
t.Run("Build time property from Secret", func(t *testing.T) {
var secData = make(map[string]string)
secData["quarkus.application.name"] = "my-great-application"
err = CreatePlainTextSecret(t, ctx, ns, "my-sec-test-build-property", secData)
g.Expect(err).To(BeNil())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-file-route.yaml", "--build-property", "secret:my-sec-test-build-property").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/build-property-file-route.yaml", "--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())
})
- /*
- kubectl create secret generic my-sec-test-build-properties --from-literal=my.properties="quarkus.application.name=my-awesome-application"
-
- kamel run --dev --name build-property-file-route-secret --build-property secret:my-sec-test-build-properties ./e2e/common/config/files/build-property-file-route.yaml
- */
-
t.Run("Build time property from Secret as property file", func(t *testing.T) {
var secData = make(map[string]string)
secData["my.properties"] = "quarkus.application.name=my-awesome-application"
err = CreatePlainTextSecret(t, ctx, ns, "my-sec-test-build-properties", secData)
g.Expect(err).To(BeNil())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "./files/build-property-file-route.yaml", "--name", "build-property-file-route-secret", "--build-property", "secret:my-sec-test-build-properties").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "./files/build-property-file-route.yaml", "--name", "build-property-file-route-secret", "--build-property", "secret:my-sec-test-build-properties").Execute()).To(Succeed())
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-awesome-application"))
- g.Expect(Kamel(t, ctx, "delete", "build-property-file-route-secret", "-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 8dcc0c2c1..7600845ab 100644
--- a/e2e/common/config/kamelet_config_test.go
+++ b/e2e/common/config/kamelet_config_test.go
@@ -30,43 +30,27 @@ import (
corev1 "k8s.io/api/core/v1"
. "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
)
// Tests on integrations with kamelets containing configuration from properties and secrets
-//
-// without having to change the integration code.
+// without having to change the integration code.
func TestKameletImplicitConfigDefaultUserProperty(t *testing.T) {
t.Parallel()
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-config-kamelet-user-property"
- 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))
-
t.Run("run test default config using properties", func(t *testing.T) {
-
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "iconfig01-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "iconfig01-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int01")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegrationConfiguration01.java",
+ g.Expect(KamelRun(t, ctx, ns, "files/TimerKameletIntegrationConfiguration01.java",
"-p", "camel.kamelet.iconfig01-timer-source.message='Default message 01'",
"--name", name).Execute()).To(Succeed())
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, 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, 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, ctx, operatorID, ns, "iconfig03-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "iconfig03-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int3")
secretName := "my-iconfig-int3-secret"
@@ -76,23 +60,15 @@ func TestKameletImplicitConfigDefaultUserProperty(t *testing.T) {
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, ctx, operatorID, ns, "files/TimerKameletIntegrationConfiguration03.java",
+ g.Expect(KamelRun(t, ctx, ns, "files/TimerKameletIntegrationConfiguration03.java",
"-t", "mount.configs=secret:"+secretName,
"--name", name).Execute()).To(Succeed())
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, 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, 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, ctx, operatorID, ns, "iconfig04-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "iconfig04-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int4")
cmName := "my-iconfig-int4-configmap"
@@ -101,40 +77,27 @@ func TestKameletImplicitConfigDefaultUserProperty(t *testing.T) {
cmData["camel.kamelet.iconfig04-timer-source.message"] = "very top mounted configmap message"
g.Expect(CreatePlainTextConfigmap(t, ctx, ns, cmName, cmData)).To(Succeed())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegrationConfiguration04.java",
+ g.Expect(KamelRun(t, ctx, ns, "files/TimerKameletIntegrationConfiguration04.java",
"-t", "mount.configs=configmap:"+cmName,
"--name", name).Execute()).To(Succeed())
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, 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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test named config using properties", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "iconfig05-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "iconfig05-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int5")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration05.java",
+ g.Expect(KamelRun(t, ctx, 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, 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, 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, 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, ctx, operatorID, ns, "iconfig06-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "iconfig06-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int6")
secretName := "my-iconfig-int6-secret"
@@ -147,23 +110,15 @@ func TestKameletImplicitConfigDefaultUserProperty(t *testing.T) {
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, ctx, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration06.java",
+ g.Expect(KamelRun(t, ctx, ns, "files/TimerKameletIntegrationNamedConfiguration06.java",
"-p", "camel.kamelet.iconfig06-timer-source.message='Default message 06'",
"--name", name).Execute()).To(Succeed())
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, 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, 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, ctx, operatorID, ns, "iconfig07-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "iconfig07-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int7")
secretName := "my-iconfig-int7-secret"
@@ -173,24 +128,16 @@ func TestKameletImplicitConfigDefaultUserProperty(t *testing.T) {
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, ctx, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration07.java",
+ g.Expect(KamelRun(t, ctx, 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, 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, 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, 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, ctx, operatorID, ns, "iconfig08-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "iconfig08-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int8")
cmName := "my-iconfig-int8-configmap"
@@ -199,23 +146,16 @@ func TestKameletImplicitConfigDefaultUserProperty(t *testing.T) {
cmData["camel.kamelet.iconfig08-timer-source.mynamedconfig.message"] = "very top named mounted configmap message"
g.Expect(CreatePlainTextConfigmap(t, ctx, ns, cmName, cmData)).To(Succeed())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/TimerKameletIntegrationNamedConfiguration08.java",
+ g.Expect(KamelRun(t, ctx, 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, 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, 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, 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, ctx, operatorID, ns, "iconfig09-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "iconfig09-timer-source")()).To(Succeed())
name := RandomizedSuffixName("iconfig-test-timer-source-int9")
secretName := "my-iconfig-int9-secret"
@@ -227,67 +167,43 @@ func TestKameletImplicitConfigDefaultUserProperty(t *testing.T) {
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, ctx, operatorID, ns, "files/TimerKameletIntegrationConfiguration09.java",
+ g.Expect(KamelRun(t, ctx, ns, "files/TimerKameletIntegrationConfiguration09.java",
"--name", name).Execute()).To(Succeed())
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, 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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test default config inlined properties", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "config01-timer-source")()).To(Succeed())
- g.Expect(CreateLogKamelet(t, ctx, operatorID, ns, "config01-log-sink")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "config01-timer-source")()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, ns, "config01-log-sink")()).To(Succeed())
name := RandomizedSuffixName("config-test-timer-source-int1")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-kamelet-integration-inlined-configuration-01.yaml",
+ g.Expect(KamelRun(t, ctx, ns, "files/timer-kamelet-integration-inlined-configuration-01.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)).Should(ContainSubstring("important message"))
g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("integrationLogger"))
-
- 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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test default config parameters properties", func(t *testing.T) {
-
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "config02-timer-source")()).To(Succeed())
- g.Expect(CreateLogKamelet(t, ctx, operatorID, ns, "config02-log-sink")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "config02-timer-source")()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, ns, "config02-log-sink")()).To(Succeed())
name := RandomizedSuffixName("config-test-timer-source-int2")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-kamelet-integration-parameters-configuration-02.yaml",
+ g.Expect(KamelRun(t, ctx, 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, 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, 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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test default config secret properties", func(t *testing.T) {
-
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "config03-timer-source")()).To(Succeed())
- g.Expect(CreateLogKamelet(t, ctx, operatorID, ns, "config03-log-sink")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "config03-timer-source")()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, ns, "config03-log-sink")()).To(Succeed())
name := RandomizedSuffixName("config-test-timer-source-int3")
secretName := "my-config-int3-secret"
@@ -297,26 +213,17 @@ func TestKameletImplicitConfigDefaultUserProperty(t *testing.T) {
secData["my-logger"] = "mySecretIntegrationLogger03"
g.Expect(CreatePlainTextSecret(t, ctx, ns, secretName, secData)).To(Succeed())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-kamelet-integration-parameters-configuration-03.yaml",
+ g.Expect(KamelRun(t, ctx, ns, "files/timer-kamelet-integration-parameters-configuration-03.yaml",
"-t", "mount.configs=secret:"+secretName,
"--name", name).Execute()).To(Succeed())
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, 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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run test default config configmap properties", func(t *testing.T) {
-
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "config04-timer-source")()).To(Succeed())
- g.Expect(CreateLogKamelet(t, ctx, operatorID, ns, "config04-log-sink")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "config04-timer-source")()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, ns, "config04-log-sink")()).To(Succeed())
name := RandomizedSuffixName("config-test-timer-source-int4")
cmName := "my-config-int4-configmap"
@@ -326,20 +233,12 @@ func TestKameletImplicitConfigDefaultUserProperty(t *testing.T) {
cmData["my-logger"] = "myConfigmapIntegrationLogger04"
g.Expect(CreatePlainTextConfigmap(t, ctx, ns, cmName, cmData)).To(Succeed())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-kamelet-integration-parameters-configuration-04.yaml",
+ g.Expect(KamelRun(t, ctx, ns, "files/timer-kamelet-integration-parameters-configuration-04.yaml",
"-t", "mount.configs=configmap:"+cmName,
"--name", name).Execute()).To(Succeed())
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, 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, 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 3c3acc438..1011678f6 100644
--- a/e2e/common/config/pipe_config_test.go
+++ b/e2e/common/config/pipe_config_test.go
@@ -30,28 +30,19 @@ import (
corev1 "k8s.io/api/core/v1"
. "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
)
// Tests on pipe with kamelets containing configuration from properties and secrets.
func TestPipeConfig(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-pipe-config"
- 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))
-
t.Run("test custom source/sink pipe", func(t *testing.T) {
- 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())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "my-pipe-timer-source")()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, 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, ctx, operatorID, ns,
+ g.Expect(KamelBind(t, ctx, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-p", "source.message=My pipe message",
@@ -61,8 +52,6 @@ func TestPipeConfig(t *testing.T) {
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, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
})
t.Run("run test implicit default config using labeled secret", func(t *testing.T) {
@@ -75,7 +64,7 @@ func TestPipeConfig(t *testing.T) {
labels["camel.apache.org/kamelet"] = "my-pipe-timer-source"
g.Expect(CreatePlainTextSecretWithLabels(t, ctx, ns, secretName, secData, labels)).To(Succeed())
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
+ g.Expect(KamelBind(t, ctx, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-p", "sink.loggerName=myDefaultLogger",
@@ -85,7 +74,6 @@ func TestPipeConfig(t *testing.T) {
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, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
g.Expect(DeleteSecret(t, ctx, ns, secretName)).To(Succeed())
})
@@ -98,7 +86,7 @@ func TestPipeConfig(t *testing.T) {
secData["camel.kamelet.my-pipe-log-sink.loggerName"] = "myPipeSecretLogger"
g.Expect(CreatePlainTextSecret(t, ctx, ns, secretName, secData)).To(Succeed())
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
+ g.Expect(KamelBind(t, ctx, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-t", "mount.configs=secret:"+secretName,
@@ -108,7 +96,6 @@ func TestPipeConfig(t *testing.T) {
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, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
g.Expect(DeleteSecret(t, ctx, ns, secretName)).To(Succeed())
})
@@ -121,7 +108,7 @@ func TestPipeConfig(t *testing.T) {
cmData["camel.kamelet.my-pipe-log-sink.loggerName"] = "myPipeConfigmapLogger"
g.Expect(CreatePlainTextConfigmap(t, ctx, ns, cmName, cmData)).To(Succeed())
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
+ g.Expect(KamelBind(t, ctx, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-t", "mount.configs=configmap:"+cmName,
@@ -131,7 +118,6 @@ func TestPipeConfig(t *testing.T) {
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, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
g.Expect(DeleteConfigmap(t, ctx, ns, cmName)).To(Succeed())
})
@@ -144,7 +130,7 @@ func TestPipeConfig(t *testing.T) {
secData["camel.kamelet.my-pipe-log-sink.mynamedconfig.loggerName"] = "myPipeNamedSecretLogger"
g.Expect(CreatePlainTextSecret(t, ctx, ns, secretName, secData)).To(Succeed())
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
+ g.Expect(KamelBind(t, ctx, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-t", "mount.configs=secret:"+secretName,
@@ -157,7 +143,6 @@ func TestPipeConfig(t *testing.T) {
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, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
g.Expect(DeleteSecret(t, ctx, ns, secretName)).To(Succeed())
})
@@ -170,7 +155,7 @@ func TestPipeConfig(t *testing.T) {
cmData["camel.kamelet.my-pipe-log-sink.mynamedconfig.loggerName"] = "myPipeNamedConfigmapLogger"
g.Expect(CreatePlainTextConfigmap(t, ctx, ns, cmName, cmData)).To(Succeed())
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
+ g.Expect(KamelBind(t, ctx, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-t", "mount.configs=configmap:"+cmName,
@@ -183,7 +168,6 @@ func TestPipeConfig(t *testing.T) {
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, 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) {
@@ -195,7 +179,7 @@ func TestPipeConfig(t *testing.T) {
secData["mynamedconfig.loggerName"] = "myPipeSpecificSecretLogger"
g.Expect(CreatePlainTextSecret(t, ctx, ns, secretName, secData)).To(Succeed())
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
+ g.Expect(KamelBind(t, ctx, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-t", "mount.configs=secret:"+secretName,
@@ -208,7 +192,6 @@ func TestPipeConfig(t *testing.T) {
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, 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) {
@@ -220,7 +203,7 @@ func TestPipeConfig(t *testing.T) {
cmData["mynamedconfig.loggerName"] = "myPipeSpecificConfgmapLogger"
g.Expect(CreatePlainTextConfigmap(t, ctx, ns, cmName, cmData)).To(Succeed())
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns,
+ g.Expect(KamelBind(t, ctx, ns,
"my-pipe-timer-source",
"my-pipe-log-sink",
"-t", "mount.configs=configmap:"+cmName,
@@ -233,11 +216,8 @@ func TestPipeConfig(t *testing.T) {
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, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
g.Expect(DeleteConfigmap(t, ctx, ns, cmName)).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 424f1d02e..7d60628f3 100644
--- a/e2e/common/languages/groovy_test.go
+++ b/e2e/common/languages/groovy_test.go
@@ -36,22 +36,12 @@ import (
func TestRunSimpleGroovyExamples(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-runtimes-groovy"
- 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))
-
t.Run("run groovy", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/groovy.groovy").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, 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 7a94420f4..a3d21ac4c 100644
--- a/e2e/common/languages/java_test.go
+++ b/e2e/common/languages/java_test.go
@@ -36,22 +36,12 @@ import (
func TestRunSimpleJavaExamples(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-runtimes-java"
- 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))
-
t.Run("run java", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, 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 a07d3dbe9..cdf333be3 100644
--- a/e2e/common/languages/js_test.go
+++ b/e2e/common/languages/js_test.go
@@ -36,22 +36,12 @@ import (
func TestRunSimpleJavaScriptExamples(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-runtimes-js"
- 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))
-
t.Run("run js", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/js.js").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, 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 c0cac7493..f1a4fd168 100644
--- a/e2e/common/languages/kotlin_test.go
+++ b/e2e/common/languages/kotlin_test.go
@@ -36,22 +36,12 @@ import (
func TestRunSimpleKotlinExamples(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-runtimes-kotlin"
- 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))
-
t.Run("run kotlin", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/kotlin.kts").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, 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 457ded99f..8092e3dda 100644
--- a/e2e/common/languages/polyglot_test.go
+++ b/e2e/common/languages/polyglot_test.go
@@ -36,23 +36,13 @@ import (
func TestRunPolyglotExamples(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-runtimes-polyglot"
- 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))
-
t.Run("run polyglot", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--name", "polyglot", "files/js-polyglot.js", "files/yaml-polyglot.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, 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 90c3ccde0..23a8a7eb8 100644
--- a/e2e/common/languages/xml_test.go
+++ b/e2e/common/languages/xml_test.go
@@ -36,22 +36,12 @@ import (
func TestRunSimpleXmlExamples(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-runtimes-xml"
- 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))
-
t.Run("run xml", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/xml.xml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, 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 6eb6b4482..0eb028dcb 100644
--- a/e2e/common/languages/yaml_test.go
+++ b/e2e/common/languages/yaml_test.go
@@ -36,22 +36,12 @@ import (
func TestRunSimpleYamlExamples(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-runtimes-yaml"
- 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))
-
t.Run("run yaml", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/main_test.go b/e2e/common/main_test.go
deleted file mode 100644
index e67575c32..000000000
--- a/e2e/common/main_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package common
-
-import (
- "fmt"
- "os"
- "testing"
-
- . "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
- "github.com/apache/camel-k/v2/pkg/platform"
- "github.com/apache/camel-k/v2/pkg/util/boolean"
-)
-
-func TestMain(m *testing.M) {
- justCompile := GetEnvOrDefault("CAMEL_K_E2E_JUST_COMPILE", boolean.FalseString)
- if justCompile == boolean.TrueString {
- os.Exit(m.Run())
- }
-
- fastSetup := GetEnvOrDefault("CAMEL_K_E2E_FAST_SETUP", boolean.FalseString)
- if fastSetup == "true" {
- operatorID := platform.DefaultPlatformName
- ns := GetEnvOrDefault("CAMEL_K_GLOBAL_OPERATOR_NS", TestDefaultNamespace)
-
- g := NewGomega(func(message string, callerSkip ...int) {
- fmt.Printf("Test setup failed! - %s\n", message)
- })
-
- var t *testing.T
-
- g.Expect(TestClient(t)).ShouldNot(BeNil())
- ctx := TestContext()
- 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, 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 54dbbd99d..eba58aad4 100644
--- a/e2e/common/misc/client_test.go
+++ b/e2e/common/misc/client_test.go
@@ -41,7 +41,6 @@ import (
func TestClientFunctionalities(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
cfg, err := config.GetConfig()
require.NoError(t, err)
@@ -66,7 +65,5 @@ func TestClientFunctionalities(t *testing.T) {
err = camel.CamelV1().Integrations(ns).Delete(ctx, "dummy", metav1.DeleteOptions{})
require.NoError(t, err)
-
- 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 5337988a4..2496dc144 100644
--- a/e2e/common/misc/cron_test.go
+++ b/e2e/common/misc/cron_test.go
@@ -40,43 +40,36 @@ func TestRunCronExample(t *testing.T) {
t.Parallel()
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-cron"
- 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))
-
t.Run("cron-yaml", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/cron-yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, ctx, operatorID, ns, "files/cron-timer.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, ctx, operatorID, ns, "files/cron-fallback.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, ctx, operatorID, ns, "files/cron-quartz.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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!"))
})
t.Run("cron-trait-yaml", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/cron-trait-yaml.yaml", "-t", "cron.enabled=true", "-t", "cron.schedule=0/2 * * * *").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/cron-trait-yaml.yaml", "-t", "cron.enabled=true", "-t", "cron.schedule=0/2 * * * *").Execute()).To(Succeed())
g.Eventually(IntegrationConditionStatus(t, ctx, ns, "cron-trait-yaml", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
g.Eventually(IntegrationCronJob(t, ctx, ns, "cron-trait-yaml"), TestTimeoutLong).ShouldNot(BeNil())
@@ -89,7 +82,5 @@ func TestRunCronExample(t *testing.T) {
cronJob := IntegrationCronJob(t, ctx, ns, "cron-trait-yaml")()
assert.Equal(t, "0/2 * * * *", cronJob.Spec.Schedule)
})
-
- 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 415f2eb0c..23132ade6 100644
--- a/e2e/common/misc/integration_fail_test.go
+++ b/e2e/common/misc/integration_fail_test.go
@@ -37,18 +37,10 @@ import (
func TestBadRouteIntegration(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-bad-route"
- 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))
-
t.Run("run bad java route", func(t *testing.T) {
name := RandomizedSuffixName("bad-route")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/BadRoute.java", "--name", name, "-t", "health.enabled=false").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/BadRoute.java", "--name", name, "-t", "health.enabled=false").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).
@@ -72,7 +64,7 @@ func TestBadRouteIntegration(t *testing.T) {
t.Run("run missing dependency java route", func(t *testing.T) {
name := RandomizedSuffixName("java-route")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name,
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name,
"-d", "mvn:com.example:nonexistent:1.0", "-t", "health.enabled=false").Execute()).To(Succeed())
// Integration in error
g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseError))
@@ -90,7 +82,7 @@ func TestBadRouteIntegration(t *testing.T) {
g.Eventually(BuildFailureRecoveryAttempt(t, ctx, integrationKitNamespace, kitName), TestTimeoutShort).Should(Equal(5))
// Fixing the route should reconcile the Integration
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, ctx, ns, name)()
@@ -104,7 +96,7 @@ func TestBadRouteIntegration(t *testing.T) {
t.Run("run invalid dependency java route", func(t *testing.T) {
name := RandomizedSuffixName("invalid-dependency")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-d", "camel:non-existent", "-t", "health.enabled=false").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name, "-d", "camel:non-existent", "-t", "health.enabled=false").Execute()).To(Succeed())
// Integration in error with Initialization Failed condition
g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(v1.IntegrationPhaseError))
g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
@@ -117,7 +109,7 @@ func TestBadRouteIntegration(t *testing.T) {
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, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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))
@@ -132,7 +124,7 @@ func TestBadRouteIntegration(t *testing.T) {
t.Run("run unresolvable component java route", func(t *testing.T) {
name := RandomizedSuffixName("unresolvable-route")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Unresolvable.java", "--name", name, "-t", "health.enabled=false").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Unresolvable.java", "--name", name, "-t", "health.enabled=false").Execute()).To(Succeed())
// Integration in error with Initialization Failed condition
g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
@@ -145,7 +137,7 @@ func TestBadRouteIntegration(t *testing.T) {
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, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "health.enabled=false").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name, "-t", "health.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))
@@ -161,7 +153,7 @@ func TestBadRouteIntegration(t *testing.T) {
t.Run("run invalid java route", func(t *testing.T) {
name := RandomizedSuffixName("invalid-java-route")
// Skip the health check so we can quickly read from log
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/InvalidJava.java", "--name", name, "-t", "health.enabled=false").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/InvalidJava.java", "--name", name, "-t", "health.enabled=false").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).
@@ -174,7 +166,7 @@ func TestBadRouteIntegration(t *testing.T) {
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, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "health.enabled=false").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name, "-t", "health.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))
@@ -185,7 +177,5 @@ func TestBadRouteIntegration(t *testing.T) {
g.Expect(kitRecoveryName).To(Equal(kitName))
})
-
- 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 839c51e58..1a83a5e22 100644
--- a/e2e/common/misc/integration_trait_update_test.go
+++ b/e2e/common/misc/integration_trait_update_test.go
@@ -36,28 +36,18 @@ import (
func TestTraitUpdates(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-trait-update"
- 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))
-
t.Run("run and update trait", func(t *testing.T) {
name := RandomizedSuffixName("yaml-route")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, ctx, operatorID, ns, "files/yaml.yaml", "--name", name, "-p", "hello=world").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, 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 f9b58f279..95c055e17 100644
--- a/e2e/common/misc/kamelet_test.go
+++ b/e2e/common/misc/kamelet_test.go
@@ -31,20 +31,11 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
. "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
)
func TestKameletClasspathLoading(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-kamelet-loading"
- 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))
-
// Store a configmap on the cluster
var cmData = make(map[string]string)
cmData["my-timer-source.kamelet.yaml"] = `
@@ -122,7 +113,7 @@ spec:
// Basic
t.Run("test basic case", func(t *testing.T) {
- 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.Expect(KamelRun(t, ctx, 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"))
@@ -134,7 +125,5 @@ spec:
g.Expect(len(kameletsTrait)).To(Equal(1))
g.Expect(kameletsTrait["enabled"]).To(Equal(false))
})
-
- 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 2be7c7e82..2af100a2b 100644
--- a/e2e/common/misc/kamelet_update_test.go
+++ b/e2e/common/misc/kamelet_update_test.go
@@ -37,28 +37,18 @@ const customLabel = "custom-label"
func TestBundleKameletUpdate(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-kamelet-bundle"
- 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(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.Expect(createBundleKamelet(t, ctx, ns, "my-http-sink")()).To(Succeed()) // Going to be replaced
+ g.Expect(createUserKamelet(t, ctx, ns, "user-sink")()).To(Succeed()) // Left intact by the operator
g.Eventually(Kamelet(t, ctx, "my-http-sink", ns)).
Should(WithTransform(KameletLabels, HaveKeyWithValue(customLabel, "true")))
g.Consistently(Kamelet(t, ctx, "user-sink", ns), 5*time.Second, 1*time.Second).
Should(WithTransform(KameletLabels, HaveKeyWithValue(customLabel, "true")))
-
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
-func createBundleKamelet(t *testing.T, ctx context.Context, operatorID string, ns string, name string) func() error {
+func createBundleKamelet(t *testing.T, ctx context.Context, ns string, name string) func() error {
flow := map[string]interface{}{
"from": map[string]interface{}{
"uri": "kamelet:source",
@@ -69,10 +59,10 @@ func createBundleKamelet(t *testing.T, ctx context.Context, operatorID string, n
customLabel: "true",
v1.KameletBundledLabel: "true",
}
- return CreateKamelet(t, operatorID, ctx, ns, name, flow, nil, labels)
+ return CreateKamelet(t, ctx, ns, name, flow, nil, labels)
}
-func createUserKamelet(t *testing.T, ctx context.Context, operatorID string, ns string, name string) func() error {
+func createUserKamelet(t *testing.T, ctx context.Context, ns string, name string) func() error {
flow := map[string]interface{}{
"from": map[string]interface{}{
"uri": "kamelet:source",
@@ -82,5 +72,5 @@ func createUserKamelet(t *testing.T, ctx context.Context, operatorID string, ns
labels := map[string]string{
customLabel: "true",
}
- return CreateKamelet(t, operatorID, ctx, ns, name, flow, nil, labels)
+ return CreateKamelet(t, 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 3be75182e..c20acbc78 100644
--- a/e2e/common/misc/maven_repository_test.go
+++ b/e2e/common/misc/maven_repository_test.go
@@ -36,17 +36,9 @@ import (
func TestRunExtraRepository(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-extra-repository"
- 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, 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.Expect(KamelRun(t, ctx, 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, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
@@ -55,7 +47,5 @@ func TestRunExtraRepository(t *testing.T) {
HaveExistingField("Repositories"),
HaveField("Repositories", ContainElements("https://maven.repository.redhat.com/ga@id=redhat")),
)))
-
- 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 1b8dd4161..a955e841e 100644
--- a/e2e/common/misc/pipe_test.go
+++ b/e2e/common/misc/pipe_test.go
@@ -27,32 +27,28 @@ import (
"testing"
. "github.com/onsi/gomega"
+ "github.com/onsi/gomega/gstruct"
corev1 "k8s.io/api/core/v1"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/types"
. "github.com/apache/camel-k/v2/e2e/support"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
+ "github.com/apache/camel-k/v2/pkg/client/camel/clientset/versioned"
"github.com/apache/camel-k/v2/pkg/util/kubernetes"
)
func TestPipe(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-pipe"
- 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))
-
// Error Handler testing
t.Run("test error handler", func(t *testing.T) {
- 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())
+ g.Expect(createErrorProducerKamelet(t, ctx, ns, "my-own-error-producer-source")()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, ns, "my-own-log-sink")()).To(Succeed())
t.Run("throw error test", func(t *testing.T) {
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "my-own-error-producer-source", "my-own-log-sink",
+ g.Expect(KamelBind(t, ctx, 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",
@@ -68,7 +64,7 @@ func TestPipe(t *testing.T) {
})
t.Run("don't throw error test", func(t *testing.T) {
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "my-own-error-producer-source", "my-own-log-sink",
+ g.Expect(KamelBind(t, ctx, 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",
@@ -86,10 +82,10 @@ func TestPipe(t *testing.T) {
//Pipe with traits testing
t.Run("test Pipe with trait", func(t *testing.T) {
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, "my-own-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, "my-own-timer-source")()).To(Succeed())
// Log sink kamelet exists from previous test
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "my-own-timer-source", "my-own-log-sink",
+ g.Expect(KamelBind(t, ctx, ns, "my-own-timer-source", "my-own-log-sink",
"-p", "source.message=hello from test",
"-p", "sink.loggerName=integrationLogger",
"--trait", "camel.properties=[\"camel.prop1=a\",\"camel.prop2=b\"]",
@@ -113,11 +109,140 @@ func TestPipe(t *testing.T) {
WithTransform(PipeConditionMessage, ContainSubstring("no ref or URI specified in endpoint")))
})
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
-func createErrorProducerKamelet(t *testing.T, ctx context.Context, operatorID string, ns string, name string) func() error {
+func TestPipeWithImage(t *testing.T) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ bindingID := "with-image-binding"
+
+ t.Run("run with initial image", func(t *testing.T) {
+ expectedImage := "quay.io/fuse_qe/echo-server:0.3.2"
+
+ g.Expect(KamelBind(t, ctx, ns, "my-own-timer-source", "my-own-log-sink",
+ "--trait", "container.image="+expectedImage, "--trait", "jvm.enabled=false",
+ "--trait", "kamelets.enabled=false", "--trait", "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, ctx, ns, bindingID)).Should(WithTransform(Annotations,
+ HaveKeyWithValue("test", "1"),
+ ))
+ g.Eventually(IntegrationStatusImage(t, ctx, ns, bindingID)).
+ Should(Equal(expectedImage))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, bindingID), TestTimeoutShort).
+ Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPodImage(t, ctx, ns, bindingID)).
+ Should(Equal(expectedImage))
+ })
+
+ t.Run("run with new image", func(t *testing.T) {
+ expectedImage := "quay.io/fuse_qe/echo-server:0.3.3"
+
+ g.Expect(KamelBind(t, ctx, ns, "my-own-timer-source", "my-own-log-sink",
+ "--trait", "container.image="+expectedImage, "--trait", "jvm.enabled=false",
+ "--trait", "kamelets.enabled=false", "--trait", "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, ctx, ns, bindingID)).Should(WithTransform(Annotations,
+ HaveKeyWithValue("test", "2"),
+ ))
+ g.Eventually(IntegrationStatusImage(t, ctx, ns, bindingID)).
+ Should(Equal(expectedImage))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, bindingID), TestTimeoutShort).
+ Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationPodImage(t, ctx, ns, bindingID)).
+ Should(Equal(expectedImage))
+ })
+ })
+}
+
+func TestPipeScale(t *testing.T) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ name := RandomizedSuffixName("timer2log")
+ g.Expect(KamelBind(t, ctx, 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, ctx, ns, name, 3)).To(Succeed())
+ // Check the scale cascades into the Deployment scale
+ 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, ctx, ns, name), TestTimeoutShort).
+ Should(gstruct.PointTo(BeNumerically("==", 3)))
+ // Check it also cascades into the Pipe scale subresource Status field
+ g.Eventually(PipeStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
+ Should(gstruct.PointTo(BeNumerically("==", 3)))
+ // Check the readiness condition becomes truthy back
+ 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, ctx, ns, name, v1.PipeConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ })
+
+ t.Run("ScalePipe with polymorphic client", func(t *testing.T) {
+ scaleClient, err := TestClient(t).ScalesClient()
+ g.Expect(err).To(BeNil())
+
+ // Patch the integration scale subresource
+ patch := "{\"spec\":{\"replicas\":2}}"
+ _, 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, ctx, ns, name, v1.PipeConditionReady)()).To(Equal(corev1.ConditionTrue))
+ // Check the Integration scale subresource Spec field
+ 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, ctx, ns, name), TestTimeoutShort).Should(HaveLen(2))
+ // Check it cascades into the Integration scale subresource Status field
+ 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, ctx, ns, name), TestTimeoutShort).
+ Should(gstruct.PointTo(BeNumerically("==", 2)))
+ })
+
+ t.Run("ScalePipe with Camel K client", func(t *testing.T) {
+ camel, err := versioned.NewForConfig(TestClient(t).GetConfig())
+ g.Expect(err).To(BeNil())
+
+ // Getter
+ 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(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, ctx, ns, name, v1.PipeConditionReady)()).To(Equal(corev1.ConditionTrue))
+ // Check the Pipe scale subresource Spec field
+ 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, ctx, ns, name, v1.IntegrationConditionReady)()).To(Equal(corev1.ConditionTrue))
+ // Check the Integration scale subresource Spec field
+ 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, ctx, ns, name), TestTimeoutShort).Should(HaveLen(1))
+ // Finally check it cascades into the Integration scale subresource Status field
+ g.Eventually(IntegrationStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
+ Should(gstruct.PointTo(BeNumerically("==", 1)))
+ })
+ })
+}
+
+func createErrorProducerKamelet(t *testing.T, ctx context.Context, ns string, name string) func() error {
props := map[string]v1.JSONSchemaProp{
"message": {
Type: "string",
@@ -145,5 +270,5 @@ func createErrorProducerKamelet(t *testing.T, ctx context.Context, operatorID st
},
}
- return CreateKamelet(t, operatorID, ctx, ns, name, flow, props, nil)
+ return CreateKamelet(t, 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
deleted file mode 100644
index 272f8e0e7..000000000
--- a/e2e/common/misc/pipe_with_image_test.go
+++ /dev/null
@@ -1,94 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package misc
-
-import (
- "context"
- "testing"
-
- . "github.com/onsi/gomega"
- "github.com/onsi/gomega/gstruct"
-
- corev1 "k8s.io/api/core/v1"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
-)
-
-func TestPipeWithImage(t *testing.T) {
- t.Parallel()
-
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-pipe-image"
- 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))
-
- bindingID := "with-image-binding"
-
- t.Run("run with initial image", func(t *testing.T) {
- expectedImage := "quay.io/fuse_qe/echo-server:0.3.2"
-
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "my-own-timer-source", "my-own-log-sink",
- "--trait", "container.image="+expectedImage, "--trait", "jvm.enabled=false",
- "--trait", "kamelets.enabled=false", "--trait", "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, ctx, ns, bindingID)).Should(WithTransform(Annotations,
- HaveKeyWithValue("test", "1"),
- ))
- g.Eventually(IntegrationStatusImage(t, ctx, ns, bindingID)).
- Should(Equal(expectedImage))
- g.Eventually(IntegrationPodPhase(t, ctx, ns, bindingID), TestTimeoutShort).
- Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPodImage(t, ctx, ns, bindingID)).
- Should(Equal(expectedImage))
- })
-
- t.Run("run with new image", func(t *testing.T) {
- expectedImage := "quay.io/fuse_qe/echo-server:0.3.3"
-
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "my-own-timer-source", "my-own-log-sink",
- "--trait", "container.image="+expectedImage, "--trait", "jvm.enabled=false",
- "--trait", "kamelets.enabled=false", "--trait", "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, ctx, ns, bindingID)).Should(WithTransform(Annotations,
- HaveKeyWithValue("test", "2"),
- ))
- g.Eventually(IntegrationStatusImage(t, ctx, ns, bindingID)).
- Should(Equal(expectedImage))
- g.Eventually(IntegrationPodPhase(t, ctx, ns, bindingID), TestTimeoutShort).
- Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPodImage(t, ctx, ns, bindingID)).
- Should(Equal(expectedImage))
- })
-
- 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
deleted file mode 100644
index 9f474eee5..000000000
--- a/e2e/common/misc/registry_maven_wagon_test.go
+++ /dev/null
@@ -1,148 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package misc
-
-import (
- "context"
- "fmt"
- "path/filepath"
- "testing"
-
- . "github.com/onsi/gomega"
- "github.com/stretchr/testify/require"
-
- corev1 "k8s.io/api/core/v1"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
- "github.com/apache/camel-k/v2/pkg/util/openshift"
-)
-
-func TestImageRegistryIsAMavenRepository(t *testing.T) {
- t.Parallel()
-
- ocp, err := openshift.IsOpenShift(TestClient(t))
- require.NoError(t, err)
- if ocp {
- t.Skip("Avoid running on OpenShift until CA and secret are injected client side")
- return
- }
-
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-registry-maven-repo"
- 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))
-
- 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
- name := RandomizedSuffixName("foobar-decryption")
- jar, err := filepath.Abs("files/registry/sample-decryption-1.0.jar?skipPOM=true")
- require.NoError(t, err)
- pom, err := filepath.Abs("files/registry/sample-decryption-1.0.pom")
- require.NoError(t, err)
-
- 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())
-
- 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, ctx, operatorID, ns, "files/registry/LaughingRoute.java",
- "--name", name,
- "-p", "location=/deployments/?filename=laugh.txt",
- "-d", "file://files/registry/laugh.txt").Execute()).To(Succeed())
-
- g.Eventually(IntegrationPodPhase(t, 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, 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())
-
- 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, 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())
-
- 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) {
- // Create integration that should decrypt foobar and log it
- name := RandomizedSuffixName("foobar-decryption-pom-extraction")
- jar, err := filepath.Abs("files/registry/sample-decryption-1.0.jar")
- require.NoError(t, err)
-
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/registry/FoobarDecryption.java",
- "--name", name,
- "-d", fmt.Sprintf("file://%s", jar)).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("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, 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, 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, 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 680f06adb..1e2577e56 100644
--- a/e2e/common/misc/rest_test.go
+++ b/e2e/common/misc/rest_test.go
@@ -35,32 +35,23 @@ import (
corev1 "k8s.io/api/core/v1"
. "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"github.com/apache/camel-k/v2/pkg/util/openshift"
)
func TestRunRest(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-rest"
- 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))
-
ocp, err := openshift.IsOpenShift(TestClient(t))
require.NoError(t, err)
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/rest-consumer.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, ctx, ns, "rest-consumer")
g.Eventually(service, TestTimeoutShort).ShouldNot(BeNil())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/rest-producer.yaml", "-p", "serviceName=rest-consumer", "-p", "name="+name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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)))
@@ -77,8 +68,6 @@ func TestRunRest(t *testing.T) {
g.Eventually(IntegrationLogs(t, ctx, ns, "rest-consumer"), TestTimeoutShort).Should(ContainSubstring(fmt.Sprintf("get %s", name)))
})
}
-
- 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
deleted file mode 100644
index 0b1bdd643..000000000
--- a/e2e/common/misc/scale_binding_test.go
+++ /dev/null
@@ -1,142 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package misc
-
-import (
- "context"
- "testing"
-
- . "github.com/onsi/gomega"
- "github.com/onsi/gomega/gstruct"
- "github.com/stretchr/testify/require"
-
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/types"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
- "github.com/apache/camel-k/v2/pkg/client/camel/clientset/versioned"
- "github.com/apache/camel-k/v2/pkg/util/openshift"
-)
-
-func TestPipeScale(t *testing.T) {
- t.Parallel()
-
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-pipe-scale"
- 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, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
-
- ocp, err := openshift.IsOpenShift(TestClient(t))
- require.NoError(t, err)
- if ocp {
- t.Skip("TODO: Temporarily disabled as this test is flaky on OpenShift 3")
- return
- }
-
- name := RandomizedSuffixName("timer2log")
- 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, ctx, ns, name, 3)).To(Succeed())
- // Check the scale cascades into the Deployment scale
- 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, ctx, ns, name), TestTimeoutShort).
- Should(gstruct.PointTo(BeNumerically("==", 3)))
- // Check it also cascades into the Pipe scale subresource Status field
- g.Eventually(PipeStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
- Should(gstruct.PointTo(BeNumerically("==", 3)))
- // Check the readiness condition becomes truthy back
- 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, ctx, ns, name, v1.PipeConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
- })
-
- t.Run("ScalePipe with polymorphic client", func(t *testing.T) {
- scaleClient, err := TestClient(t).ScalesClient()
- g.Expect(err).To(BeNil())
-
- // Patch the integration scale subresource
- patch := "{\"spec\":{\"replicas\":2}}"
- _, 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, ctx, ns, name, v1.PipeConditionReady)()).To(Equal(corev1.ConditionTrue))
- // Check the Integration scale subresource Spec field
- 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, ctx, ns, name), TestTimeoutShort).Should(HaveLen(2))
- // Check it cascades into the Integration scale subresource Status field
- 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, ctx, ns, name), TestTimeoutShort).
- Should(gstruct.PointTo(BeNumerically("==", 2)))
- })
-
- t.Run("ScalePipe with Camel K client", func(t *testing.T) {
- camel, err := versioned.NewForConfig(TestClient(t).GetConfig())
- g.Expect(err).To(BeNil())
-
- // Getter
- 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(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, ctx, ns, name, v1.PipeConditionReady)()).To(Equal(corev1.ConditionTrue))
- // Check the Pipe scale subresource Spec field
- 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, ctx, ns, name, v1.IntegrationConditionReady)()).To(Equal(corev1.ConditionTrue))
- // Check the Integration scale subresource Spec field
- 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, ctx, ns, name), TestTimeoutShort).Should(HaveLen(1))
- // Finally check it cascades into the Integration scale subresource Status field
- g.Eventually(IntegrationStatusReplicas(t, ctx, ns, name), TestTimeoutShort).
- Should(gstruct.PointTo(BeNumerically("==", 1)))
- })
-
- 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 d2fb9a37d..a72b1999e 100644
--- a/e2e/common/misc/scale_integration_test.go
+++ b/e2e/common/misc/scale_integration_test.go
@@ -43,15 +43,8 @@ func TestIntegrationScale(t *testing.T) {
t.Parallel()
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-integration-scale"
- 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, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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!"))
@@ -123,7 +116,7 @@ func TestIntegrationScale(t *testing.T) {
// Save resources by deleting the integration
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.Expect(KamelRun(t, ctx, 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())
@@ -131,10 +124,6 @@ func TestIntegrationScale(t *testing.T) {
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, 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 da6765bde..5b8c46f60 100644
--- a/e2e/common/misc/structured_logs_test.go
+++ b/e2e/common/misc/structured_logs_test.go
@@ -37,21 +37,13 @@ import (
func TestStructuredLogs(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-structured-logs"
- 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, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "logging.format=json").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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))
- pod := OperatorPod(t, ctx, ns)()
+ pod := OperatorPodGlobal(t, ctx)()
g.Expect(pod).NotTo(BeNil())
// pod.Namespace could be different from ns if using global operator
@@ -62,12 +54,5 @@ func TestStructuredLogs(t *testing.T) {
logs, err := StructuredLogs(t, ctx, pod.Namespace, pod.Name, logOptions, false)
g.Expect(err).To(BeNil())
g.Expect(logs).NotTo(BeEmpty())
-
- it := Integration(t, ctx, ns, name)()
- g.Expect(it).NotTo(BeNil())
- build := Build(t, ctx, IntegrationKitNamespace(t, ctx, ns, name)(), IntegrationKit(t, ctx, ns, name)())()
- g.Expect(build).NotTo(BeNil())
-
- 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 b6e2a3a34..77bb56070 100644
--- a/e2e/common/runtimes/runtimes_test.go
+++ b/e2e/common/runtimes/runtimes_test.go
@@ -36,22 +36,14 @@ import (
func TestSourceLessIntegrations(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-runtimes"
- 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))
-
var cmData = make(map[string]string)
cmData["my-file.txt"] = "Hello World!"
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, 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.Expect(KamelRun(t, ctx, 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.IntegrationConditionType("JVMTraitInfo"))().Message).Should(ContainSubstring("explicitly disabled by the platform"))
@@ -61,7 +53,7 @@ func TestSourceLessIntegrations(t *testing.T) {
t.Run("Camel Spring Boot", func(t *testing.T) {
itName := "my-camel-sb-v1"
- 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.Expect(KamelRun(t, ctx, 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.IntegrationConditionType("JVMTraitInfo"))().Message).Should(ContainSubstring("explicitly disabled by the platform"))
@@ -71,14 +63,12 @@ func TestSourceLessIntegrations(t *testing.T) {
t.Run("Camel Quarkus", func(t *testing.T) {
itName := "my-camel-quarkus-v1"
- 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.Expect(KamelRun(t, ctx, 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.IntegrationConditionType("JVMTraitInfo"))().Message).Should(ContainSubstring("explicitly disabled by the platform"))
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, 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 3b99863f5..fa9c8487f 100644
--- a/e2e/common/traits/affinity_test.go
+++ b/e2e/common/traits/affinity_test.go
@@ -31,7 +31,6 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
. "github.com/apache/camel-k/v2/e2e/support"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
@@ -39,15 +38,7 @@ import (
func TestAffinityTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-affinity"
- 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))
-
var hostname string
if node, err := selectSchedulableNode(t, ctx); err == nil {
hostname = node.Labels["kubernetes.io/hostname"]
@@ -56,38 +47,38 @@ func TestAffinityTrait(t *testing.T) {
hostname = ""
}
- if hostname != "" {
- t.Run("Run Java with node affinity", func(t *testing.T) {
- name1 := RandomizedSuffixName("java1")
- 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),
- }))
- g.Expect(pod.Spec.NodeName).To(Equal(hostname))
-
- // check integration schema does not contains unwanted default trait value.
- 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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
- }
+ t.Run("Run Java with node affinity", func(t *testing.T) {
+ if hostname == "" {
+ t.Skip(`This test requires node to have "kubernetes.io/hostname" label`)
+ }
+ name1 := RandomizedSuffixName("java1")
+ g.Expect(KamelRun(t, ctx, 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)).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),
+ }))
+ g.Expect(pod.Spec.NodeName).To(Equal(hostname))
+ })
t.Run("Run Java with pod affinity", func(t *testing.T) {
- 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.Expect(KamelRun(t, ctx, 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")).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")()
@@ -97,15 +88,19 @@ func TestAffinityTrait(t *testing.T) {
podAffinityTerm("camel.apache.org/integration", metav1.LabelSelectorOpExists, "kubernetes.io/hostname"),
},
}))
-
- 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, 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!"))
+ g.Expect(KamelRun(t, ctx, 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")).Should(Equal(corev1.PodPending))
+ g.Eventually(
+ IntegrationConditionStatus(t, ctx, ns, "java3", v1.IntegrationConditionReady), TestTimeoutShort).Should(
+ Equal(corev1.ConditionFalse),
+ )
+ g.Eventually(IntegrationCondition(t, ctx, ns, "java3", v1.IntegrationConditionReady)().Message).
+ Should(ContainSubstring("didn't match pod anti-affinity rules"))
pod := IntegrationPod(t, ctx, ns, "java3")()
g.Expect(pod.Spec.Affinity).NotTo(BeNil())
@@ -114,8 +109,6 @@ func TestAffinityTrait(t *testing.T) {
podAffinityTerm("camel.apache.org/integration", metav1.LabelSelectorOpExists, "kubernetes.io/hostname"),
},
}))
-
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
})
}
diff --git a/e2e/common/traits/builder_test.go b/e2e/common/traits/builder_test.go
index db8d42a00..c86f97fc2 100644
--- a/e2e/common/traits/builder_test.go
+++ b/e2e/common/traits/builder_test.go
@@ -30,7 +30,6 @@ import (
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
. "github.com/apache/camel-k/v2/e2e/support"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
@@ -38,18 +37,10 @@ import (
func TestBuilderTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-builder"
- 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))
-
t.Run("Run build strategy routine", func(t *testing.T) {
name := RandomizedSuffixName("java")
- 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.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name, "-t", "builder.order-strategy=sequential", "-t", "builder.strategy=routine").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))
@@ -67,13 +58,11 @@ func TestBuilderTrait(t *testing.T) {
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, 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, ctx, operatorID, ns, "files/Java.java",
+ g.Expect(KamelRun(t, ctx, 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",
@@ -94,13 +83,11 @@ func TestBuilderTrait(t *testing.T) {
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, 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, ctx, operatorID, ns, "files/Java.java",
+ g.Expect(KamelRun(t, ctx, 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",
@@ -122,13 +109,11 @@ func TestBuilderTrait(t *testing.T) {
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, 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, ctx, operatorID, ns, "files/Java.java",
+ g.Expect(KamelRun(t, ctx, 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",
@@ -161,13 +146,11 @@ func TestBuilderTrait(t *testing.T) {
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, 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, 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.Expect(KamelRun(t, ctx, 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, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
@@ -201,13 +184,11 @@ func TestBuilderTrait(t *testing.T) {
// Check logs
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, 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, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "builder.tasks=custom1;alpine;cat missingfile.txt", "-t", "builder.strategy=pod").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, ctx, ns, name)).Should(Equal(v1.IntegrationPhaseBuildingKit))
integrationKitName := IntegrationKit(t, ctx, ns, name)()
@@ -222,99 +203,17 @@ func TestBuilderTrait(t *testing.T) {
g.Eventually(
BuildCondition(t, ctx, integrationKitNamespace, integrationKitName, v1.BuildConditionType("Containercustom1Succeeded"))().Message,
TestTimeoutShort).Should(ContainSubstring("No such file or directory"))
-
- 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(ctx, mavenProfile1Cm)).To(Succeed())
- mavenProfile2Cm := newMavenProfileConfigMap(ns, "maven-profile-dependency", "dependency-profile")
- g.Expect(TestClient(t).Create(ctx, mavenProfile2Cm)).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, 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, ctx, ns, name)()
- integrationKitNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
- builderKitName := fmt.Sprintf("camel-k-%s-builder", integrationKitName)
- 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, ctx, integrationKitNamespace, integrationKitName), TestTimeoutShort).ShouldNot(BeNil())
- g.Eventually(
- Build(t, ctx, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Containercustom1Succeeded")).Status,
- TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(
- Build(t, ctx, integrationKitNamespace, integrationKitName)().Status.GetCondition(v1.BuildConditionType("Containercustom1Succeeded")).Message,
- TestTimeoutShort).Should(ContainSubstring("</project>"))
-
- // Check logs
- 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, 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())
})
t.Run("Run distroless container image", func(t *testing.T) {
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "builder.base-image=gcr.io/distroless/java17-debian12").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name, "-t", "builder.base-image=gcr.io/distroless/java17-debian12").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(KitRootImage(t, ctx, ns, integrationKitName), TestTimeoutShort).Should(Equal("gcr.io/distroless/java17-debian12"))
-
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
})
}
-
-func newMavenProfileConfigMap(ns, name, key string) *corev1.ConfigMap {
- return &corev1.ConfigMap{
- TypeMeta: metav1.TypeMeta{
- Kind: "ConfigMap",
- APIVersion: corev1.SchemeGroupVersion.String(),
- },
- ObjectMeta: metav1.ObjectMeta{
- Namespace: ns,
- Name: name,
- },
- Data: map[string]string{
- key: fmt.Sprintf(`
-<profile>
- <id>` + key + `</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.owasp</groupId>
- <artifactId>dependency-check-maven</artifactId>
- <version>5.3.0</version>
- <executions>
- <execution>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</profile>
-`,
- ),
- },
- }
-}
diff --git a/e2e/common/traits/camel_test.go b/e2e/common/traits/camel_test.go
index e854b53b6..343ed312d 100644
--- a/e2e/common/traits/camel_test.go
+++ b/e2e/common/traits/camel_test.go
@@ -36,21 +36,10 @@ import (
func TestCamelTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-camel"
- 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))
-
t.Run("properties changes should not rebuild", func(t *testing.T) {
-
- g.Expect(Kamel(t, ctx, "reset", "-n", ns).Execute()).To(Succeed())
-
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
// checking the integration status
g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
@@ -58,17 +47,11 @@ func TestCamelTrait(t *testing.T) {
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.Expect(KamelRun(t, ctx, 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, 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 1365d139b..44687f20a 100644
--- a/e2e/common/traits/container_test.go
+++ b/e2e/common/traits/container_test.go
@@ -37,18 +37,10 @@ import (
func TestContainerTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-container"
- 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))
-
t.Run("Container image pull policy and resources configuration", func(t *testing.T) {
name := RandomizedSuffixName("java1")
- 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.Expect(KamelRun(t, ctx, 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!"))
@@ -81,7 +73,7 @@ func TestContainerTrait(t *testing.T) {
t.Run("Container name", func(t *testing.T) {
name := RandomizedSuffixName("java2")
containerName := "my-container-name"
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "-t", "container.name="+containerName, "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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!"))
@@ -100,10 +92,6 @@ func TestContainerTrait(t *testing.T) {
g.Expect(containerTrait).ToNot(BeNil())
g.Expect(len(containerTrait)).To(Equal(1))
g.Expect(containerTrait["name"]).To(Equal(containerName))
-
})
-
- // Clean-up
- 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 37fb099ca..99d6cd698 100644
--- a/e2e/common/traits/deployment_test.go
+++ b/e2e/common/traits/deployment_test.go
@@ -40,18 +40,10 @@ import (
func TestRecreateDeploymentStrategyTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-deployment"
- 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))
-
t.Run("Run with Recreate Deployment Strategy", func(t *testing.T) {
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "deployment.strategy="+string(appsv1.RecreateDeploymentStrategyType)).
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name, "-t", "deployment.strategy="+string(appsv1.RecreateDeploymentStrategyType)).
Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
@@ -78,24 +70,14 @@ func TestRecreateDeploymentStrategyTrait(t *testing.T) {
g.Expect(len(deploymentTrait)).To(Equal(1))
g.Expect(deploymentTrait["strategy"]).To(Equal(string(appsv1.RecreateDeploymentStrategyType)))
})
-
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestRollingUpdateDeploymentStrategyTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-deployment-rolling"
- 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))
-
t.Run("Run with RollingUpdate Deployment Strategy", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "-t", "deployment.strategy="+string(appsv1.RollingUpdateDeploymentStrategyType)).
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "-t", "deployment.strategy="+string(appsv1.RollingUpdateDeploymentStrategyType)).
Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
@@ -114,7 +96,5 @@ func TestRollingUpdateDeploymentStrategyTrait(t *testing.T) {
}),
))
})
-
- 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 5e727b508..38bf530a6 100644
--- a/e2e/common/traits/error_handler_test.go
+++ b/e2e/common/traits/error_handler_test.go
@@ -36,18 +36,10 @@ import (
func TestErrorHandlerTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-errorhandler"
- 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))
-
t.Run("Run errored integration with error handler", func(t *testing.T) {
name := RandomizedSuffixName("error-handler")
- 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.Expect(KamelRun(t, ctx, 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"))
diff --git a/e2e/common/traits/errored_trait_test.go b/e2e/common/traits/errored_trait_test.go
index a113e021e..6be80ea0d 100644
--- a/e2e/common/traits/errored_trait_test.go
+++ b/e2e/common/traits/errored_trait_test.go
@@ -36,18 +36,10 @@ import (
func TestErroredTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-error"
- 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))
-
t.Run("Integration trait should fail", func(t *testing.T) {
name := RandomizedSuffixName("it-errored")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "kamelets.list=missing").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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(
@@ -58,7 +50,7 @@ func TestErroredTrait(t *testing.T) {
t.Run("Pipe trait should fail", func(t *testing.T) {
name := RandomizedSuffixName("kb-errored")
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "timer:foo", "log:bar", "--name", name, "-t", "kamelets.list=missing").Execute()).To(Succeed())
+ g.Expect(KamelBind(t, ctx, ns, "timer:foo", "log:bar", "--name", name, "-t", "kamelets.list=missing").Execute()).To(Succeed())
// Pipe
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))
@@ -75,8 +67,5 @@ func TestErroredTrait(t *testing.T) {
WithTransform(IntegrationConditionMessage, HavePrefix("error during trait customization")),
))
})
-
- // Clean up
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/gc_test.go b/e2e/common/traits/gc_test.go
index 6709181f1..6bf34550e 100644
--- a/e2e/common/traits/gc_test.go
+++ b/e2e/common/traits/gc_test.go
@@ -29,33 +29,20 @@ import (
. "github.com/onsi/gomega"
. "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
corev1 "k8s.io/api/core/v1"
)
func TestGarbageCollectorTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-gc"
- 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))
-
t.Run("Delete outdated resources", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/PlatformHttpServer.java").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, "platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
-
g.Eventually(ServicesByType(t, ctx, ns, corev1.ServiceTypeClusterIP), TestTimeoutLong).ShouldNot(BeEmpty())
// Update integration and disable service trait - existing service should be garbage collected
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "service.enabled=false").Execute()).To(Succeed())
-
+ g.Expect(KamelRun(t, ctx, ns, "files/PlatformHttpServer.java", "-t", "service.enabled=false").Execute()).To(Succeed())
g.Eventually(ServicesByType(t, ctx, ns, corev1.ServiceTypeClusterIP), TestTimeoutLong).Should(BeEmpty())
-
- 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 e7f5fe62c..b27bce5be 100644
--- a/e2e/common/traits/health_test.go
+++ b/e2e/common/traits/health_test.go
@@ -43,18 +43,10 @@ import (
func TestHealthTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-health"
- 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))
-
t.Run("Readiness condition with stopped route scaled", func(t *testing.T) {
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java",
+ g.Expect(KamelRun(t, ctx, 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())
@@ -148,14 +140,11 @@ func TestHealthTrait(t *testing.T) {
}))
g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
-
- // Clean-up
- 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, ctx, operatorID, ns, "files/Java.java",
+ g.Expect(KamelRun(t, ctx, 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())
@@ -238,9 +227,6 @@ func TestHealthTrait(t *testing.T) {
}))
g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError))
-
- // Clean-up
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Readiness condition with stopped binding", func(t *testing.T) {
@@ -248,10 +234,10 @@ func TestHealthTrait(t *testing.T) {
source := RandomizedSuffixName("my-health-timer-source")
sink := RandomizedSuffixName("my-health-log-sink")
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, source)()).To(Succeed())
- g.Expect(CreateLogKamelet(t, ctx, operatorID, ns, sink)()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, ns, source)()).To(Succeed())
+ g.Expect(CreateLogKamelet(t, ctx, ns, sink)()).To(Succeed())
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns, source, sink, "-p",
+ g.Expect(KamelBind(t, ctx, ns, source, sink, "-p",
"source.message=Magicstring!", "-p", "sink.loggerName=binding",
"--trait", "health.enabled=true",
"--trait", "jolokia.enabled=true",
@@ -356,17 +342,12 @@ func TestHealthTrait(t *testing.T) {
return data["check.kind"].(string) == "READINESS" && data["route.status"].(string) == "Stopped" && data["route.id"].(string) == "binding"
}))
-
- // Clean-up
- 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, ctx, operatorID, ns, "files/NeverReady.java", "--name", name, "-t", "health.enabled=true",
+ g.Expect(KamelRun(t, ctx, ns, "files/NeverReady.java", "--name", name, "-t", "health.enabled=true",
"-p", "camel.health.routesEnabled=false",
).Execute()).To(Succeed())
@@ -418,7 +399,7 @@ 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, ctx, operatorID, ns, "files/NeverReady.java", "--name", name,
+ g.Expect(KamelRun(t, ctx, ns, "files/NeverReady.java", "--name", name,
"-t", "health.enabled=true",
"-t", "health.startup-probe-enabled=true", "-t", "health.startup-timeout=60").Execute()).To(Succeed())
@@ -468,7 +449,7 @@ 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, ctx, operatorID, ns, "files/Java.java", "--name", name,
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name,
"-t", "health.enabled=true",
"-t", "health.startup-probe-enabled=true", "-t", "health.startup-timeout=60").Execute()).To(Succeed())
@@ -479,7 +460,5 @@ func TestHealthTrait(t *testing.T) {
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionDeploymentReadyReason)),
WithTransform(IntegrationConditionMessage, Equal("1/1 ready replicas"))))
})
-
- 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 bfe419efb..7f34e2234 100644
--- a/e2e/common/traits/istio_test.go
+++ b/e2e/common/traits/istio_test.go
@@ -37,18 +37,10 @@ import (
func TestIstioTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-istio"
- 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))
-
t.Run("Run Java with Istio", func(t *testing.T) {
name := RandomizedSuffixName("java")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "istio.enabled=true").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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!"))
@@ -66,9 +58,6 @@ func TestIstioTrait(t *testing.T) {
g.Expect(istioTrait).ToNot(BeNil())
g.Expect(len(istioTrait)).To(Equal(1))
g.Expect(istioTrait["enabled"]).To(Equal(true))
-
})
-
- 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 bb62cb096..12916f224 100644
--- a/e2e/common/traits/jolokia_test.go
+++ b/e2e/common/traits/jolokia_test.go
@@ -38,18 +38,10 @@ import (
func TestJolokiaTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-jolokia"
- 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))
-
t.Run("Run Java with Jolokia", func(t *testing.T) {
name := RandomizedSuffixName("java")
- 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.Expect(KamelRun(t, ctx, 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!"))
@@ -72,7 +64,5 @@ func TestJolokiaTrait(t *testing.T) {
g.Expect(jolokiaTrait["extendedClientCheck"]).To(Equal(false))
})
-
- 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 904f188a1..bc9e92041 100644
--- a/e2e/common/traits/jvm_test.go
+++ b/e2e/common/traits/jvm_test.go
@@ -39,15 +39,7 @@ import (
func TestJVMTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-jvm"
- 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))
-
// Store a configmap holding a jar
var cmData = make(map[string][]byte)
// We calculate the expected content
@@ -59,7 +51,7 @@ func TestJVMTrait(t *testing.T) {
t.Run("JVM trait classpath", func(t *testing.T) {
name := RandomizedSuffixName("classpath")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns,
+ g.Expect(KamelRun(t, ctx, ns,
"./files/jvm/Classpath.java",
"--name", name,
"--resource", "configmap:my-deps",
@@ -83,7 +75,7 @@ func TestJVMTrait(t *testing.T) {
t.Run("JVM trait classpath on deprecated path", func(t *testing.T) {
name := RandomizedSuffixName("classpath")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns,
+ g.Expect(KamelRun(t, ctx, ns,
"./files/jvm/Classpath.java",
"--name", name,
"-t", "mount.resources=configmap:my-deps/sample-1.0.jar@/etc/camel/resources",
@@ -107,7 +99,7 @@ func TestJVMTrait(t *testing.T) {
t.Run("JVM trait classpath on specific classpath", func(t *testing.T) {
name := RandomizedSuffixName("classpath")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns,
+ g.Expect(KamelRun(t, ctx, ns,
"./files/jvm/Classpath.java",
"--name", name,
"-t", "mount.resources=configmap:my-deps/sample-1.0.jar@/etc/other/resources",
@@ -128,7 +120,5 @@ func TestJVMTrait(t *testing.T) {
g.Expect(len(mountTrait)).To(Equal(1))
g.Expect(mountTrait["resources"]).To(ContainElements("configmap:my-deps/sample-1.0.jar@/etc/other/resources"))
})
-
- 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 bd744ea2a..ee97ec765 100644
--- a/e2e/common/traits/kamelet_test.go
+++ b/e2e/common/traits/kamelet_test.go
@@ -36,15 +36,7 @@ import (
func TestKameletTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-kamelet"
- 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))
-
t.Run("discover kamelet capabilities", func(t *testing.T) {
template := map[string]interface{}{
"from": map[string]interface{}{
@@ -56,10 +48,10 @@ func TestKameletTrait(t *testing.T) {
},
},
}
- g.Expect(CreateKamelet(t, operatorID, ctx, ns, "capabilities-webhook-source", template, nil, nil)()).To(Succeed())
+ g.Expect(CreateKamelet(t, ctx, ns, "capabilities-webhook-source", template, nil, nil)()).To(Succeed())
name := RandomizedSuffixName("webhook")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/webhook.yaml", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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)"))
@@ -69,9 +61,5 @@ func TestKameletTrait(t *testing.T) {
service := Service(t, ctx, ns, name)
g.Eventually(service, TestTimeoutShort).ShouldNot(BeNil())
})
-
- // Clean-up
- 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 eb40fe039..cdda85126 100644
--- a/e2e/common/traits/master_test.go
+++ b/e2e/common/traits/master_test.go
@@ -38,17 +38,9 @@ import (
func TestMasterTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-master"
- 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))
-
t.Run("master works", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Master.java").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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())
@@ -56,14 +48,14 @@ func TestMasterTrait(t *testing.T) {
t.Run("only one integration with master runs", func(t *testing.T) {
nameFirst := RandomizedSuffixName("first")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Master.java", "--name", nameFirst,
+ g.Expect(KamelRun(t, ctx, 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(IntegrationConditionStatus(t, ctx, ns, nameFirst, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
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 before 15 seconds)
nameSecond := RandomizedSuffixName("second")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Master.java", "--name", nameSecond,
+ g.Expect(KamelRun(t, ctx, ns, "files/Master.java", "--name", nameSecond,
"--label", "leader-group=same", "-t", "master.label-key=leader-group", "-t", "master.label-value=same", "-t", "owner.target-labels=leader-group",
"-t", fmt.Sprintf("master.resource-name=%s-lock", nameFirst),
).Execute()).To(Succeed())
@@ -71,7 +63,5 @@ func TestMasterTrait(t *testing.T) {
g.Eventually(IntegrationLogs(t, ctx, ns, nameSecond), 15*time.Second).ShouldNot(ContainSubstring("Magicstring!"))
g.Eventually(IntegrationConditionStatus(t, ctx, ns, nameSecond, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
})
-
- 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 45ea2a75e..4822bca40 100644
--- a/e2e/common/traits/openapi_test.go
+++ b/e2e/common/traits/openapi_test.go
@@ -33,33 +33,18 @@ import (
corev1 "k8s.io/api/core/v1"
. "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
)
func TestOpenAPI(t *testing.T) {
t.Parallel()
-
- /*
- kubectl create configmap my-openapi --from-file=./e2e/common/traits/files/openapi/petstore-api.yaml
-
- kamel run --dev --name=petstore --open-api configmap:my-openapi ./e2e/common/traits/files/openapi/petstore.yaml
- */
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-openapi"
- 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))
-
openapiContent, err := os.ReadFile("./files/openapi/petstore-api.yaml")
require.NoError(t, err)
var cmDataProps = make(map[string]string)
cmDataProps["petstore-api.yaml"] = string(openapiContent)
CreatePlainTextConfigmap(t, ctx, ns, "my-openapi", cmDataProps)
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "--name", "petstore", "--open-api", "configmap:my-openapi", "files/openapi/petstore.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "--name", "petstore", "--open-api", "configmap:my-openapi", "files/openapi/petstore.yaml").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, "petstore"), TestTimeoutLong).
Should(Equal(corev1.PodRunning))
@@ -72,7 +57,5 @@ func TestOpenAPI(t *testing.T) {
Should(ContainSubstring("Started createPets (rest://post:/v1:/pets)"))
g.Eventually(IntegrationLogs(t, ctx, ns, "petstore"), TestTimeoutMedium).
Should(ContainSubstring("Started showPetById (rest://get:/v1:/pets/%7BpetId%7D)"))
-
- 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 86e873ae3..89758ded3 100644
--- a/e2e/common/traits/pdb_test.go
+++ b/e2e/common/traits/pdb_test.go
@@ -45,17 +45,9 @@ import (
func TestPodDisruptionBudgetTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-pdb"
- 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, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "pdb.enabled=true", "-t", "pdb.min-available=2").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name, "-t", "pdb.enabled=true", "-t", "pdb.min-available=2").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))
@@ -149,9 +141,6 @@ func TestPodDisruptionBudgetTrait(t *testing.T) {
Name: pods[0].Name,
},
})).To(Succeed())
-
- // Clean up
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/pod_test.go b/e2e/common/traits/pod_test.go
index 04a2f6672..0492266fe 100644
--- a/e2e/common/traits/pod_test.go
+++ b/e2e/common/traits/pod_test.go
@@ -36,15 +36,7 @@ import (
func TestPodTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-pod"
- 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))
-
tc := []struct {
name string
templateName string
@@ -92,20 +84,15 @@ func TestPodTrait(t *testing.T) {
test := tc[i]
t.Run(test.name, func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PodTest.yaml", "--name", name, "--pod-template", test.templateName).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/PodTest.yaml", "--name", name, "--pod-template", test.templateName).Execute()).To(Succeed())
// check integration is deployed
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, ctx, "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 d50e27059..41e41b87e 100644
--- a/e2e/common/traits/prometheus_test.go
+++ b/e2e/common/traits/prometheus_test.go
@@ -46,20 +46,12 @@ import (
func TestPrometheusTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-prometheus"
- 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))
-
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, ctx, operatorID, ns, "files/Java.java", "-t", "prometheus.enabled=true", "-t", fmt.Sprintf("prometheus.pod-monitor=%v", createPodMonitor)).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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!"))
@@ -88,8 +80,6 @@ func TestPrometheusTrait(t *testing.T) {
g.Eventually(sm, TestTimeoutShort).ShouldNot(BeNil())
})
}
-
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/pull_secret_test.go b/e2e/common/traits/pull_secret_test.go
index 7436cfec1..7249651cd 100644
--- a/e2e/common/traits/pull_secret_test.go
+++ b/e2e/common/traits/pull_secret_test.go
@@ -38,21 +38,13 @@ import (
func TestPullSecretTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-pull-secret"
- 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))
-
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, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "pull-secret.enabled=true", "-t", "pull-secret.secret-name=dummy-secret").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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, ctx, ns, name), TestTimeoutLong).Should(Or(Equal(corev1.PodRunning), Equal(corev1.PodPending)))
@@ -63,7 +55,7 @@ func TestPullSecretTrait(t *testing.T) {
t.Run("Explicitly disable image pull secret", func(t *testing.T) {
name := RandomizedSuffixName("java2")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "pull-secret.enabled=false").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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!"))
@@ -89,7 +81,7 @@ 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, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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!"))
@@ -99,8 +91,5 @@ func TestPullSecretTrait(t *testing.T) {
g.Expect(pod.Spec.ImagePullSecrets[0].Name).To(HavePrefix("default-dockercfg-"))
})
}
-
- // Clean-up
- 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 89f4110d7..f6bba6d0c 100644
--- a/e2e/common/traits/route_test.go
+++ b/e2e/common/traits/route_test.go
@@ -44,7 +44,6 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
. "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"github.com/apache/camel-k/v2/pkg/util"
"github.com/apache/camel-k/v2/pkg/util/openshift"
)
@@ -74,15 +73,7 @@ var skipClientTLSVerification = true
func TestRunRoutes(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-route"
- 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, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
-
ocp, err := openshift.IsOpenShift(TestClient(t))
if !ocp {
t.Skip("This test requires route object which is available on OpenShift only.")
@@ -103,7 +94,7 @@ func TestRunRoutes(t *testing.T) {
// Insecure Route / No TLS
// =============================
t.Run("Route unsecure http works", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/PlatformHttpServer.java").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
g.Eventually(Route(t, ctx, ns, integrationName), TestTimeoutMedium).ShouldNot(BeNil())
// must wait a little time after route is created, before doing an http request,
@@ -120,7 +111,7 @@ func TestRunRoutes(t *testing.T) {
// TLS Route Edge
// =============================
t.Run("Route Edge https works", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "route.tls-termination=edge").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/PlatformHttpServer.java", "-t", "route.tls-termination=edge").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
g.Eventually(Route(t, ctx, ns, integrationName), TestTimeoutMedium).ShouldNot(BeNil())
// must wait a little time after route is created, before an http request,
@@ -137,7 +128,7 @@ func TestRunRoutes(t *testing.T) {
// TLS Route Edge with custom certificate
// =============================
t.Run("Route Edge (custom certificate) https works", func(t *testing.T) {
- 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.Expect(KamelRun(t, ctx, 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))
g.Eventually(Route(t, ctx, ns, integrationName), TestTimeoutMedium).ShouldNot(BeNil())
// must wait a little time after route is created, before an http request,
@@ -155,7 +146,7 @@ func TestRunRoutes(t *testing.T) {
// TLS Route Passthrough
// =============================
t.Run("Route passthrough https works", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "--resource", "secret:"+secretName+"@/etc/ssl/"+secretName, "-p", "quarkus.http.ssl.certificate.files=/etc/ssl/"+secretName+"/tls.crt", "-p", "quarkus.http.ssl.certificate.key-files=/etc/ssl/"+secretName+"/tls.key", "-t", "route.tls-termination=passthrough", "-t", "container.port=8443").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/PlatformHttpServer.java", "--resource", "secret:"+secretName+"@/etc/ssl/"+secretName, "-p", "quarkus.http.ssl.certificate.files=/etc/ssl/"+secretName+"/tls.crt", "-p", "quarkus.http.ssl.certificate.key-files=/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))
g.Eventually(Route(t, ctx, ns, integrationName), TestTimeoutMedium).ShouldNot(BeNil())
// must wait a little time after route is created, before an http request,
@@ -173,7 +164,7 @@ func TestRunRoutes(t *testing.T) {
// TLS Route Reencrypt
// =============================
t.Run("Route Reencrypt https works", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "--resource", "secret:"+secretName+"@/etc/ssl/"+secretName, "-p", "quarkus.http.ssl.certificate.files=/etc/ssl/"+secretName+"/tls.crt", "-p", "quarkus.http.ssl.certificate.key-files=/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.Expect(KamelRun(t, ctx, ns, "files/PlatformHttpServer.java", "--resource", "secret:"+secretName+"@/etc/ssl/"+secretName, "-p", "quarkus.http.ssl.certificate.files=/etc/ssl/"+secretName+"/tls.crt", "-p", "quarkus.http.ssl.certificate.key-files=/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", "container.port= [...]
g.Eventually(IntegrationPodPhase(t, ctx, ns, integrationName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
g.Eventually(Route(t, ctx, ns, integrationName), TestTimeoutMedium).ShouldNot(BeNil())
// must wait a little time after route is created, before an http request,
@@ -189,7 +180,7 @@ func TestRunRoutes(t *testing.T) {
t.Run("Route annotations added", func(t *testing.T) {
g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "route.annotations.'haproxy.router.openshift.io/balance'=roundrobin").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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))
g.Eventually(Route(t, ctx, ns, integrationName), TestTimeoutMedium).ShouldNot(BeNil())
// must wait a little time after route is created, before an http request,
@@ -206,8 +197,6 @@ func TestRunRoutes(t *testing.T) {
g.Expect(routeTrait).ToNot(BeNil())
g.Expect(len(routeTrait)).To(Equal(1))
g.Expect(routeTrait["annotations"]).ToNot(BeNil())
-
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).Should(BeNil())
})
g.Expect(TestClient(t).Delete(ctx, &secret)).To(Succeed())
})
diff --git a/e2e/common/traits/service_binding_test.go b/e2e/common/traits/service_binding_test.go
index b5862d2fa..c5bc27845 100644
--- a/e2e/common/traits/service_binding_test.go
+++ b/e2e/common/traits/service_binding_test.go
@@ -38,15 +38,7 @@ import (
func TestServiceBindingTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-service-binding"
- 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))
-
t.Run("Integration Service Binding", func(t *testing.T) {
// Create our mock service config
host := "hostname"
@@ -73,7 +65,7 @@ func TestServiceBindingTrait(t *testing.T) {
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, ctx, operatorID, ns, "files/ServiceBinding.java", "--name", name, "--connect", serviceRef).Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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))
@@ -101,13 +93,10 @@ func TestServiceBindingTrait(t *testing.T) {
}
serviceRef := fmt.Sprintf("%s:%s/%s", service.TypeMeta.Kind, ns, service.ObjectMeta.Name)
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.Expect(CreateTimerKamelet(t, ctx, ns, "my-timer-source")()).To(Succeed())
+ g.Expect(KamelBind(t, ctx, 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, 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 e18e23735..d7993e1f2 100644
--- a/e2e/common/traits/service_test.go
+++ b/e2e/common/traits/service_test.go
@@ -32,22 +32,14 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
. "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
)
func TestServiceTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-service"
- 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))
-
t.Run("NodePort service", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "service.enabled=true", "-t", "service.node-port=true").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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))
//
@@ -55,13 +47,11 @@ func TestServiceTrait(t *testing.T) {
// sometimes being created first and being given the root name
//
g.Eventually(ServicesByType(t, ctx, ns, corev1.ServiceTypeNodePort), TestTimeoutLong).ShouldNot(BeEmpty())
-
- 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, ctx, operatorID, ns, "files/PlatformHttpServer.java").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/PlatformHttpServer.java").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, "platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
//
@@ -69,12 +59,11 @@ func TestServiceTrait(t *testing.T) {
// sometimes being created first and being given the root name
//
g.Eventually(ServicesByType(t, ctx, ns, corev1.ServiceTypeClusterIP), TestTimeoutLong).ShouldNot(BeEmpty())
-
- 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, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "service.enabled=true", "-t", "service.type=NodePort").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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))
//
@@ -82,12 +71,11 @@ func TestServiceTrait(t *testing.T) {
// sometimes being created first and being given the root name
//
g.Eventually(ServicesByType(t, ctx, ns, corev1.ServiceTypeNodePort), TestTimeoutLong).ShouldNot(BeEmpty())
-
- 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, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "service.enabled=true", "-t", "service.type=ClusterIP").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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))
//
@@ -104,12 +92,11 @@ func TestServiceTrait(t *testing.T) {
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, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("LoadBalancer service from Type", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/PlatformHttpServer.java", "-t", "service.enabled=true", "-t", "service.type=LoadBalancer").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, 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))
//
@@ -117,8 +104,6 @@ func TestServiceTrait(t *testing.T) {
// sometimes being created first and being given the root name
//
g.Eventually(ServicesByType(t, ctx, ns, corev1.ServiceTypeLoadBalancer), TestTimeoutLong).ShouldNot(BeEmpty())
-
- 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 98e8def88..92bed0e8b 100644
--- a/e2e/common/traits/toleration_test.go
+++ b/e2e/common/traits/toleration_test.go
@@ -38,18 +38,10 @@ import (
func TestTolerationTrait(t *testing.T) {
t.Parallel()
-
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-traits-toleration"
- 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))
-
t.Run("Run Java with node toleration operation exists", func(t *testing.T) {
name := RandomizedSuffixName("java1")
- 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.Expect(KamelRun(t, ctx, 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!"))
@@ -67,7 +59,7 @@ func TestTolerationTrait(t *testing.T) {
t.Run("Run Java with node toleration operation equals", func(t *testing.T) {
name := RandomizedSuffixName("java2")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "toleration.enabled=true", "-t", "toleration.taints=camel.apache.org/master=test:NoExecute:300").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name, "-t", "toleration.enabled=true", "-t", "toleration.taints=camel.apache.org/master=test: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!"))
@@ -89,7 +81,7 @@ func TestTolerationTrait(t *testing.T) {
}
name := RandomizedSuffixName("java3")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "affinity.enabled=true", "-t", "affinity.node-affinity-labels=node-role.kubernetes.io/master", "-t", "toleration.enabled=true", "-t", "toleration.taints=node-role.kubernetes.io/master:NoSchedule").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name, "-t", "affinity.enabled=true", "-t", "affinity.node-affinity-labels=node-role.kubernetes.io/master", "-t", "toleration.enabled=true", "-t", "toleration.taints=node-role.kubernetes.io/master:NoSchedule").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))
@@ -116,8 +108,5 @@ func TestTolerationTrait(t *testing.T) {
}),
})))
})
-
- // Clean up
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/install/cli/files/Java.java b/e2e/install/cli/files/Java.java
deleted file mode 100644
index 30b1f459e..000000000
--- a/e2e/install/cli/files/Java.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.apache.camel.builder.RouteBuilder;
-
-public class Java extends RouteBuilder {
- @Override
- public void configure() throws Exception {
- from("timer:tick")
- .setHeader("m").constant("string!")
- .setBody().simple("Magic${header.m}")
- .log("${body}");
- }
-}
diff --git a/e2e/install/cli/files/timer-kamelet-usage.yaml b/e2e/install/cli/files/timer-kamelet-usage.yaml
deleted file mode 100644
index 206ba027b..000000000
--- a/e2e/install/cli/files/timer-kamelet-usage.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-- from:
- uri: "kamelet:my-own-timer-source?message=Hello+world"
- steps:
- - to: "log:info?showAll=false"
diff --git a/e2e/install/cli/files/yaml.yaml b/e2e/install/cli/files/yaml.yaml
deleted file mode 100644
index 8877c8557..000000000
--- a/e2e/install/cli/files/yaml.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-- from:
- uri: "timer:yaml"
- parameters:
- period: "5000"
- steps:
- - setHeader:
- name: "m"
- constant: "string!"
- - setBody:
- simple: "Magic${header.m}"
- - to: "log:info"
diff --git a/e2e/install/cli/global_kamelet_test.go b/e2e/install/cli/global_kamelet_test.go
deleted file mode 100644
index cfaa62d1f..000000000
--- a/e2e/install/cli/global_kamelet_test.go
+++ /dev/null
@@ -1,74 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cli
-
-import (
- "context"
- "testing"
-
- . "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
-
- . "github.com/apache/camel-k/v2/e2e/support"
-)
-
-func TestRunGlobalKamelet(t *testing.T) {
- WithGlobalOperatorNamespace(t, func(ctx context.Context, g *WithT, operatorNamespace string) {
- operatorID := "camel-k-global-kamelet"
- g.Expect(KamelInstallWithID(t, ctx, operatorID, operatorNamespace, "--global", "--force")).To(Succeed())
-
- t.Run("Global operator + namespaced kamelet test", func(t *testing.T) {
-
- // NS2: namespace without operator
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns2 string) {
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns2, "my-own-timer-source")()).To(Succeed())
-
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns2, "--skip-operator-setup", "--olm=false")).To(Succeed())
-
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns2, "files/timer-kamelet-usage.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns2, "timer-kamelet-usage"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, ns2, "timer-kamelet-usage"), TestTimeoutShort).Should(ContainSubstring("Hello world"))
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns2).Execute()).To(Succeed())
- })
- })
-
- t.Run("Global operator + global kamelet test", func(t *testing.T) {
-
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, operatorNamespace, "my-own-timer-source")()).To(Succeed())
-
- // NS3: namespace without operator
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns3 string) {
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns3, "--skip-operator-setup", "--olm=false")).To(Succeed())
-
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns3, "files/timer-kamelet-usage.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns3, "timer-kamelet-usage"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, ns3, "timer-kamelet-usage"), TestTimeoutShort).Should(ContainSubstring("Hello world"))
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns3).Execute()).To(Succeed())
- g.Expect(TestClient(t).Delete(ctx, Kamelet(t, ctx, "my-own-timer-source", operatorNamespace)())).To(Succeed())
- })
- })
-
- g.Expect(Kamel(t, ctx, "uninstall", "-n", operatorNamespace, "--skip-crd", "--skip-cluster-roles=false", "--skip-cluster-role-bindings=false").Execute()).To(Succeed())
- })
-
-}
diff --git a/e2e/install/cli/global_test.go b/e2e/install/cli/global_test.go
deleted file mode 100644
index 1ff3dd114..000000000
--- a/e2e/install/cli/global_test.go
+++ /dev/null
@@ -1,170 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cli
-
-import (
- "context"
- "fmt"
- "strings"
- "testing"
- "time"
-
- . "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
- "github.com/apache/camel-k/v2/pkg/platform"
- "github.com/apache/camel-k/v2/pkg/util/defaults"
-)
-
-func TestRunGlobalInstall(t *testing.T) {
- WithGlobalOperatorNamespace(t, func(ctx context.Context, g *WithT, operatorNamespace string) {
- g.Expect(KamelInstall(t, ctx, operatorNamespace, "--global", "--force")).To(Succeed())
- g.Eventually(OperatorPodPhase(t, ctx, operatorNamespace), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
-
- t.Run("Global CamelCatalog reconciliation", func(t *testing.T) {
- g.Eventually(Platform(t, ctx, operatorNamespace)).ShouldNot(BeNil())
- g.Eventually(PlatformConditionStatus(t, ctx, operatorNamespace, v1.IntegrationPlatformConditionTypeCreated), TestTimeoutShort).
- Should(Equal(corev1.ConditionTrue))
- catalogName := fmt.Sprintf("camel-catalog-%s", strings.ToLower(defaults.DefaultRuntimeVersion))
- g.Eventually(CamelCatalog(t, ctx, operatorNamespace, catalogName)).ShouldNot(BeNil())
- g.Eventually(CamelCatalogPhase(t, ctx, operatorNamespace, catalogName), TestTimeoutMedium).Should(Equal(v1.CamelCatalogPhaseReady))
- })
-
- t.Run("Global test on namespace with platform", func(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns2 string) {
- // Creating namespace local platform
- g.Expect(KamelInstall(t, ctx, ns2, "--skip-operator-setup", "--olm=false")).To(Succeed())
- g.Eventually(Platform(t, ctx, ns2)).ShouldNot(BeNil())
-
- // Run with global operator id
- g.Expect(KamelRun(t, ctx, ns2, "files/Java.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns2, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, ns2, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(IntegrationConditionMessage(IntegrationCondition(t, ctx, ns2, "java", v1.IntegrationConditionPlatformAvailable)())).To(MatchRegexp(ns2 + "\\/.*"))
- kit := IntegrationKit(t, ctx, ns2, "java")()
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns2).Execute()).To(Succeed())
- g.Expect(Kits(t, ctx, ns2)()).Should(WithTransform(integrationKitsToNamesTransform(), ContainElement(kit)))
- g.Expect(Kits(t, ctx, operatorNamespace)()).Should(WithTransform(integrationKitsToNamesTransform(), Not(ContainElement(kit))))
-
- g.Expect(Lease(t, ctx, ns2, platform.DefaultPlatformName)()).To(BeNil(), "No locking Leases expected")
- })
- })
-
- t.Run("Global test on namespace with its own operator", func(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns3 string) {
- operatorID := "camel-k-local-ns3"
- if NoOlmOperatorImage != "" {
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns3, "--olm=false", "--operator-image", NoOlmOperatorImage)).To(Succeed())
- } else {
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns3, "--olm=false")).To(Succeed())
- }
- g.Eventually(OperatorPodPhase(t, ctx, ns3), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns3, "files/Java.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns3, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, ns3, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(IntegrationConditionMessage(IntegrationCondition(t, ctx, ns3, "java", v1.IntegrationConditionPlatformAvailable)())).To(MatchRegexp(ns3 + "\\/.*"))
- kit := IntegrationKit(t, ctx, ns3, "java")()
- g.Expect(Kits(t, ctx, ns3)()).Should(WithTransform(integrationKitsToNamesTransform(), ContainElement(kit)))
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns3).Execute()).To(Succeed())
-
- g.Expect(Lease(t, ctx, ns3, platform.OperatorLockName)()).To(BeNil(), "No locking Leases expected")
- g.Expect(Lease(t, ctx, ns3, platform.GetOperatorLockName(operatorID))()).ShouldNot(BeNil(),
- "Controller Runtime is expected to use Leases for leader election: if this changes we should update our locking logic",
- )
- })
- })
-
- t.Run("Global test on namespace without platform", func(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns4 string) {
- g.Expect(KamelRun(t, ctx, ns4, "files/Java.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns4, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, ns4, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(IntegrationConditionMessage(IntegrationCondition(t, ctx, ns4, "java", v1.IntegrationConditionPlatformAvailable)())).To(MatchRegexp(operatorNamespace + "\\/.*"))
- kit := IntegrationKit(t, ctx, ns4, "java")()
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns4).Execute()).To(Succeed())
- g.Expect(Kits(t, ctx, ns4)()).Should(WithTransform(integrationKitsToNamesTransform(), Not(ContainElement(kit))))
- g.Expect(Kits(t, ctx, operatorNamespace)()).Should(WithTransform(integrationKitsToNamesTransform(), ContainElement(kit))) // Kit built globally
-
- g.Expect(Lease(t, ctx, ns4, platform.OperatorLockName)()).To(BeNil(), "No locking Leases expected")
- })
- })
-
- t.Run("Global test on namespace without platform with external kit", func(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns5 string) {
- g.Expect(KamelRun(t, ctx, ns5, "files/Java.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns5, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, ns5, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(IntegrationConditionMessage(IntegrationCondition(t, ctx, ns5, "java", v1.IntegrationConditionPlatformAvailable)())).To(MatchRegexp(operatorNamespace + "\\/.*"))
- kit := IntegrationKit(t, ctx, ns5, "java")()
- g.Expect(kit).NotTo(BeEmpty())
- kitImage := KitImage(t, ctx, operatorNamespace, kit)()
- g.Expect(kitImage).NotTo(BeEmpty())
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns5).Execute()).To(Succeed())
- g.Expect(Kits(t, ctx, ns5)()).Should(WithTransform(integrationKitsToNamesTransform(), Not(ContainElement(kit))))
- globalKits := Kits(t, ctx, operatorNamespace)()
- g.Expect(globalKits).Should(WithTransform(integrationKitsToNamesTransform(), ContainElement(kit))) // Reusing the same global kit
-
- // external kit mirroring the global one
- externalKit := v1.IntegrationKit{
- ObjectMeta: metav1.ObjectMeta{
- Namespace: ns5,
- Name: "external",
- Labels: map[string]string{
- v1.IntegrationKitTypeLabel: v1.IntegrationKitTypeExternal,
- },
- },
- Spec: v1.IntegrationKitSpec{
- Image: kitImage,
- },
- }
- g.Expect(TestClient(t).Create(ctx, &externalKit)).Should(BeNil())
-
- g.Expect(KamelRun(t, ctx, ns5, "files/Java.java", "--name", "ext", "--kit", "external").Execute()).To(Succeed())
- g.Consistently(IntegrationPhase(t, ctx, ns5, "ext"), 10*time.Second).ShouldNot(Equal(v1.IntegrationPhaseBuildingKit))
- g.Eventually(IntegrationPodPhase(t, ctx, ns5, "ext"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, ns5, "ext"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- g.Expect(IntegrationKit(t, ctx, ns5, "ext")()).Should(Equal("external"))
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns5).Execute()).To(Succeed())
- g.Expect(Kits(t, ctx, ns5)()).Should(WithTransform(integrationKitsToNamesTransform(), ContainElement("external"))) // the external one
- g.Expect(Kits(t, ctx, operatorNamespace)()).Should(WithTransform(integrationKitsToNamesTransform(), ContainElement(kit))) // the global one
-
- g.Expect(Lease(t, ctx, ns5, platform.OperatorLockName)()).To(BeNil(), "No locking Leases expected")
- })
- })
-
- g.Expect(Kamel(t, ctx, "uninstall", "-n", operatorNamespace, "--skip-crd", "--skip-cluster-roles").Execute()).To(Succeed())
- })
-}
-
-func integrationKitsToNamesTransform() func([]v1.IntegrationKit) []string {
- return func(iks []v1.IntegrationKit) []string {
- var names []string
- for _, x := range iks {
- names = append(names, x.Name)
- }
- return names
- }
-}
diff --git a/e2e/install/cli/install_test.go b/e2e/install/cli/install_test.go
deleted file mode 100644
index ff6bfaaf6..000000000
--- a/e2e/install/cli/install_test.go
+++ /dev/null
@@ -1,223 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cli
-
-import (
- "bytes"
- "context"
- "fmt"
- "os"
- "reflect"
- "strings"
- "testing"
- "text/template"
-
- . "github.com/onsi/gomega"
- "github.com/stretchr/testify/require"
- corev1 "k8s.io/api/core/v1"
- "k8s.io/client-go/kubernetes/scheme"
- "k8s.io/client-go/tools/remotecommand"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
- "github.com/apache/camel-k/v2/pkg/install"
- "github.com/apache/camel-k/v2/pkg/util/defaults"
- "github.com/apache/camel-k/v2/pkg/util/kubernetes"
- "github.com/apache/camel-k/v2/pkg/util/openshift"
- consolev1 "github.com/openshift/api/console/v1"
-)
-
-func TestBasicInstallation(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- 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))
-
- // Check if restricted security context has been applyed
- operatorPod := OperatorPod(t, ctx, ns)()
- g.Expect(operatorPod.Spec.Containers[0].SecurityContext.RunAsNonRoot).To(Equal(kubernetes.DefaultOperatorSecurityContext().RunAsNonRoot))
- g.Expect(operatorPod.Spec.Containers[0].SecurityContext.Capabilities).To(Equal(kubernetes.DefaultOperatorSecurityContext().Capabilities))
- g.Expect(operatorPod.Spec.Containers[0].SecurityContext.SeccompProfile).To(Equal(kubernetes.DefaultOperatorSecurityContext().SeccompProfile))
- g.Expect(operatorPod.Spec.Containers[0].SecurityContext.AllowPrivilegeEscalation).To(Equal(kubernetes.DefaultOperatorSecurityContext().AllowPrivilegeEscalation))
-
- t.Run("run yaml", func(t *testing.T) {
- 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!"))
-
- // Check if file exists in operator pod
- g.Expect(OperatorPod(t, ctx, ns)().Name).NotTo(Equal(""))
- g.Expect(OperatorPod(t, ctx, ns)().Spec.Containers[0].Name).NotTo(Equal(""))
-
- req := TestClient(t).CoreV1().RESTClient().Post().
- Resource("pods").
- Name(OperatorPod(t, ctx, ns)().Name).
- Namespace(ns).
- SubResource("exec").
- Param("container", OperatorPod(t, ctx, ns)().Spec.Containers[0].Name)
-
- req.VersionedParams(&corev1.PodExecOptions{
- Container: OperatorPod(t, ctx, ns)().Spec.Containers[0].Name,
- Command: []string{"test", "-e", defaults.LocalRepository + "/org/apache/camel/k"},
- Stdin: false,
- Stdout: true,
- Stderr: true,
- TTY: false,
- }, scheme.ParameterCodec)
-
- exec, err := remotecommand.NewSPDYExecutor(TestClient(t).GetConfig(), "POST", req.URL())
- g.Expect(err).To(BeNil())
-
- // returns an error if file does not exists
- execErr := exec.Stream(remotecommand.StreamOptions{
- Stdout: os.Stdout,
- Stderr: os.Stderr,
- Tty: false,
- })
- g.Expect(execErr).To(BeNil())
-
- })
-
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
-}
-
-func TestAlternativeImageInstallation(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--olm=false", "--operator-image", "x/y:latest")).To(Succeed())
- g.Eventually(OperatorImage(t, ctx, ns)).Should(Equal("x/y:latest"))
- })
-}
-
-func TestKitMainInstallation(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Expect(Kamel(t, ctx, "kit", "create", "timer", "-d", "camel:timer", "-x", operatorID, "-n", ns).Execute()).To(Succeed())
- g.Eventually(Build(t, ctx, ns, "timer"), TestTimeoutMedium).ShouldNot(BeNil())
- })
-}
-
-func TestMavenRepositoryInstallation(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--maven-repository", "https://my.repo.org/public/")).To(Succeed())
- configmapName := fmt.Sprintf("%s-maven-settings", operatorID)
- g.Eventually(Configmap(t, ctx, ns, configmapName)).Should(Not(BeNil()))
- g.Eventually(func() string {
- return Configmap(t, ctx, ns, configmapName)().Data["settings.xml"]
- }).Should(ContainSubstring("https://my.repo.org/public/"))
- })
-}
-
-/*
- * Expert mode where user does not want a registry configured
- * so the Platform will have an empty Registry structure
- */
-func TestSkipRegistryInstallation(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--skip-registry-setup")).To(Succeed())
- g.Eventually(Platform(t, ctx, ns)).ShouldNot(BeNil())
- g.Eventually(func() v1.RegistrySpec {
- return Platform(t, ctx, ns)().Spec.Build.Registry
- }, TestTimeoutMedium).Should(Equal(v1.RegistrySpec{}))
- })
-}
-
-type templateArgs struct {
- Version string
- Platform string
-}
-
-func TestConsoleCliDownload(t *testing.T) {
- ocp, err := openshift.IsOpenShift(TestClient(t))
- require.NoError(t, err)
-
- ok, err := kubernetes.IsAPIResourceInstalled(TestClient(t), "console.openshift.io/v1", reflect.TypeOf(consolev1.ConsoleCLIDownload{}).Name())
- require.NoError(t, err)
-
- if !ocp || !ok {
- t.Skip("This test requires ConsoleCliDownload object which is available on OpenShift 4+ only.")
- return
- }
-
- name := GetEnvOrDefault("CAMEL_K_CONSOLE_CLI_DOWNLOAD_NAME", install.KamelCLIDownloadName)
- downloadUrlTemplate := GetEnvOrDefault("CAMEL_K_CONSOLE_CLI_DOWNLOAD_URL_TEMPLATE", "https://github.com/apache/camel-k/v2/releases/download/v{{ .Version}}/camel-k-client-{{ .Version}}-{{ .Platform}}-64bit.tar.gz")
-
- args := templateArgs{Version: defaults.Version}
- templt, err := template.New("downloadLink").Parse(downloadUrlTemplate)
- require.NoError(t, err)
-
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- // make sure there is no preinstalled CliDownload resource
- cliDownload := ConsoleCLIDownload(t, ctx, name)()
- if cliDownload != nil {
- g.Expect(TestClient(t).Delete(ctx, cliDownload)).To(Succeed())
- }
-
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(ConsoleCLIDownload(t, ctx, name), TestTimeoutMedium).Should(Not(BeNil()))
-
- cliDownload = ConsoleCLIDownload(t, ctx, name)()
- links := cliDownload.Spec.Links
-
- for _, link := range links {
- var buf bytes.Buffer
- if strings.Contains(link.Text, "for Linux") {
- args.Platform = "linux"
- } else if strings.Contains(link.Text, "for Mac") {
- args.Platform = "mac"
- } else if strings.Contains(link.Text, "for Windows") {
- args.Platform = "windows"
- }
-
- templt.Execute(&buf, args)
- g.Expect(link.Href).To(MatchRegexp(buf.String()))
- }
- })
-}
-
-func TestInstallSkipDefaultKameletsInstallation(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithIDAndKameletCatalog(t, ctx, operatorID, ns, "--skip-default-kamelets-setup")).To(Succeed())
- g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
- g.Expect(KameletList(t, ctx, ns)()).Should(BeEmpty())
- })
-}
-
-func TestInstallDebugLogging(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "-z", "debug")).To(Succeed())
-
- g.Eventually(OperatorEnvVarValue(t, ctx, ns, "LOG_LEVEL"), TestTimeoutLong).Should(Equal("debug"))
- })
-}
diff --git a/e2e/install/cli/maven_ca_secret_test.go b/e2e/install/cli/maven_ca_secret_test.go
deleted file mode 100644
index fceb53c3e..000000000
--- a/e2e/install/cli/maven_ca_secret_test.go
+++ /dev/null
@@ -1,468 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cli
-
-import (
- "bufio"
- "bytes"
- "context"
- "crypto/rand"
- "crypto/rsa"
- "crypto/x509"
- "crypto/x509/pkix"
- "encoding/pem"
- "fmt"
- "math/big"
- "os"
- "strings"
- "testing"
- "time"
-
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/gstruct"
-
- appsv1 "k8s.io/api/apps/v1"
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
- "k8s.io/client-go/kubernetes/scheme"
- "k8s.io/client-go/tools/remotecommand"
-
- ctrl "sigs.k8s.io/controller-runtime/pkg/client"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
- "github.com/apache/camel-k/v2/pkg/util"
- "github.com/apache/camel-k/v2/pkg/util/maven"
-)
-
-func TestMavenCASecret(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- hostname := fmt.Sprintf("%s.%s.svc", "nexus", ns)
- tlsMountPath := "/etc/tls/private"
-
- // Generate the TLS certificate
- serialNumber := big.NewInt(util.RandomInt63())
- cert := &x509.Certificate{
- SerialNumber: serialNumber,
- Subject: pkix.Name{
- Organization: []string{"Camel K test"},
- },
- DNSNames: []string{hostname},
- NotBefore: time.Now(),
- NotAfter: time.Now().AddDate(1, 0, 0),
- ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
- KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
- BasicConstraintsValid: true,
- }
-
- // generate certPem private key
- certPrivateKey, err := rsa.GenerateKey(rand.Reader, 2048)
- g.Expect(err).To(BeNil())
-
- privateKeyBytes := x509.MarshalPKCS1PrivateKey(certPrivateKey)
- // encode for storing into secret
- privateKeyPem := pem.EncodeToMemory(
- &pem.Block{
- Type: "RSA PRIVATE KEY",
- Bytes: privateKeyBytes,
- },
- )
- certBytes, err := x509.CreateCertificate(rand.Reader, cert, cert, &certPrivateKey.PublicKey, certPrivateKey)
- g.Expect(err).To(BeNil())
-
- // encode for storing into secret
- certPem := pem.EncodeToMemory(&pem.Block{
- Type: "CERTIFICATE",
- Bytes: certBytes,
- })
-
- secret := &corev1.Secret{
- TypeMeta: metav1.TypeMeta{
- Kind: "Secret",
- APIVersion: corev1.SchemeGroupVersion.String(),
- },
- ObjectMeta: metav1.ObjectMeta{
- Namespace: ns,
- Name: "tls-secret",
- },
- Type: corev1.SecretTypeTLS,
- Data: map[string][]byte{
- corev1.TLSCertKey: certPem,
- corev1.TLSPrivateKeyKey: privateKeyPem,
- },
- }
- g.Expect(TestClient(t).Create(ctx, secret)).To(Succeed())
-
- // HTTPD configuration
- config := &corev1.ConfigMap{
- TypeMeta: metav1.TypeMeta{
- Kind: "ConfigMap",
- APIVersion: corev1.SchemeGroupVersion.String(),
- },
- ObjectMeta: metav1.ObjectMeta{
- Namespace: ns,
- Name: "httpd-config",
- },
- Data: map[string]string{
- "httpd.conf": fmt.Sprintf(`
-ServerRoot "/etc/httpd
-
-PidFile /var/run/httpd/httpd.pid"
-
-LoadModule mpm_event_module /usr/local/apache2/modules/mod_mpm_event.so
-LoadModule authn_core_module /usr/local/apache2/modules/mod_authn_core.so
-LoadModule authz_core_module /usr/local/apache2/modules/mod_authz_core.so
-LoadModule proxy_module /usr/local/apache2/modules/mod_proxy.so
-LoadModule proxy_http_module /usr/local/apache2/modules/mod_proxy_http.so
-LoadModule headers_module /usr/local/apache2/modules/mod_headers.so
-LoadModule setenvif_module /usr/local/apache2/modules/mod_setenvif.so
-LoadModule version_module /usr/local/apache2/modules/mod_version.so
-LoadModule log_config_module /usr/local/apache2/modules/mod_log_config.so
-LoadModule env_module /usr/local/apache2/modules/mod_env.so
-LoadModule unixd_module /usr/local/apache2/modules/mod_unixd.so
-LoadModule status_module /usr/local/apache2/modules/mod_status.so
-LoadModule autoindex_module /usr/local/apache2/modules/mod_autoindex.so
-LoadModule ssl_module /usr/local/apache2/modules/mod_ssl.so
-
-Mutex posixsem
-
-ErrorLog /proc/self/fd/2
-
-LogLevel warn
-
-Listen 8443
-
-ProxyRequests Off
-ProxyPreserveHost On
-
-<Directory />
- Options FollowSymLinks
- AllowOverride All
- Require all granted
-</Directory>
-
-<VirtualHost *:8443>
- SSLEngine on
-
- SSLCertificateFile "%s/%s"
- SSLCertificateKeyFile "%s/%s"
-
- AllowEncodedSlashes NoDecode
-
- ServerName %s
- ProxyPass / http://localhost:8081/ nocanon
- ProxyPassReverse / http://localhost:8081/
- RequestHeader set X-Forwarded-Proto "https"
-</VirtualHost>
-`,
- tlsMountPath, corev1.TLSCertKey, tlsMountPath, corev1.TLSPrivateKeyKey, hostname,
- ),
- },
- }
- g.Expect(TestClient(t).Create(ctx, config)).To(Succeed())
-
- // Deploy Nexus
- // https://help.sonatype.com/repomanager3/installation/run-behind-a-reverse-proxy
- deployment := &appsv1.Deployment{
- TypeMeta: metav1.TypeMeta{
- Kind: "Deployment",
- APIVersion: appsv1.SchemeGroupVersion.String(),
- },
- ObjectMeta: metav1.ObjectMeta{
- Namespace: ns,
- Name: "nexus",
- },
- Spec: appsv1.DeploymentSpec{
- Selector: &metav1.LabelSelector{
- MatchLabels: map[string]string{
- "camel-k": "maven-test-nexus",
- },
- },
- Template: corev1.PodTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "camel-k": "maven-test-nexus",
- },
- },
- Spec: corev1.PodSpec{
- Containers: []corev1.Container{
- {
- Name: "httpd",
- Image: "httpd:2.4.46",
- Command: []string{"httpd", "-f", "/etc/httpd/httpd.conf", "-DFOREGROUND"},
- Ports: []corev1.ContainerPort{
- {
- Name: "https",
- ContainerPort: 8443,
- },
- },
- VolumeMounts: []corev1.VolumeMount{
- {
- Name: "tls",
- MountPath: tlsMountPath,
- ReadOnly: true,
- },
- {
- Name: "httpd-conf",
- MountPath: "/etc/httpd",
- ReadOnly: true,
- },
- {
- Name: "httpd-run",
- MountPath: "/var/run/httpd",
- },
- },
- },
- {
- Name: "nexus",
- Image: "sonatype/nexus3:3.30.0",
- Ports: []corev1.ContainerPort{
- {
- Name: "nexus",
- ContainerPort: 8081,
- },
- },
- VolumeMounts: []corev1.VolumeMount{
- {
- Name: "nexus",
- MountPath: "/nexus-data",
- },
- },
- ReadinessProbe: &corev1.Probe{
- InitialDelaySeconds: 30,
- FailureThreshold: 3,
- ProbeHandler: corev1.ProbeHandler{
- HTTPGet: &corev1.HTTPGetAction{
- Port: intstr.FromString("nexus"),
- Path: "/repository/maven-public/",
- },
- },
- },
- },
- },
- Volumes: []corev1.Volume{
- {
- Name: "tls",
- VolumeSource: corev1.VolumeSource{
- Secret: &corev1.SecretVolumeSource{
- SecretName: secret.Name,
- },
- },
- },
- {
- Name: "httpd-conf",
- VolumeSource: corev1.VolumeSource{
- ConfigMap: &corev1.ConfigMapVolumeSource{
- LocalObjectReference: corev1.LocalObjectReference{
- Name: config.Name,
- },
- },
- },
- },
- {
- Name: "httpd-run",
- VolumeSource: corev1.VolumeSource{
- EmptyDir: &corev1.EmptyDirVolumeSource{},
- },
- },
- {
- Name: "nexus",
- VolumeSource: corev1.VolumeSource{
- EmptyDir: &corev1.EmptyDirVolumeSource{},
- },
- },
- },
- },
- },
- },
- }
- g.Expect(TestClient(t).Create(ctx, deployment)).To(Succeed())
-
- service := &corev1.Service{
- TypeMeta: metav1.TypeMeta{
- Kind: "Service",
- APIVersion: corev1.SchemeGroupVersion.String(),
- },
- ObjectMeta: metav1.ObjectMeta{
- Namespace: ns,
- Name: deployment.Name,
- },
- Spec: corev1.ServiceSpec{
- Selector: deployment.Spec.Template.Labels,
- Ports: []corev1.ServicePort{
- {
- Name: "https",
- Port: 443,
- TargetPort: intstr.FromString("https"),
- },
- },
- },
- }
- g.Expect(TestClient(t).Create(ctx, service)).To(Succeed())
-
- // Wait for the Deployment to become ready
- g.Eventually(Deployment(t, ctx, ns, deployment.Name), TestTimeoutMedium).Should(PointTo(MatchFields(IgnoreExtras,
- Fields{
- "Status": MatchFields(IgnoreExtras,
- Fields{
- "ReadyReplicas": Equal(int32(1)),
- }),
- }),
- ))
-
- // Get the Nexus Pod
- pods := &corev1.PodList{
- TypeMeta: metav1.TypeMeta{
- Kind: "Pod",
- APIVersion: corev1.SchemeGroupVersion.String(),
- },
- }
- g.Expect(TestClient(t).List(ctx, pods,
- ctrl.InNamespace(ns),
- ctrl.MatchingLabels{"camel-k": "maven-test-nexus"},
- )).To(Succeed())
- g.Expect(pods.Items).To(HaveLen(1))
-
- // Retrieve the Nexus admin password
- req := TestClient(t).CoreV1().RESTClient().Post().
- Resource("pods").
- Name(pods.Items[0].Name).
- Namespace(ns).
- SubResource("exec").
- Param("container", "nexus")
-
- req.VersionedParams(&corev1.PodExecOptions{
- Container: "nexus",
- Command: []string{"cat", "/nexus-data/admin.password"},
- Stdout: true,
- Stderr: true,
- TTY: false,
- }, scheme.ParameterCodec)
-
- exec, err := remotecommand.NewSPDYExecutor(TestClient(t).GetConfig(), "POST", req.URL())
- g.Expect(err).To(BeNil())
-
- var password bytes.Buffer
- g.Expect(exec.Stream(remotecommand.StreamOptions{
- Stdout: bufio.NewWriter(&password),
- Stderr: os.Stderr,
- Tty: false,
- })).To(Succeed())
-
- // Create the Apache Snapshot proxy repository using the Nexus REST API
- req = TestClient(t).CoreV1().RESTClient().Post().
- Resource("pods").
- Name(pods.Items[0].Name).
- Namespace(ns).
- SubResource("exec").
- Param("container", "nexus")
-
- // Rely on the Camel K staging repository, that can either be Apache Staging,
- // during releases preparation, or Apache Snapshots otherwise.
- stagingRepositoryUrl := os.Getenv("KAMEL_INSTALL_MAVEN_REPOSITORIES")
- if stagingRepositoryUrl == "" {
- stagingRepositoryUrl = "https://repository.apache.org/content/repositories/snapshots/@id=apache-snapshots@snapshots@noreleases"
- }
- stagingRepository := maven.NewRepository(stagingRepositoryUrl)
- if stagingRepository.ID == "" {
- stagingRepository.ID = "staging"
- }
- versionPolicy := ""
- if stagingRepository.Releases.Enabled && stagingRepository.Snapshots.Enabled {
- versionPolicy = "MIXED"
- } else if stagingRepository.Releases.Enabled {
- versionPolicy = "RELEASE"
- } else {
- versionPolicy = "SNAPSHOT"
- }
-
- repository := fmt.Sprintf(`{"name":"%s","proxy":{"remoteUrl":"%s","contentMaxAge":1440,"metadataMaxAge":1440},"online":true,"maven":{"versionPolicy":"%s","layoutPolicy":"PERMISSIVE"},"negativeCache":{"enabled":false,"timeToLive":1440},"httpClient":{"autoBlock":false,"blocked":false},"storage":{"strictContentTypeValidation":true,"blobStoreName":"default"}}`, stagingRepository.ID, stagingRepository.URL, versionPolicy)
-
- req.VersionedParams(&corev1.PodExecOptions{
- Container: "nexus",
- Command: []string{"curl",
- "-u", "admin:" + password.String(),
- "-H", "Content-Type: application/json",
- "--data", repository,
- "http://localhost:8081/service/rest/v1/repositories/maven/proxy/"},
- Stdout: true,
- Stderr: true,
- TTY: false,
- }, scheme.ParameterCodec)
-
- exec, err = remotecommand.NewSPDYExecutor(TestClient(t).GetConfig(), "POST", req.URL())
- g.Expect(err).To(BeNil())
-
- g.Expect(exec.Stream(remotecommand.StreamOptions{
- Stdout: os.Stdout,
- Stderr: os.Stderr,
- Tty: false,
- })).To(Succeed())
-
- // Install Camel K with the Maven Central Nexus proxy and the corresponding Maven CA secret
- operatorID := "camel-k-maven-ca-secret"
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--maven-repository", fmt.Sprintf(`https://%s/repository/maven-public/@id=central-internal@mirrorOf=central`, hostname), "--maven-repository", fmt.Sprintf(`https://%s/repository/%s/%s`, hostname, stagingRepository.ID, strings.Join(getRepositoryAttributes(stagingRepository), "")), "--maven-ca-secret", secret.Name+"/"+corev1.TLSCertKey, "--maven-cli-option", "--batch-mode")).To(Succeed())
-
- g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
-
- // Run the Integration
- name := RandomizedSuffixName("java")
- 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), TestTimeoutLong).Should(ContainSubstring("Magicstring!"))
-
- // Assert no dependencies have been downloaded from the Maven central repository
- // Note: this should be adapted for the Pod build strategy
- pod := OperatorPod(t, ctx, ns)()
- g.Expect(pod).NotTo(BeNil())
-
- // pod.Namespace could be different from ns if using global operator
- logs := Logs(t, ctx, pod.Namespace, pod.Name, corev1.PodLogOptions{})()
- g.Expect(logs).NotTo(BeEmpty())
- g.Expect(logs).NotTo(ContainSubstring("Downloaded from central:"))
-
- // Clean up
- 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())
- })
-}
-
-func getRepositoryAttributes(repository v1.Repository) []string {
- var attributes []string
- if repository.ID != "" {
- attributes = append(attributes, "@id="+repository.ID)
- }
- if !repository.Releases.Enabled {
- attributes = append(attributes, "@noreleases")
- }
- if repository.Snapshots.Enabled {
- attributes = append(attributes, "@snapshots")
- }
- return attributes
-}
diff --git a/e2e/install/cli/uninstall_test.go b/e2e/install/cli/uninstall_test.go
deleted file mode 100644
index ee38cac6d..000000000
--- a/e2e/install/cli/uninstall_test.go
+++ /dev/null
@@ -1,158 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cli
-
-import (
- "context"
- "fmt"
- "testing"
-
- . "github.com/onsi/gomega"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
- "github.com/apache/camel-k/v2/pkg/util/olm"
-)
-
-func TestBasicUninstall(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- // a successful new installation
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
- g.Eventually(DefaultCamelCatalogPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.CamelCatalogPhaseReady))
-
- // should be completely removed on uninstall
- g.Expect(Kamel(t, ctx, "uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles").Execute()).To(Succeed())
-
- // Roles only removed in non-olm use-case
- uninstallViaOLM := false
- var err error
- if uninstallViaOLM, err = olm.IsAPIAvailable(TestClient(t)); err != nil {
- t.Error(err)
- t.FailNow()
- }
-
- if !uninstallViaOLM {
- g.Eventually(Role(t, ctx, ns)).Should(BeNil())
- g.Eventually(RoleBinding(t, ctx, ns)).Should(BeNil())
- g.Eventually(ServiceAccount(t, ctx, ns, "camel-k-operator")).Should(BeNil())
- } else {
- g.Eventually(Role(t, ctx, ns)).ShouldNot(BeNil())
- g.Eventually(RoleBinding(t, ctx, ns)).ShouldNot(BeNil())
- }
-
- g.Eventually(Configmap(t, ctx, ns, "camel-k-maven-settings")).Should(BeNil())
- g.Eventually(OperatorPod(t, ctx, ns), TestTimeoutMedium).Should(BeNil())
- g.Eventually(KameletList(t, ctx, ns), TestTimeoutMedium).Should(BeEmpty())
- g.Eventually(CamelCatalogList(t, ctx, ns), TestTimeoutMedium).Should(BeEmpty())
- })
-}
-
-func TestUninstallSkipOperator(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- // a successful new installation
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
- // on uninstall it should remove everything except operator
- g.Expect(Kamel(t, ctx, "uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-operator").Execute()).To(Succeed())
- g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
- })
-}
-
-func TestUninstallSkipRole(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- // a successful new installation
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--olm=false")).To(Succeed())
- g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
- // on uninstall it should remove everything except roles
- g.Expect(Kamel(t, ctx, "uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-roles").Execute()).To(Succeed())
- g.Eventually(Role(t, ctx, ns)).ShouldNot(BeNil())
- })
-}
-
-func TestUninstallSkipRoleBinding(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- // a successful new installation
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--olm=false")).To(Succeed())
- g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
- // on uninstall it should remove everything except role-bindings
- g.Expect(Kamel(t, ctx, "uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-role-bindings").Execute()).To(Succeed())
- g.Eventually(RoleBinding(t, ctx, ns)).ShouldNot(BeNil())
- })
-}
-
-func TestUninstallSkipServiceAccounts(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- // a successful new installation
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--olm=false")).To(Succeed())
- g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
- // on uninstall it should remove everything except cluster-roles
- g.Expect(Kamel(t, ctx, "uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-service-accounts").Execute()).To(Succeed())
- g.Eventually(ServiceAccount(t, ctx, ns, "camel-k-operator")).ShouldNot(BeNil())
- })
-}
-
-func TestUninstallSkipIntegrationPlatform(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- // a successful new installation
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
- // on uninstall it should remove everything except cluster-roles
- // NOTE: skip CRDs is also required in addition to skip integration platform
- g.Expect(Kamel(t, ctx, "uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-integration-platform").Execute()).To(Succeed())
- g.Eventually(Platform(t, ctx, ns)).ShouldNot(BeNil())
- })
-}
-
-func TestUninstallSkipKamelets(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- // a successful new installation
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithIDAndKameletCatalog(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
- g.Eventually(KameletList(t, ctx, ns)).ShouldNot(BeEmpty())
- // on uninstall it should remove everything except kamelets
- g.Expect(Kamel(t, ctx, "uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-kamelets").Execute()).To(Succeed())
- g.Eventually(KameletList(t, ctx, ns)).ShouldNot(BeEmpty())
- })
-}
-
-func TestUninstallSkipCamelCatalogs(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- // a successful new installation
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
- g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
- g.Eventually(CamelCatalogList(t, ctx, ns)).ShouldNot(BeEmpty())
- // on uninstall it should remove everything except camel catalogs
- g.Expect(Kamel(t, ctx, "uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-camel-catalogs").Execute()).To(Succeed())
- g.Eventually(CamelCatalogList(t, ctx, ns)).ShouldNot(BeEmpty())
-
- })
-}
diff --git a/e2e/knative/kamelet_test.go b/e2e/knative/kamelet_test.go
index 4aad5864a..341a885a5 100644
--- a/e2e/knative/kamelet_test.go
+++ b/e2e/knative/kamelet_test.go
@@ -45,7 +45,7 @@ func TestKameletChange(t *testing.T) {
knChannel := "test-kamelet-messages"
knChannelConf := fmt.Sprintf("%s:InMemoryChannel:%s", messaging.SchemeGroupVersion.String(), knChannel)
timerSource := "my-timer-source"
- g.Expect(CreateTimerKamelet(t, ctx, operatorID, ns, timerSource)()).To(Succeed())
+ g.Expect(CreateTimerKameletWithID(t, ctx, operatorID, ns, timerSource)()).To(Succeed())
g.Expect(CreateKnativeChannel(t, ctx, ns, knChannel)()).To(Succeed())
// Consumer route that will read from the Knative channel
g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/test-kamelet-display.yaml", "-w").Execute()).To(Succeed())
diff --git a/e2e/native/native_binding_test.go b/e2e/native/native_binding_test.go
deleted file mode 100644
index 2fd73578b..000000000
--- a/e2e/native/native_binding_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package native
-
-import (
- "context"
- "testing"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
- . "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
-)
-
-func TestNativeBinding(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-native-binding"
- g.Expect(KamelInstallWithIDAndKameletCatalog(t, ctx, operatorID, ns, "--build-timeout", "90m0s", "--maven-cli-option", "-Dquarkus.native.native-image-xmx=6g")).To(Succeed())
- g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
- message := "Magicstring!"
- t.Run("binding with native build", func(t *testing.T) {
- bindingName := "native-binding"
- g.Expect(KamelBindWithID(t, ctx, operatorID, ns, "timer-source", "log-sink", "-p", "source.message="+message,
- "--trait", "quarkus.build-mode=native", "--trait", "builder.tasks-limit-memory=quarkus-native:6.5Gi",
- "--name", bindingName).Execute()).To(Succeed())
-
- // ====================================
- // !!! THE MOST TIME-CONSUMING PART !!!
- // ====================================
- g.Eventually(Kits(t, ctx, ns, withNativeLayout, KitWithPhase(v1.IntegrationKitPhaseReady)),
- TestTimeoutVeryLong).Should(HaveLen(1))
-
- nativeKit := Kits(t, ctx, ns, withNativeLayout, KitWithPhase(v1.IntegrationKitPhaseReady))()[0]
- g.Eventually(IntegrationKit(t, ctx, ns, bindingName), TestTimeoutShort).Should(Equal(nativeKit.Name))
-
- g.Eventually(IntegrationPodPhase(t, ctx, ns, bindingName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, ns, bindingName), TestTimeoutShort).Should(ContainSubstring(message))
-
- g.Eventually(IntegrationPod(t, ctx, ns, bindingName), TestTimeoutShort).
- Should(WithTransform(getContainerCommand(),
- MatchRegexp(".*camel-k-integration-\\d+\\.\\d+\\.\\d+[-A-Za-z]*-runner.*")))
-
- // Clean up
- g.Expect(Kamel(t, ctx, "delete", bindingName, "-n", ns).Execute()).To(Succeed())
- g.Expect(DeleteKits(t, ctx, ns)).To(Succeed())
- })
- })
-}
diff --git a/e2e/native/native_test.go b/e2e/native/native_test.go
index e1f751890..beb2fe0a0 100644
--- a/e2e/native/native_test.go
+++ b/e2e/native/native_test.go
@@ -37,13 +37,9 @@ import (
func TestNativeIntegrations(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-quarkus-native"
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--build-timeout", "90m0s", "--maven-cli-option", "-Dquarkus.native.native-image-xmx=6g")).To(Succeed())
- g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
-
t.Run("unsupported integration source language", func(t *testing.T) {
name := RandomizedSuffixName("unsupported-js")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/JavaScript.js", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:6.5Gi").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/JavaScript.js", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:6.5Gi").Execute()).To(Succeed())
g.Eventually(IntegrationPhase(t, ctx, ns, name)).Should(Equal(v1.IntegrationPhaseError))
g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionKitAvailable)).
@@ -56,14 +52,11 @@ func TestNativeIntegrations(t *testing.T) {
g.Expect(quarkusTrait).ToNot(BeNil())
g.Expect(len(quarkusTrait)).To(Equal(1))
g.Expect(quarkusTrait["buildMode"]).ToNot(BeNil())
-
- // Clean up
- g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
})
t.Run("xml native support", func(t *testing.T) {
name := RandomizedSuffixName("xml-native")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Xml.xml", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:6.5Gi").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Xml.xml", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:6.5Gi").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutVeryLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationPod(t, ctx, ns, name), TestTimeoutShort).
@@ -72,16 +65,11 @@ func TestNativeIntegrations(t *testing.T) {
Should(Equal(corev1.ConditionTrue))
g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("XML Magicstring!"))
-
- // Clean up
- g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
})
t.Run("automatic rollout deployment from jvm to native kit", func(t *testing.T) {
- // Let's make sure we start from a clean state
- g.Expect(DeleteKits(t, ctx, ns)).To(Succeed())
name := RandomizedSuffixName("yaml-native")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml", "--name", name, "-t", "quarkus.build-mode=jvm", "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:6.5Gi").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/yaml.yaml", "--name", name, "-t", "quarkus.build-mode=jvm", "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:6.5Gi").Execute()).To(Succeed())
// Check that two Kits are created with distinct layout
g.Eventually(Kits(t, ctx, ns, withFastJarLayout)).Should(HaveLen(1))
@@ -106,9 +94,6 @@ func TestNativeIntegrations(t *testing.T) {
g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutMedium).Should(ContainSubstring("Magicstring!"))
- // ====================================
- // !!! THE MOST TIME-CONSUMING PART !!!
- // ====================================
// Check the native Kit is ready
g.Eventually(Kits(t, ctx, ns, withNativeLayout, KitWithPhase(v1.IntegrationKitPhaseReady)),
TestTimeoutVeryLong).Should(HaveLen(1))
@@ -130,7 +115,7 @@ func TestNativeIntegrations(t *testing.T) {
t.Run("yaml native should not rebuild", func(t *testing.T) {
name := RandomizedSuffixName("yaml-native-2")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml2.yaml", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:6.5Gi").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/yaml2.yaml", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:6.5Gi").Execute()).To(Succeed())
// This one should run quickly as it suppose to reuse an IntegrationKit
g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(corev1.PodRunning))
@@ -141,10 +126,32 @@ func TestNativeIntegrations(t *testing.T) {
g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!2"))
g.Eventually(IntegrationKit(t, ctx, ns, "yaml-native-2")).Should(Equal(IntegrationKit(t, ctx, ns, "yaml-native")()))
})
-
- // Clean up
- g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
})
})
}
+
+func TestNativeBinding(t *testing.T) {
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ message := "Magicstring!"
+ t.Run("binding with native build", func(t *testing.T) {
+ bindingName := "native-binding"
+ g.Expect(KamelBind(t, ctx, ns, "timer-source", "log-sink", "-p", "source.message="+message,
+ "--trait", "quarkus.build-mode=native", "--trait", "builder.tasks-limit-memory=quarkus-native:6.5Gi",
+ "--name", bindingName).Execute()).To(Succeed())
+
+ g.Eventually(Kits(t, ctx, ns, withNativeLayout, KitWithPhase(v1.IntegrationKitPhaseReady)),
+ TestTimeoutVeryLong).Should(HaveLen(1))
+
+ nativeKit := Kits(t, ctx, ns, withNativeLayout, KitWithPhase(v1.IntegrationKitPhaseReady))()[0]
+ g.Eventually(IntegrationKit(t, ctx, ns, bindingName), TestTimeoutShort).Should(Equal(nativeKit.Name))
+
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, bindingName), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, bindingName), TestTimeoutShort).Should(ContainSubstring(message))
+
+ g.Eventually(IntegrationPod(t, ctx, ns, bindingName), TestTimeoutShort).
+ Should(WithTransform(getContainerCommand(),
+ MatchRegexp(".*camel-k-integration-\\d+\\.\\d+\\.\\d+[-A-Za-z]*-runner.*")))
+ })
+ })
+}
diff --git a/e2e/native/native_with_sources_test.go b/e2e/native/native_with_sources_test.go
index dcfe148b3..6d3a950bc 100644
--- a/e2e/native/native_with_sources_test.go
+++ b/e2e/native/native_with_sources_test.go
@@ -35,17 +35,13 @@ import (
func TestNativeHighMemoryIntegrations(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- operatorID := "camel-k-quarkus-high-memory-native"
- g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--build-timeout", "90m0s", "--maven-cli-option", "-Dquarkus.native.native-image-xmx=9g")).To(Succeed())
- g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
-
javaNativeName := RandomizedSuffixName("java-native")
javaNativeCloneName := RandomizedSuffixName("java-native-clone")
javaNative2Name := RandomizedSuffixName("java-native-2")
t.Run("java native support", func(t *testing.T) {
name := javaNativeName
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:9.5Gi").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:9.5Gi").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutVeryLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationPod(t, ctx, ns, name), TestTimeoutShort).
@@ -56,7 +52,7 @@ func TestNativeHighMemoryIntegrations(t *testing.T) {
t.Run("java native same should not rebuild", func(t *testing.T) {
name := javaNativeCloneName
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:9.5Gi").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:9.5Gi").Execute()).To(Succeed())
// This one should run quickly as it suppose to reuse an IntegrationKit
g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutShort).Should(Equal(corev1.PodRunning))
@@ -70,7 +66,7 @@ func TestNativeHighMemoryIntegrations(t *testing.T) {
t.Run("java native should rebuild", func(t *testing.T) {
name := javaNative2Name
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java2.java", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:9.5Gi").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Java2.java", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:9.5Gi").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutVeryLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationPod(t, ctx, ns, name), TestTimeoutShort).
@@ -81,13 +77,11 @@ func TestNativeHighMemoryIntegrations(t *testing.T) {
g.Eventually(IntegrationKit(t, ctx, ns, javaNative2Name)).ShouldNot(Equal(IntegrationKit(t, ctx, ns, javaNativeName)()))
})
- // Clean up
- g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
})
t.Run("groovy native support", func(t *testing.T) {
name := RandomizedSuffixName("groovy-native")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Groovy.groovy", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:9.5Gi").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Groovy.groovy", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:9.5Gi").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutVeryLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationPod(t, ctx, ns, name), TestTimeoutShort).
@@ -96,14 +90,11 @@ func TestNativeHighMemoryIntegrations(t *testing.T) {
Should(Equal(corev1.ConditionTrue))
g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Groovy Magicstring!"))
-
- // Clean up
- g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
})
t.Run("kotlin native support", func(t *testing.T) {
name := RandomizedSuffixName("kotlin-native")
- g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Kotlin.kts", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:9.5Gi").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/Kotlin.kts", "--name", name, "-t", "quarkus.build-mode=native", "-t", "builder.tasks-limit-memory=quarkus-native:9.5Gi").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutVeryLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationPod(t, ctx, ns, name), TestTimeoutShort).
@@ -112,9 +103,6 @@ func TestNativeHighMemoryIntegrations(t *testing.T) {
Should(Equal(corev1.ConditionTrue))
g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Kotlin Magicstring!"))
-
- // Clean up
- g.Expect(Kamel(t, ctx, "delete", name, "-n", ns).Execute()).To(Succeed())
})
})
}
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index a784263c0..5c13723f2 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -66,17 +66,12 @@ import (
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
- logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
eventing "knative.dev/eventing/pkg/apis/eventing/v1"
messaging "knative.dev/eventing/pkg/apis/messaging/v1"
servingv1 "knative.dev/serving/pkg/apis/serving/v1"
- configv1 "github.com/openshift/api/config/v1"
- projectv1 "github.com/openshift/api/project/v1"
- routev1 "github.com/openshift/api/route/v1"
-
"github.com/apache/camel-k/v2/e2e/support/util"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
@@ -93,6 +88,10 @@ import (
"github.com/apache/camel-k/v2/pkg/util/log"
"github.com/apache/camel-k/v2/pkg/util/openshift"
"github.com/apache/camel-k/v2/pkg/util/patch"
+ configv1 "github.com/openshift/api/config/v1"
+ projectv1 "github.com/openshift/api/project/v1"
+ routev1 "github.com/openshift/api/route/v1"
+ logf "sigs.k8s.io/controller-runtime/pkg/log"
// let's enable addons in all tests
_ "github.com/apache/camel-k/v2/addons"
@@ -145,6 +144,11 @@ var testClient client.Client
var testSetupMutex = sync.Mutex{}
var kamelInstallMutex = sync.Mutex{}
+func init() {
+ // This line prevents controller-runtime from complaining about log.SetLogger never being called
+ logf.SetLogger(zap.New(zap.UseDevMode(true)))
+}
+
// Only panic the test if absolutely necessary and there is
// no test locus. In most cases, the test should fail gracefully
// using the test locus to error out and fail now.
@@ -285,9 +289,6 @@ func KamelInstallWithIDAndKameletCatalog(t *testing.T, ctx context.Context, oper
}
func kamelInstallWithContext(t *testing.T, ctx context.Context, operatorID string, namespace string, skipKameletCatalog bool, args ...string) error {
- // This line prevents controller-runtime from complaining about log.SetLogger never being called
- logf.SetLogger(zap.New(zap.UseDevMode(true)))
-
kamelInstallMutex.Lock()
defer kamelInstallMutex.Unlock()
@@ -389,8 +390,6 @@ func KamelBindWithContext(t *testing.T, ctx context.Context, operatorID string,
}
func KamelCommandWithContext(t *testing.T, ctx context.Context, command string, operatorID string, namespace string, args ...string) *cobra.Command {
- // This line prevents controller-runtime from complaining about log.SetLogger never being called
- logf.SetLogger(zap.New(zap.UseDevMode(true)))
var cmdArgs []string
cmdArgs = []string{command, "-n", namespace, "--operator-id", operatorID}
@@ -2796,7 +2795,11 @@ func CreateKnativeBroker(t *testing.T, ctx context.Context, ns string, name stri
Kamelets
*/
-func CreateKamelet(t *testing.T, operatorID string, ctx context.Context, ns string, name string, template map[string]interface{}, properties map[string]v1.JSONSchemaProp, labels map[string]string) func() error {
+func CreateKamelet(t *testing.T, ctx context.Context, ns string, name string, template map[string]interface{}, properties map[string]v1.JSONSchemaProp, labels map[string]string) func() error {
+ return CreateKameletWithID(t, platform.DefaultPlatformName, ctx, ns, name, template, properties, labels)
+}
+
+func CreateKameletWithID(t *testing.T, operatorID string, ctx context.Context, ns string, name string, template map[string]interface{}, properties map[string]v1.JSONSchemaProp, labels map[string]string) func() error {
return func() error {
kamelet := v1.Kamelet{
ObjectMeta: metav1.ObjectMeta{
@@ -2817,7 +2820,11 @@ func CreateKamelet(t *testing.T, operatorID string, ctx context.Context, ns stri
}
}
-func CreateTimerKamelet(t *testing.T, ctx context.Context, operatorID string, ns string, name string) func() error {
+func CreateTimerKamelet(t *testing.T, ctx context.Context, ns string, name string) func() error {
+ return CreateTimerKameletWithID(t, ctx, platform.DefaultPlatformName, ns, name)
+}
+
+func CreateTimerKameletWithID(t *testing.T, ctx context.Context, operatorID string, ns string, name string) func() error {
props := map[string]v1.JSONSchemaProp{
"message": {
Type: "string",
@@ -2840,7 +2847,7 @@ func CreateTimerKamelet(t *testing.T, ctx context.Context, operatorID string, ns
},
}
- return CreateKamelet(t, operatorID, ctx, ns, name, flow, props, nil)
+ return CreateKameletWithID(t, operatorID, ctx, ns, name, flow, props, nil)
}
func DeleteKamelet(t *testing.T, ctx context.Context, ns string, name string) error {
@@ -3193,7 +3200,7 @@ func GetOutputStringAsync(cmd *cobra.Command) func() string {
}
}
-func CreateLogKamelet(t *testing.T, ctx context.Context, operatorID string, ns string, name string) func() error {
+func CreateLogKamelet(t *testing.T, ctx context.Context, ns string, name string) func() error {
flow := map[string]interface{}{
"from": map[string]interface{}{
"uri": "kamelet:source",
@@ -3211,7 +3218,7 @@ func CreateLogKamelet(t *testing.T, ctx context.Context, operatorID string, ns s
},
}
- return CreateKamelet(t, operatorID, ctx, ns, name, flow, props, nil)
+ return CreateKamelet(t, ctx, ns, name, flow, props, nil)
}
func GetCIProcessID() string {
diff --git a/script/Makefile b/script/Makefile
index a1c8abc06..018a812d1 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -105,7 +105,7 @@ KAMELET_CATALOG_REPO_TAG := v4.0.1
DO_TEST_PREBUILD ?= true
TEST_PREBUILD = build
# Tests may run in parallel to each other. This count sets the amount of tests run in parallel. (default value usually is GOMAXPROCS)
-TEST_COMMON_PARALLEL_COUNT ?= 4
+TEST_COMMON_PARALLEL_COUNT ?= 1
TEST_ADVANCED_PARALLEL_COUNT ?= 4
# OLM (Operator Lifecycle Manager and Operator Hub): uncomment to override operator settings at build time
@@ -282,15 +282,15 @@ setup-yaks:
# Common tests that do not require any customized operator setting. They can leverage a unique namespaced operator installation to reduce
# the time to complete (they are used also as smoke test for nightly release)
#
-test-common: do-build
+test-common:
FAILED=0; STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \
- go test -timeout 90m -v ./e2e/common/... -tags=integration -parallel=$(TEST_COMMON_PARALLEL_COUNT) $(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || ((FAILED++)); \
+ go test -p $(TEST_COMMON_PARALLEL_COUNT) -timeout 90m -v ./e2e/common/... -tags=integration $(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || ((FAILED++)); \
exit $${FAILED}
#
# Smoke tests are a subset of common tests used to quickly verify the operator
#
-test-smoke: do-build
+test-smoke:
TEST_SKIP_AFTER_FAILURE_COUNT="$(TEST_SKIP_AFTER_FAILURE_COUNT)"; \
if [[ $$TEST_SKIP_AFTER_FAILURE_COUNT = "" ]]; then \
TEST_SKIP_AFTER_FAILURE_COUNT=0; \
@@ -322,7 +322,7 @@ test-smoke: do-build
#
# Common tests that require some particular operator setting or need to be installed in multiple namespaces
#
-test-advanced: do-build
+test-advanced:
FAILED=0; STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \
go test -timeout 90m -v ./e2e/advanced -tags=integration -parallel=$(TEST_ADVANCED_PARALLEL_COUNT) $(TEST_INSTALL_RUN) $(GOTESTFMT) || ((FAILED++)); \
exit $${FAILED}
@@ -330,9 +330,8 @@ test-advanced: do-build
#
# Installation procedure test using CLi and Kustomize methodologies
#
-test-install: do-build
+test-install:
FAILED=0; STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \
- go test -timeout 40m -v ./e2e/install/cli -tags=integration $(TEST_INSTALL_RUN) $(GOTESTFMT) || ((FAILED++)); \
go test -timeout 40m -v ./e2e/install/kustomize -tags=integration $(TEST_INSTALL_RUN) $(GOTESTFMT) || ((FAILED++)); \
go test -timeout 60m -v ./e2e/install/helm -tags=integration $(TEST_INSTALL_RUN) $(GOTESTFMT) || ((FAILED++)); \
exit $${FAILED}
@@ -340,21 +339,21 @@ test-install: do-build
#
# Installation procedure test using OLM (requires cluster to be setup accordingly)
#
-test-install-olm: do-build
+test-install-olm:
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \
go test -timeout 30m -v ./e2e/install/olm -tags=integration $(TEST_INSTALL_RUN) $(GOTESTFMT)
#
# Upgrade procedure test (requires cluster to be setup accordingly, ie OLM)
#
-test-install-upgrade: do-build
+test-install-upgrade:
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \
go test -timeout 30m -v ./e2e/install/upgrade -tags=integration $(TEST_INSTALL_RUN) $(GOTESTFMT)
#
# Knative tests that require the presence of Knative configuration
#
-test-knative: do-build
+test-knative:
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \
go test -timeout 60m -v ./e2e/knative -tags=integration $(TEST_KNATIVE_RUN) $(GOTESTFMT) || ((FAILED++)); \
exit $${FAILED}
@@ -362,21 +361,21 @@ test-knative: do-build
#
# Builder tests that require a custom build strategy
#
-test-builder: do-build
+test-builder:
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \
go test -timeout 30m -v ./e2e/builder -tags=integration $(TEST_BUILDER_RUN) $(GOTESTFMT)
#
# Telemetry tests that require the configuration of telemetry endpoints
#
-test-telemetry: do-build
+test-telemetry:
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
go test -timeout 30m -v ./e2e/telemetry -tags=integration $(TEST_TELEMETRY_RUN) $(GOTESTFMT)
#
# Quarkus native test (requires certain CPU and memory conditions)
#
-test-quarkus-native: do-build
+test-quarkus-native:
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
go test -timeout 180m -v ./e2e/native -tags=integration $(TEST_QUARKUS_RUN) $(GOTESTFMT)
@@ -785,31 +784,33 @@ DEFAULT_NS = "camel-k"
.PHONY: install install-k8s-global install-k8s-ns install-openshift-global install-openshift-ns
install-operator:
+ @echo "####### Installing operator..."
ifndef NAMESPACE
@echo "WARN: no namespace specified, using default namespace $(DEFAULT_NS)"
$(eval NAMESPACE=$(DEFAULT_NS))
endif
cd $(KUSTOMIZE_DIR) && kustomize edit set namespace $(NAMESPACE)
cd install/overlays/platform && kustomize edit set namespace $(NAMESPACE)
- kubectl apply -k $(KUSTOMIZE_DIR) --server-side
+ kubectl apply -k $(KUSTOMIZE_DIR) --server-side --force-conflicts
install-registry:
+ @echo "####### Installing container registry..."
ifdef REGISTRY
@echo "INFO: Setting IntegrationPlatform container registry to $(REGISTRY)"
@sed -i 's/address: .*/address: $(REGISTRY)/' install/overlays/platform/integration-platform.yaml
- kubectl apply -k install/overlays/platform --server-side -n $(NAMESPACE)
+ kubectl apply -k install/overlays/platform --server-side -n $(NAMESPACE) --force-conflicts
else
# verify if a minikube registry is existing by any chance, and set it automatically in such a case
ifneq ($(MINIKUBE_REGISTRY), "")
@echo "INFO: Looks like you're on Minikube. Setting IntegrationPlatform container registry to $(MINIKUBE_REGISTRY)"
@sed -i 's/address: .*/address: $(MINIKUBE_REGISTRY)/' install/overlays/platform/integration-platform.yaml
- kubectl apply -k install/overlays/platform --server-side -n $(NAMESPACE)
+ kubectl apply -k install/overlays/platform --server-side -n $(NAMESPACE) --force-conflicts
endif
endif
install-clean-kustomize:
# we must revert any change done by Kustomize in order to avoid they are committed by mistake in source code repository
- @echo "INFO: reverting changes done by Kustomization"
+ @echo "INFO: reverting git changes done by Kustomization"
git checkout -- install/overlays/platform/kustomization.yaml
git checkout -- install/overlays/platform/integration-platform.yaml
git checkout -- $(KUSTOMIZE_DIR)/kustomization.yaml