You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2022/10/07 03:48:02 UTC
[camel-k] branch main updated (0a12fb4a1 -> d82ae431e)
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
from 0a12fb4a1 chore: add test-fmt make target
new d9ad23dce fix(bundle-index-gen): Improves generation of bundle index
new 11ea8f616 fix(platform) Incorrect order of parameters
new eed9cbeab fix(bundle): Small fixes for bundle generation
new 53e6ceee0 (e2e): Improvements for testing
new f9637d675 (e2e): Mark KameletClasspathLoading test as temporarily problematic
new 62dee44e4 (e2e): Refactor config test
new 7591e0fb7 (e2e): check if namespace already exists
new 70e731405 (e2e): Modify error of operator uninstall to warning
new ef5c8f598 (e2e): Exposes maven-cli-options to allow maven build debugging
new 9257d478c (e2e): Increases the download dependency timeout
new 667d4c1c0 (e2e): Splits the TestKamelCLIRun tests
new 69ded0727 fix(e2e): Replaces update scale with patch scale
new d82ae431e fix(e2e): Stop go panic if pod or pod status is not initialised
The 13 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.github/actions/e2e-builder/action.yml | 1 +
.github/actions/e2e-builder/exec-tests.sh | 9 +-
.github/actions/e2e-common/action.yml | 1 +
.github/actions/e2e-common/exec-tests.sh | 9 +-
.github/actions/e2e-install/action.yml | 1 +
.github/actions/e2e-install/exec-tests.sh | 9 +-
.github/actions/e2e-knative-yaks/action.yml | 1 +
.github/actions/e2e-knative-yaks/exec-tests.sh | 9 +-
.github/actions/e2e-knative/action.yml | 1 +
.github/actions/e2e-knative/exec-tests.sh | 9 +-
.github/actions/e2e-upgrade/action.yml | 1 +
.github/actions/e2e-upgrade/exec-tests.sh | 9 +-
.../kamel-build-bundle/build-bundle-image.sh | 12 +-
.../kamel-build-bundle/build-index-image.sh | 2 +-
.../kamel-cleanup/uninstall-global-operator.sh | 4 +-
.../kamel-install-global-operator/action.yml | 1 +
.../install-global-operator.sh | 12 +-
.../actions/kamel-preflight-test/preflight-test.sh | 2 +
.github/workflows/builder.yml | 4 +
.github/workflows/common.yml | 4 +
.github/workflows/install.yml | 4 +
.github/workflows/knative.yml | 4 +
.github/workflows/manual-exec-process-inputs.sh | 9 +-
.github/workflows/upgrade.yml | 4 +
.../bases/camel-k.clusterserviceversion.yaml | 2 +-
e2e/global/common/config/config_test.go | 616 ++++++++++++---------
e2e/global/common/kamelet_test.go | 12 +-
e2e/global/common/operator_metrics_test.go | 7 +-
e2e/global/common/scale_integration_test.go | 12 +-
e2e/global/common/structured_logs_test.go | 8 +-
e2e/global/knative/knative_test.go | 2 +-
e2e/namespace/install/cli/debug_test.go | 2 +-
e2e/namespace/install/cli/delete_test.go | 14 +-
e2e/namespace/install/cli/install_test.go | 9 +-
e2e/namespace/install/cli/run_test.go | 267 +++++----
e2e/namespace/install/cli/uninstall_test.go | 18 +-
e2e/namespace/install/kustomize/common.go | 2 +-
e2e/namespace/upgrade/olm_install_test.go | 16 +-
e2e/namespace/upgrade/olm_upgrade_test.go | 13 +
e2e/namespace/upgrade/util.go | 49 ++
e2e/support/test_support.go | 131 ++++-
e2e/support/util/dump.go | 18 +-
.../typed/camel/v1/fake/fake_integration.go | 10 +
.../versioned/typed/camel/v1/integration.go | 16 +
pkg/cmd/run_support.go | 6 +-
pkg/cmd/version.go | 5 +-
.../integrationkit/integrationkit_controller.go | 3 +
pkg/platform/defaults.go | 20 +
pkg/platform/operator.go | 8 +
pkg/platform/platform.go | 8 +-
pkg/util/kubernetes/client.go | 7 +
script/Makefile | 36 +-
script/build_bundle_index.sh | 93 +++-
53 files changed, 1050 insertions(+), 482 deletions(-)
[camel-k] 01/13: fix(bundle-index-gen): Improves generation of bundle index
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit d9ad23dce07257a810bad7b191d82b6f395e9513
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Tue Aug 9 21:50:49 2022 +0100
fix(bundle-index-gen): Improves generation of bundle index
* Uses yq to insert the test bundle into existing channels as well as
appending bundle into any new channels
* Better replicates what the bundle will actually do to the channels in
the bundle index
---
script/Makefile | 4 +-
script/build_bundle_index.sh | 93 +++++++++++++++++++++++++++++++-------------
2 files changed, 69 insertions(+), 28 deletions(-)
diff --git a/script/Makefile b/script/Makefile
index 91fade9ef..afba2fa97 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -25,7 +25,7 @@ CONTROLLER_GEN_VERSION := v0.6.1
CODEGEN_VERSION := v0.23.5
OPERATOR_SDK_VERSION := v1.14.0
KUSTOMIZE_VERSION := v4.1.2
-OPM_VERSION := v1.21.0
+OPM_VERSION := v1.24.0
BASE_IMAGE := docker.io/adoptopenjdk/openjdk11:slim
LOCAL_REPOSITORY := /tmp/artifacts/m2
IMAGE_NAME ?= docker.io/apache/camel-k
@@ -644,5 +644,5 @@ bundle-push: bundle-build
bundle-index: opm
BUNDLE_INDEX=$(BUNDLE_INDEX) INDEX_DIR=$(INDEX_DIR) PACKAGE=$(PACKAGE) \
OPM=$(OPM) BUNDLE_IMAGE=$(BUNDLE_IMAGE_NAME):$(CUSTOM_VERSION) CSV_NAME=$(CSV_PRODUCTION_NAME) \
- CSV_SKIPS=$(CSV_SKIP_RANGE) CSV_REPLACES=$(CSV_REPLACES) CHANNEL="$(DEFAULT_CHANNEL)-dev" \
+ CSV_SKIPS=$(CSV_SKIP_RANGE) CSV_REPLACES=$(CSV_REPLACES) CHANNELS="$(CHANNELS)" \
./script/build_bundle_index.sh
diff --git a/script/build_bundle_index.sh b/script/build_bundle_index.sh
index cb6e71093..e03fc861f 100755
--- a/script/build_bundle_index.sh
+++ b/script/build_bundle_index.sh
@@ -14,9 +14,11 @@ check_env_var "OPM" ${OPM}
check_env_var "BUNDLE_IMAGE" ${BUNDLE_IMAGE}
check_env_var "CSV_NAME" ${CSV_NAME}
check_env_var "CSV_REPLACES" ${CSV_REPLACES}
-check_env_var "CHANNEL" ${CHANNEL}
+check_env_var "CHANNELS" ${CHANNELS}
PACKAGE_YAML=${INDEX_DIR}/${PACKAGE}.yaml
+INDEX_BASE_YAML=${INDEX_DIR}/bundles.yaml
+CHANNELS_YAML="${INDEX_DIR}/${PACKAGE}-channels.yaml"
if ! command -v ${OPM} &> /dev/null
then
@@ -58,43 +60,82 @@ fi
mkdir -p "${INDEX_DIR}"
-if [ ! -f ${INDEX_DIR}/bundles.yaml ]; then
- ${OPM} render ${BUNDLE_INDEX} -o yaml > ${INDEX_DIR}/bundles.yaml
+if [ ! -f ${INDEX_BASE_YAML} ]; then
+ ${OPM} render ${BUNDLE_INDEX} -o yaml > ${INDEX_BASE_YAML}
if [ $? != 0 ]; then
echo "Error: failed to render the base catalog"
exit 1
fi
fi
-${OPM} render --skip-tls -o yaml \
- ${BUNDLE_IMAGE} > ${PACKAGE_YAML}
-if [ $? != 0 ]; then
- echo "Error: failed to render the ${PACKAGE} bundle catalog"
- exit 1
+if [ ! -f ${PACKAGE_YAML} ]; then
+ ${OPM} render --skip-tls -o yaml \
+ ${BUNDLE_IMAGE} > ${PACKAGE_YAML}
+ if [ $? != 0 ]; then
+ echo "Error: failed to render the ${PACKAGE} bundle catalog"
+ exit 1
+ fi
fi
+#
+# Extract the camel-k channels
+#
+yq eval ". | select(.package == \"${PACKAGE}\" and .schema == \"olm.channel\")" ${INDEX_BASE_YAML} > ${CHANNELS_YAML}
+if [ $? != 0 ] || [ ! -f "${CHANNELS_YAML}" ]; then
+ echo "ERROR: Failed to extract camel-k entries from bundle catalog"
+ exit 1
+fi
+#
+# Filter out the channels in the bundles file
+#
+yq -i eval ". | select(.package != \"${PACKAGE}\" or .schema != \"olm.channel\")" ${INDEX_BASE_YAML}
+if [ $? != 0 ]; then
+ echo "ERROR: Failed to remove camel-k channel entries from bundles catalog"
+ exit 1
+fi
-cat << EOF >> ${PACKAGE_YAML}
----
-schema: olm.channel
-package: ${PACKAGE}
-name: ${CHANNEL}
-entries:
- - name: ${CSV_NAME}
-EOF
+#
+# Split the channels and append/insert the bundle into each one
+#
+IFS=','
+#Read the split words into an array based on comma delimiter
+read -a CHANNEL_ARR <<< "${CHANNELS}"
-if [ -n "${CSV_REPLACES}" ]; then
-cat << EOF >> ${PACKAGE_YAML}
- replaces: ${CSV_REPLACES}
-EOF
-fi
+for channel in "${CHANNEL_ARR[@]}";
+do
+ channel_props=$(yq eval ". | select(.name == \"${channel}\")" ${CHANNELS_YAML})
-if [ -n "${CSV_SKIPS}" ]; then
-cat << EOF >> ${PACKAGE_YAML}
- skipRange: "\'${CSV_SKIPS}\'"
-EOF
-fi
+ entry="{ \"name\": \"${CSV_NAME}\""
+ if [ -n "${CSV_REPLACES}" ]; then
+ entry="${entry}, \"replaces\": \"${CSV_REPLACES}\""
+ fi
+ if [ -n "${CSV_SKIPS}" ]; then
+ entry="${entry}, \"skipRange\": \"${CSV_SKIPS}\""
+ fi
+ entry="${entry} }"
+
+ if [ -z "${channel_props}" ]; then
+ #
+ # Append a new channel
+ #
+ echo "Appending channel ${channel} ..."
+ object="{ \"entries\": [${entry}], \"name\": \"${channel}\", \"package\": \"${PACKAGE}\", \"schema\": \"olm.channel\" }"
+
+ channel_file=$(mktemp ${channel}-channel-XXX.yaml)
+ trap "rm -f ${channel_file}" EXIT
+ yq -n eval "${object}" > ${channel_file}
+
+ echo "---" >> ${CHANNELS_YAML}
+ cat ${channel_file} >> ${CHANNELS_YAML}
+ else
+ #
+ # Channel already exists so insert entry
+ #
+ echo "Inserting channel ${channel} ..."
+ yq -i eval "(. | select(.name == \"${channel}\") | .entries) += ${entry}" ${CHANNELS_YAML}
+ fi
+done
echo -n "Validating index ... "
STATUS=$(${OPM} validate ${INDEX_DIR} 2>&1)
[camel-k] 12/13: fix(e2e): Replaces update scale with patch scale
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 69ded0727210195e9250b9b81839490ea50e4de6
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Mon Oct 3 21:58:53 2022 +0100
fix(e2e): Replaces update scale with patch scale
* The use of UpdateScale is unreliable in producing the well-known error
"the object has been modified; please apply your changes to the latest
version and try again".
* Replacing UpdateScale with PatchScale avoids this error and allows the
test to continue successfully
---
e2e/global/common/scale_integration_test.go | 12 +++++++++---
e2e/support/test_support.go | 7 +++++++
.../versioned/typed/camel/v1/fake/fake_integration.go | 10 ++++++++++
.../clientset/versioned/typed/camel/v1/integration.go | 16 ++++++++++++++++
4 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/e2e/global/common/scale_integration_test.go b/e2e/global/common/scale_integration_test.go
index e9789f2ce..504e374d8 100644
--- a/e2e/global/common/scale_integration_test.go
+++ b/e2e/global/common/scale_integration_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package common
import (
+ "encoding/json"
"fmt"
"testing"
@@ -95,9 +96,14 @@ func TestIntegrationScale(t *testing.T) {
Expect(integrationScale.Spec.Replicas).To(BeNumerically("==", 2))
Expect(integrationScale.Status.Replicas).To(BeNumerically("==", 2))
- // Setter
- integrationScale.Spec.Replicas = 1
- integrationScale, err = camel.CamelV1().Integrations(ns).UpdateScale(TestContext, name, integrationScale, metav1.UpdateOptions{})
+ payload := []PatchUInt32Value{{
+ Op: "replace",
+ Path: "/spec/replicas",
+ Value: 1,
+ }}
+ payloadBytes, _ := json.Marshal(payload)
+
+ integrationScale, err = camel.CamelV1().Integrations(ns).PatchScale(TestContext, name, types.JSONPatchType, payloadBytes, metav1.PatchOptions{})
Expect(err).To(BeNil())
// Check the readiness condition is still truthy as down-scaling
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index d363b620c..7cee2a0b8 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -102,6 +102,13 @@ var NoOlmOperatorImage string
var TestContext context.Context
var testClient client.Client
+// patchUint32Value specifies a patch operation for a uint32.
+type PatchUInt32Value struct {
+ Op string `json:"op"`
+ Path string `json:"path"`
+ Value uint32 `json:"value"`
+}
+
var testLocus *testing.T
func setTestLocus(t *testing.T) {
diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integration.go b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integration.go
index 0c729b36c..5efa7b05a 100644
--- a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integration.go
+++ b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integration.go
@@ -164,3 +164,13 @@ func (c *FakeIntegrations) UpdateScale(ctx context.Context, integrationName stri
}
return obj.(*autoscalingv1.Scale), err
}
+
+func (c *FakeIntegrations) PatchScale(ctx context.Context, integrationName string, pt types.PatchType, data []byte, opts v1.PatchOptions) (result *autoscalingv1.Scale, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(integrationsResource, c.ns, integrationName, pt, data, "scale"), &autoscalingv1.Scale{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*autoscalingv1.Scale), err
+}
diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1/integration.go b/pkg/client/camel/clientset/versioned/typed/camel/v1/integration.go
index 47b7d98a1..52696b2c8 100644
--- a/pkg/client/camel/clientset/versioned/typed/camel/v1/integration.go
+++ b/pkg/client/camel/clientset/versioned/typed/camel/v1/integration.go
@@ -51,6 +51,7 @@ type IntegrationInterface interface {
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Integration, err error)
GetScale(ctx context.Context, integrationName string, options metav1.GetOptions) (*autoscalingv1.Scale, error)
UpdateScale(ctx context.Context, integrationName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error)
+ PatchScale(ctx context.Context, integrationName string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (result *autoscalingv1.Scale, err error)
IntegrationExpansion
}
@@ -227,3 +228,18 @@ func (c *integrations) UpdateScale(ctx context.Context, integrationName string,
Into(result)
return
}
+
+// PatchScale takes the top resource name and the representation of a scale and patches it. Returns the server's representation of the scale, and an error, if there is any.
+func (c *integrations) PatchScale(ctx context.Context, integrationName string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (result *autoscalingv1.Scale, err error) {
+ result = &autoscalingv1.Scale{}
+ err = c.client.Patch(pt).
+ Namespace(c.ns).
+ Resource("integrations").
+ Name(integrationName).
+ SubResource("scale").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(data).
+ Do(ctx).
+ Into(result)
+ return
+}
[camel-k] 04/13: (e2e): Improvements for testing
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 53e6ceee0a9ffa4fc9ff1437faabf6b8b20f1dce
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Wed Sep 28 13:04:45 2022 +0100
(e2e): Improvements for testing
* Extends the timeout for testing to 90m since if in debug mode, the extra
logging increases the testing time and takes slightly longer than 60m
* Adds in extra debug statements for logging when running in debug mode
* Exposes the LOG_LEVEL parameter to e2e testsuite so tests can be switched
to debug mode
* Prints the call stack for kamel binary if running test in debug mode
* Fixes the StructuredLogs test by better detection of invalid operator log
entries by the test
* Provide functions to heal a crashed catalogsource pod by waiting for its
pull-secret to become available and then deleting the pod and allowing the
source to reprovision a new one
* Fixes uninstall test by recognising roles are not deleted when install
was by the OLM
* Fixes install test by checking the LOG_LEVEL env var rather than string to
read the operator log which can be truncated
* Fixes to tests by extending timeouts for integration pods coming up
* Removes some cleanups from individual tests as these should be taken care of
by the cleanup of the namespace
* Better logging when building the bundle and bundle index images
# Conflicts:
# script/Makefile
---
.github/actions/e2e-builder/action.yml | 1 +
.github/actions/e2e-builder/exec-tests.sh | 6 +-
.github/actions/e2e-common/action.yml | 1 +
.github/actions/e2e-common/exec-tests.sh | 6 +-
.github/actions/e2e-install/action.yml | 1 +
.github/actions/e2e-install/exec-tests.sh | 6 +-
.github/actions/e2e-knative-yaks/action.yml | 1 +
.github/actions/e2e-knative-yaks/exec-tests.sh | 6 +-
.github/actions/e2e-knative/action.yml | 1 +
.github/actions/e2e-knative/exec-tests.sh | 6 +-
.github/actions/e2e-upgrade/action.yml | 1 +
.github/actions/e2e-upgrade/exec-tests.sh | 6 +-
.../kamel-build-bundle/build-bundle-image.sh | 12 ++-
.../kamel-build-bundle/build-index-image.sh | 2 +-
.../kamel-install-global-operator/action.yml | 1 +
.../install-global-operator.sh | 12 ++-
.../actions/kamel-preflight-test/preflight-test.sh | 2 +
.github/workflows/builder.yml | 4 +
.github/workflows/common.yml | 4 +
.github/workflows/install.yml | 4 +
.github/workflows/knative.yml | 4 +
.github/workflows/manual-exec-process-inputs.sh | 9 ++-
.github/workflows/upgrade.yml | 4 +
e2e/global/common/config/config_test.go | 4 +-
e2e/global/common/kamelet_test.go | 3 -
e2e/global/common/operator_metrics_test.go | 7 +-
e2e/global/common/structured_logs_test.go | 8 +-
e2e/global/knative/knative_test.go | 2 +-
e2e/namespace/install/cli/debug_test.go | 2 +-
e2e/namespace/install/cli/delete_test.go | 14 ++--
e2e/namespace/install/cli/install_test.go | 9 +--
e2e/namespace/install/cli/uninstall_test.go | 18 ++++-
e2e/namespace/install/kustomize/common.go | 2 +-
e2e/namespace/upgrade/olm_install_test.go | 16 +++-
e2e/namespace/upgrade/olm_upgrade_test.go | 13 ++++
e2e/namespace/upgrade/util.go | 49 ++++++++++++
e2e/support/test_support.go | 89 +++++++++++++++++++---
e2e/support/util/dump.go | 18 +++--
pkg/cmd/version.go | 5 +-
.../integrationkit/integrationkit_controller.go | 3 +
pkg/platform/defaults.go | 20 +++++
pkg/platform/operator.go | 8 ++
pkg/platform/platform.go | 6 ++
pkg/util/kubernetes/client.go | 7 ++
script/Makefile | 30 ++++----
45 files changed, 361 insertions(+), 72 deletions(-)
diff --git a/.github/actions/e2e-builder/action.yml b/.github/actions/e2e-builder/action.yml
index 1f4e37f8c..96f0eb6a0 100644
--- a/.github/actions/e2e-builder/action.yml
+++ b/.github/actions/e2e-builder/action.yml
@@ -123,6 +123,7 @@ runs:
-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
index b52ecf1f4..44501de07 100755
--- a/.github/actions/e2e-builder/exec-tests.sh
+++ b/.github/actions/e2e-builder/exec-tests.sh
@@ -25,7 +25,7 @@
set -e
-while getopts ":b:c:g:i:l:n:s:v:x:" opt; do
+while getopts ":b:c:g:i:l:n:q:s:v:x:" opt; do
case "${opt}" in
b)
BUILD_CATALOG_SOURCE_NAME=${OPTARG}
@@ -45,6 +45,9 @@ while getopts ":b:c:g:i:l:n:s:v:x:" opt; do
n)
IMAGE_NAME=${OPTARG}
;;
+ q)
+ LOG_LEVEL=${OPTARG}
+ ;;
s)
REGISTRY_INSECURE=${OPTARG}
;;
@@ -114,6 +117,7 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
+export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
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}
diff --git a/.github/actions/e2e-common/action.yml b/.github/actions/e2e-common/action.yml
index bfb8d9d4c..12c6993e5 100644
--- a/.github/actions/e2e-common/action.yml
+++ b/.github/actions/e2e-common/action.yml
@@ -117,6 +117,7 @@ runs:
-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-common/exec-tests.sh b/.github/actions/e2e-common/exec-tests.sh
index 6423b5734..8b687ba2a 100755
--- a/.github/actions/e2e-common/exec-tests.sh
+++ b/.github/actions/e2e-common/exec-tests.sh
@@ -25,7 +25,7 @@
set -e
-while getopts ":b:c:g:i:l:n:s:v:x:" opt; do
+while getopts ":b:c:g:i:l:n:q:s:v:x:" opt; do
case "${opt}" in
b)
BUILD_CATALOG_SOURCE_NAME=${OPTARG}
@@ -45,6 +45,9 @@ while getopts ":b:c:g:i:l:n:s:v:x:" opt; do
n)
IMAGE_NAME=${OPTARG}
;;
+ q)
+ LOG_LEVEL=${OPTARG}
+ ;;
s)
REGISTRY_INSECURE=${OPTARG}
;;
@@ -114,6 +117,7 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
+export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
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}
diff --git a/.github/actions/e2e-install/action.yml b/.github/actions/e2e-install/action.yml
index 8b2ebbf19..04fc81da8 100644
--- a/.github/actions/e2e-install/action.yml
+++ b/.github/actions/e2e-install/action.yml
@@ -103,6 +103,7 @@ runs:
-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-install/exec-tests.sh b/.github/actions/e2e-install/exec-tests.sh
index 3b780d7f3..f85b44c67 100755
--- a/.github/actions/e2e-install/exec-tests.sh
+++ b/.github/actions/e2e-install/exec-tests.sh
@@ -25,7 +25,7 @@
set -e
-while getopts ":b:c:i:l:n:s:v:x:" opt; do
+while getopts ":b:c:i:l:n:q:s:v:x:" opt; do
case "${opt}" in
b)
BUILD_CATALOG_SOURCE_NAME=${OPTARG}
@@ -42,6 +42,9 @@ while getopts ":b:c:i:l:n:s:v:x:" opt; do
n)
IMAGE_NAME=${OPTARG}
;;
+ q)
+ LOG_LEVEL=${OPTARG}
+ ;;
s)
REGISTRY_INSECURE=${OPTARG}
;;
@@ -112,6 +115,7 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
+export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
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}
diff --git a/.github/actions/e2e-knative-yaks/action.yml b/.github/actions/e2e-knative-yaks/action.yml
index 6d0ff89b2..68f072e76 100644
--- a/.github/actions/e2e-knative-yaks/action.yml
+++ b/.github/actions/e2e-knative-yaks/action.yml
@@ -125,6 +125,7 @@ runs:
-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-knative-yaks/exec-tests.sh b/.github/actions/e2e-knative-yaks/exec-tests.sh
index 56b3d1644..a6075dbbc 100755
--- a/.github/actions/e2e-knative-yaks/exec-tests.sh
+++ b/.github/actions/e2e-knative-yaks/exec-tests.sh
@@ -25,7 +25,7 @@
set -e
-while getopts ":b:c:i:l:n:s:v:x:" opt; do
+while getopts ":b:c:i:l:n:q:s:v:x:" opt; do
case "${opt}" in
b)
BUILD_CATALOG_SOURCE_NAME=${OPTARG}
@@ -42,6 +42,9 @@ while getopts ":b:c:i:l:n:s:v:x:" opt; do
n)
IMAGE_NAME=${OPTARG}
;;
+ q)
+ LOG_LEVEL=${OPTARG}
+ ;;
s)
REGISTRY_INSECURE=${OPTARG}
;;
@@ -111,6 +114,7 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
+export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
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}
diff --git a/.github/actions/e2e-knative/action.yml b/.github/actions/e2e-knative/action.yml
index ea3e4710a..4a69be056 100644
--- a/.github/actions/e2e-knative/action.yml
+++ b/.github/actions/e2e-knative/action.yml
@@ -121,6 +121,7 @@ runs:
-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-knative/exec-tests.sh b/.github/actions/e2e-knative/exec-tests.sh
index fd591cbb7..0e3d94517 100755
--- a/.github/actions/e2e-knative/exec-tests.sh
+++ b/.github/actions/e2e-knative/exec-tests.sh
@@ -25,7 +25,7 @@
set -e
-while getopts ":b:c:g:i:l:n:s:v:x:" opt; do
+while getopts ":b:c:g:i:l:n:q:s:v:x:" opt; do
case "${opt}" in
b)
BUILD_CATALOG_SOURCE_NAME=${OPTARG}
@@ -45,6 +45,9 @@ while getopts ":b:c:g:i:l:n:s:v:x:" opt; do
n)
IMAGE_NAME=${OPTARG}
;;
+ q)
+ LOG_LEVEL=${OPTARG}
+ ;;
s)
REGISTRY_INSECURE=${OPTARG}
;;
@@ -115,6 +118,7 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
+export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
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}
diff --git a/.github/actions/e2e-upgrade/action.yml b/.github/actions/e2e-upgrade/action.yml
index 5d5c3515b..8da9ee656 100644
--- a/.github/actions/e2e-upgrade/action.yml
+++ b/.github/actions/e2e-upgrade/action.yml
@@ -111,6 +111,7 @@ runs:
-d "${{ steps.build-kamel.outputs.build-bundle-image-bundle-index }}" \
-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-upgrade/exec-tests.sh b/.github/actions/e2e-upgrade/exec-tests.sh
index be8ed47f3..367a578bc 100755
--- a/.github/actions/e2e-upgrade/exec-tests.sh
+++ b/.github/actions/e2e-upgrade/exec-tests.sh
@@ -25,7 +25,7 @@
set -e
-while getopts ":b:d:l:n:s:v:x:" opt; do
+while getopts ":b:d:l:n:q:s:v:x:" opt; do
case "${opt}" in
b)
KAMEL_BINARY=${OPTARG}
@@ -39,6 +39,9 @@ while getopts ":b:d:l:n:s:v:x:" opt; do
n)
IMAGE_NAME=${OPTARG}
;;
+ q)
+ LOG_LEVEL=${OPTARG}
+ ;;
s)
REGISTRY_INSECURE=${OPTARG}
;;
@@ -112,6 +115,7 @@ export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
# Despite building a bundle we don't want it installed immediately so no OLM_INDEX_BUNDLE var
# Configure test options
+export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest
export CAMEL_K_NEW_IIB=${BUNDLE_INDEX_IMAGE}
export CAMEL_K_PREV_UPGRADE_CHANNEL=${PREV_XY_CHANNEL}
diff --git a/.github/actions/kamel-build-bundle/build-bundle-image.sh b/.github/actions/kamel-build-bundle/build-bundle-image.sh
index 0bd0edb68..f6c509cbf 100755
--- a/.github/actions/kamel-build-bundle/build-bundle-image.sh
+++ b/.github/actions/kamel-build-bundle/build-bundle-image.sh
@@ -23,7 +23,7 @@
#
####
-set -e
+set +e
while getopts ":i:l:n:s:v:" opt; do
case "${opt}" in
@@ -115,10 +115,18 @@ echo "PREV_XY_CHANNEL=${PREV_XY_CHANNEL}" >> $GITHUB_ENV
export NEW_XY_CHANNEL=stable-dev-$(make get-version | grep -Po "\d+\.\d+")
echo "NEW_XY_CHANNEL=${NEW_XY_CHANNEL}" >> $GITHUB_ENV
+echo "BUNDLE_IMAGE_NAME=${PUSH_BUNDLE_LOCAL_IMAGE}"
+echo "DEFAULT_CHANNEL=${NEW_XY_CHANNEL}"
+echo "CHANNELS=${NEW_XY_CHANNEL}"
+
make bundle-push \
BUNDLE_IMAGE_NAME="${PUSH_BUNDLE_LOCAL_IMAGE}" \
DEFAULT_CHANNEL="${NEW_XY_CHANNEL}" \
- CHANNELS="${NEW_XY_CHANNEL}"
+ CHANNELS="${NEW_XY_CHANNEL}" 2>&1
+if [ $? != 0 ]; then
+ echo "Error: Making bundle failed."
+ exit 1
+fi
#
# Use the PULL host to ensure the correct image:tag
diff --git a/.github/actions/kamel-build-bundle/build-index-image.sh b/.github/actions/kamel-build-bundle/build-index-image.sh
index c8e61963e..e5d1fbbbc 100755
--- a/.github/actions/kamel-build-bundle/build-index-image.sh
+++ b/.github/actions/kamel-build-bundle/build-index-image.sh
@@ -182,7 +182,7 @@ if [ "${PULL_REGISTRY}" != "${PUSH_REGISTRY}" ]; then
# Push the bundle image to the registry
#
echo "Pushing bundle image ..."
- docker push ${BUNDLE_IMAGE}
+ docker push ${BUNDLE_IMAGE} 2>&1
fi
#
diff --git a/.github/actions/kamel-install-global-operator/action.yml b/.github/actions/kamel-install-global-operator/action.yml
index 4bd08aca0..e8b32288b 100644
--- a/.github/actions/kamel-install-global-operator/action.yml
+++ b/.github/actions/kamel-install-global-operator/action.yml
@@ -59,5 +59,6 @@ runs:
-i "${{ inputs.image-namespace }}" \
-l "${{ inputs.image-registry-host }}" \
-n "${{ inputs.image-name }}" \
+ -q "${{ env.CAMEL_K_LOG_LEVEL }}" \
-s "${{ inputs.image-registry-insecure }}" \
-v "${{ inputs.image-version }}"
diff --git a/.github/actions/kamel-install-global-operator/install-global-operator.sh b/.github/actions/kamel-install-global-operator/install-global-operator.sh
index 485dbee73..1c7e6b41a 100755
--- a/.github/actions/kamel-install-global-operator/install-global-operator.sh
+++ b/.github/actions/kamel-install-global-operator/install-global-operator.sh
@@ -25,7 +25,7 @@
set -e
-while getopts ":b:c:g:i:l:n:s:v:" opt; do
+while getopts ":b:c:g:i:l:n:q:s:v:" opt; do
case "${opt}" in
b)
BUILD_CATALOG_SOURCE_NAME=${OPTARG}
@@ -45,6 +45,9 @@ while getopts ":b:c:g:i:l:n:s:v:" opt; do
n)
IMAGE_NAME=${OPTARG}
;;
+ q)
+ LOG_LEVEL=${OPTARG}
+ ;;
s)
REGISTRY_INSECURE=${OPTARG}
;;
@@ -155,10 +158,15 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
+logLevelSwitch=""
+if [ -n "${LOG_LEVEL}" ]; then
+ logLevelSwitch="--log-level ${LOG_LEVEL}"
+fi
+
#
# Install the operator
#
-kamel install -n ${GLOBAL_OPERATOR_NAMESPACE} --olm=${has_olm} --force --global
+kamel install -n ${GLOBAL_OPERATOR_NAMESPACE} ${logLevelSwitch} --olm=${has_olm} --force --global
if [ $? != 0 ]; then
echo "Error: kamel install returned an error."
exit 1
diff --git a/.github/actions/kamel-preflight-test/preflight-test.sh b/.github/actions/kamel-preflight-test/preflight-test.sh
index de9a6c911..f2779b9f8 100755
--- a/.github/actions/kamel-preflight-test/preflight-test.sh
+++ b/.github/actions/kamel-preflight-test/preflight-test.sh
@@ -29,7 +29,9 @@ NAMESPACE="preflight"
delns() {
echo "Deleting namespace ${1}"
+ set +e
kubectl delete ns ${1} &> /dev/null
+ set -e
}
waitForOperator() {
diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml
index 8050a3a6d..0208f1248 100644
--- a/.github/workflows/builder.yml
+++ b/.github/workflows/builder.yml
@@ -44,6 +44,9 @@ on:
- 'NOTICE'
workflow_dispatch:
inputs:
+ log-level:
+ description: 'Set the operator log level (info or debug)'
+ required: false
pre-built-kamel-image:
description: 'Kamel image url for skipping building of kamel stages. Used for debugging'
required: false
@@ -81,6 +84,7 @@ jobs:
./.github/workflows/manual-exec-process-inputs.sh \
-i "${{ github.event.inputs.pre-built-kamel-image }}" \
-p "${{ github.event.inputs.skip-problematic }}" \
+ -q "${{ github.event.inputs.log-level }}" \
-t "${{ github.event.inputs.test-filters }}"
- name: Execute Builder Tests
diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml
index bbc948a91..f1a1d5681 100644
--- a/.github/workflows/common.yml
+++ b/.github/workflows/common.yml
@@ -44,6 +44,9 @@ on:
- 'NOTICE'
workflow_dispatch:
inputs:
+ log-level:
+ description: 'Set the operator log level (info or debug)'
+ required: false
pre-built-kamel-image:
description: 'Kamel image url for skipping building of kamel stages. Used for debugging'
required: false
@@ -81,6 +84,7 @@ jobs:
./.github/workflows/manual-exec-process-inputs.sh \
-i "${{ github.event.inputs.pre-built-kamel-image }}" \
-p "${{ github.event.inputs.skip-problematic }}" \
+ -q "${{ github.event.inputs.log-level }}" \
-t "${{ github.event.inputs.test-filters }}"
- name: Execute Tests
diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml
index aafdc1522..e7f5fc3ff 100644
--- a/.github/workflows/install.yml
+++ b/.github/workflows/install.yml
@@ -44,6 +44,9 @@ on:
- 'NOTICE'
workflow_dispatch:
inputs:
+ log-level:
+ description: 'Set the operator log level (info or debug)'
+ required: false
pre-built-kamel-image:
description: 'Kamel image url for skipping building of kamel stages. Used for debugging'
required: false
@@ -78,6 +81,7 @@ jobs:
./.github/workflows/manual-exec-process-inputs.sh \
-i "${{ github.event.inputs.pre-built-kamel-image }}" \
-p "${{ github.event.inputs.skip-problematic }}" \
+ -q "${{ github.event.inputs.log-level }}" \
-t "${{ github.event.inputs.test-filters }}"
- name: Execute Tests
diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml
index 3009fd942..34cd9e1df 100644
--- a/.github/workflows/knative.yml
+++ b/.github/workflows/knative.yml
@@ -44,6 +44,9 @@ on:
- 'NOTICE'
workflow_dispatch:
inputs:
+ log-level:
+ description: 'Set the operator log level (info or debug)'
+ required: false
pre-built-kamel-image:
description: 'Kamel image url for skipping building of kamel stages. Used for debugging'
required: false
@@ -77,6 +80,7 @@ jobs:
./.github/workflows/manual-exec-process-inputs.sh \
-i "${{ github.event.inputs.pre-built-kamel-image }}" \
-p "${{ github.event.inputs.skip-problematic }}" \
+ -q "${{ github.event.inputs.log-level }}" \
-t "${{ github.event.inputs.test-filters }}"
- name: Execute KNative Tests
diff --git a/.github/workflows/manual-exec-process-inputs.sh b/.github/workflows/manual-exec-process-inputs.sh
index 186e26840..b751d6bf1 100755
--- a/.github/workflows/manual-exec-process-inputs.sh
+++ b/.github/workflows/manual-exec-process-inputs.sh
@@ -27,7 +27,7 @@ if [ -z "$GITHUB_ENV" ]; then
rm -f "${GITHUB_ENV}"
fi
-while getopts ":i:p:t:" opt; do
+while getopts ":i:p:q:t:" opt; do
case "${opt}" in
i)
PRE_BUILT_IMAGE=${OPTARG}
@@ -35,6 +35,9 @@ while getopts ":i:p:t:" opt; do
p)
SKIP_PROBLEMATIC=${OPTARG}
;;
+ q)
+ LOG_LEVEL=${OPTARG}
+ ;;
t)
TEST_FILTERS=${OPTARG}
;;
@@ -50,6 +53,10 @@ while getopts ":i:p:t:" opt; do
done
shift $((OPTIND-1))
+if [ -n "${LOG_LEVEL}" ]; then
+ echo "CAMEL_K_LOG_LEVEL=${LOG_LEVEL}" >> $GITHUB_ENV
+fi
+
if [ -n "${PRE_BUILT_IMAGE}" ]; then
echo "DEBUG_USE_EXISTING_IMAGE=${PRE_BUILT_IMAGE}" >> $GITHUB_ENV
fi
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index 01fd3cba3..802182494 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -44,6 +44,9 @@ on:
- 'NOTICE'
workflow_dispatch:
inputs:
+ log-level:
+ description: 'Set the operator log level (info or debug)'
+ required: false
pre-built-kamel-image:
description: 'Kamel image url for skipping building of kamel stages. Used for debugging'
required: false
@@ -77,6 +80,7 @@ jobs:
./.github/workflows/manual-exec-process-inputs.sh \
-i "${{ github.event.inputs.pre-built-kamel-image }}" \
-p "${{ github.event.inputs.skip-problematic }}" \
+ -q "${{ github.event.inputs.log-level }}" \
-t "${{ github.event.inputs.test-filters }}"
- name: Execute Upgrade Tests
diff --git a/e2e/global/common/config/config_test.go b/e2e/global/common/config/config_test.go
index a525ec273..38eb54e7b 100644
--- a/e2e/global/common/config/config_test.go
+++ b/e2e/global/common/config/config_test.go
@@ -329,8 +329,8 @@ func TestRunConfigExamples(t *testing.T) {
Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "configmap:my-cm-test-build-property").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-cool-application"))
+ Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutLong).Should(ContainSubstring("my-cool-application"))
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
diff --git a/e2e/global/common/kamelet_test.go b/e2e/global/common/kamelet_test.go
index dd1b51a0b..5c4242fd3 100644
--- a/e2e/global/common/kamelet_test.go
+++ b/e2e/global/common/kamelet_test.go
@@ -68,9 +68,6 @@ func TestKameletClasspathLoading(t *testing.T) {
Eventually(IntegrationPodPhase(ns, "timer-custom-kamelet-integration"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
Eventually(IntegrationLogs(ns, "timer-custom-kamelet-integration")).Should(ContainSubstring("great message"))
-
- // Cleanup
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
})
})
}
diff --git a/e2e/global/common/operator_metrics_test.go b/e2e/global/common/operator_metrics_test.go
index db24f0f62..21169711a 100644
--- a/e2e/global/common/operator_metrics_test.go
+++ b/e2e/global/common/operator_metrics_test.go
@@ -73,7 +73,12 @@ func TestMetrics(t *testing.T) {
Expect(pod).NotTo(BeNil())
// pod.Namespace could be different from ns if using global operator
- logs := StructuredLogs(pod.Namespace, pod.Name, corev1.PodLogOptions{}, false)
+ fmt.Printf("Fetching logs for operator pod %s in namespace %s", pod.Name, pod.Namespace)
+ logOptions := &corev1.PodLogOptions{
+ Container: "camel-k-operator",
+ }
+ logs, err := StructuredLogs(pod.Namespace, pod.Name, logOptions, false)
+ Expect(err).To(BeNil())
Expect(logs).NotTo(BeEmpty())
response, err := TestClient().CoreV1().RESTClient().Get().
diff --git a/e2e/global/common/structured_logs_test.go b/e2e/global/common/structured_logs_test.go
index c0abcdc08..dde73f87e 100644
--- a/e2e/global/common/structured_logs_test.go
+++ b/e2e/global/common/structured_logs_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package common
import (
+ "fmt"
"testing"
. "github.com/onsi/gomega"
@@ -47,7 +48,12 @@ func TestStructuredLogs(t *testing.T) {
Expect(pod).NotTo(BeNil())
// pod.Namespace could be different from ns if using global operator
- logs := StructuredLogs(pod.Namespace, pod.Name, corev1.PodLogOptions{}, false)
+ fmt.Printf("Fetching logs for operator pod %s in namespace %s", pod.Name, pod.Namespace)
+ logOptions := &corev1.PodLogOptions{
+ Container: "camel-k-operator",
+ }
+ logs, err := StructuredLogs(pod.Namespace, pod.Name, logOptions, false)
+ Expect(err).To(BeNil())
Expect(logs).NotTo(BeEmpty())
it := Integration(ns, name)()
diff --git a/e2e/global/knative/knative_test.go b/e2e/global/knative/knative_test.go
index 3dd55e660..fa9a9a2b4 100644
--- a/e2e/global/knative/knative_test.go
+++ b/e2e/global/knative/knative_test.go
@@ -99,7 +99,7 @@ func TestKnative(t *testing.T) {
t.Run("Flow", func(t *testing.T) {
Expect(KamelRunWithID(operatorID, ns, "files/flow.yaml").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "flow"), TestTimeoutLong).Should(Equal(v1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "flow", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
+ Eventually(IntegrationConditionStatus(ns, "flow", camelv1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(v1.ConditionTrue))
t.Run("Scale to zero", func(t *testing.T) {
Eventually(IntegrationPod(ns, "flow"), TestTimeoutLong).Should(BeNil())
diff --git a/e2e/namespace/install/cli/debug_test.go b/e2e/namespace/install/cli/debug_test.go
index ed10e1b10..b916615a4 100644
--- a/e2e/namespace/install/cli/debug_test.go
+++ b/e2e/namespace/install/cli/debug_test.go
@@ -34,7 +34,7 @@ import (
func TestKamelCLIDebug(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
+ Expect(KamelInstall(ns).Execute()).To(Succeed())
t.Run("debug local default port check", func(t *testing.T) {
Expect(Kamel("run", "-n", ns, "files/yaml.yaml").Execute()).To(Succeed())
diff --git a/e2e/namespace/install/cli/delete_test.go b/e2e/namespace/install/cli/delete_test.go
index e453a304b..3f2fb88c4 100644
--- a/e2e/namespace/install/cli/delete_test.go
+++ b/e2e/namespace/install/cli/delete_test.go
@@ -42,14 +42,14 @@ func TestKamelCLIDelete(t *testing.T) {
Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
Expect(Kamel("delete", "yaml", "-n", ns).Execute()).To(Succeed())
Eventually(Integration(ns, "yaml")).Should(BeNil())
- Eventually(IntegrationPod(ns, "yaml"), TestTimeoutMedium).Should(BeNil())
+ Eventually(IntegrationPod(ns, "yaml"), TestTimeoutLong).Should(BeNil())
})
t.Run("delete building integration", func(t *testing.T) {
Expect(KamelRunWithID(operatorID, ns, "../files/yaml.yaml").Execute()).To(Succeed())
Expect(Kamel("delete", "yaml", "-n", ns).Execute()).To(Succeed())
Eventually(Integration(ns, "yaml")).Should(BeNil())
- Eventually(IntegrationPod(ns, "yaml"), TestTimeoutMedium).Should(BeNil())
+ Eventually(IntegrationPod(ns, "yaml"), TestTimeoutLong).Should(BeNil())
})
t.Run("delete integration from csv", func(t *testing.T) {
@@ -57,7 +57,7 @@ func TestKamelCLIDelete(t *testing.T) {
Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
Expect(Kamel("delete", "yaml", "-n", ns).Execute()).To(Succeed())
Eventually(Integration(ns, "yaml")).Should(BeNil())
- Eventually(IntegrationPod(ns, "yaml"), TestTimeoutMedium).Should(BeNil())
+ Eventually(IntegrationPod(ns, "yaml"), TestTimeoutLong).Should(BeNil())
})
t.Run("delete several integrations", func(t *testing.T) {
@@ -67,10 +67,10 @@ func TestKamelCLIDelete(t *testing.T) {
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
Expect(Kamel("delete", "yaml", "-n", ns).Execute()).To(Succeed())
Eventually(Integration(ns, "yaml")).Should(BeNil())
- Eventually(IntegrationPod(ns, "yaml"), TestTimeoutMedium).Should(BeNil())
+ Eventually(IntegrationPod(ns, "yaml"), TestTimeoutLong).Should(BeNil())
Expect(Kamel("delete", "java", "-n", ns).Execute()).To(Succeed())
Eventually(Integration(ns, "java")).Should(BeNil())
- Eventually(IntegrationPod(ns, "java"), TestTimeoutMedium).Should(BeNil())
+ Eventually(IntegrationPod(ns, "java"), TestTimeoutLong).Should(BeNil())
})
t.Run("delete all integrations", func(t *testing.T) {
@@ -80,9 +80,9 @@ func TestKamelCLIDelete(t *testing.T) {
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
Eventually(Integration(ns, "yaml")).Should(BeNil())
- Eventually(IntegrationPod(ns, "yaml"), TestTimeoutMedium).Should(BeNil())
+ Eventually(IntegrationPod(ns, "yaml"), TestTimeoutLong).Should(BeNil())
Eventually(Integration(ns, "java")).Should(BeNil())
- Eventually(IntegrationPod(ns, "java"), TestTimeoutMedium).Should(BeNil())
+ Eventually(IntegrationPod(ns, "java"), TestTimeoutLong).Should(BeNil())
})
})
}
diff --git a/e2e/namespace/install/cli/install_test.go b/e2e/namespace/install/cli/install_test.go
index 5bac8129c..f3a861a2b 100644
--- a/e2e/namespace/install/cli/install_test.go
+++ b/e2e/namespace/install/cli/install_test.go
@@ -40,7 +40,6 @@ import (
"github.com/apache/camel-k/pkg/util/kubernetes"
"github.com/apache/camel-k/pkg/util/openshift"
consolev1 "github.com/openshift/api/console/v1"
- corev1 "k8s.io/api/core/v1"
)
func TestBasicInstallation(t *testing.T) {
@@ -164,13 +163,7 @@ func TestInstallDebugLogging(t *testing.T) {
operatorID := fmt.Sprintf("camel-k-%s", ns)
Expect(KamelInstallWithID(operatorID, ns, "-z", "debug").Execute()).To(Succeed())
- podFunc := OperatorPod(ns)
- Eventually(podFunc).ShouldNot(BeNil())
-
- pod := podFunc()
- logs := Logs(pod.Namespace, pod.Name, corev1.PodLogOptions{})
- Eventually(logs).ShouldNot(BeEmpty())
- Eventually(logs).Should(ContainSubstring("DEBUG level messages will be logged"))
+ Eventually(OperatorEnvVarValue(ns, "LOG_LEVEL"), TestTimeoutLong).Should(Equal("debug"))
})
}
diff --git a/e2e/namespace/install/cli/uninstall_test.go b/e2e/namespace/install/cli/uninstall_test.go
index abf03749f..14d0686cc 100644
--- a/e2e/namespace/install/cli/uninstall_test.go
+++ b/e2e/namespace/install/cli/uninstall_test.go
@@ -29,6 +29,7 @@ import (
. "github.com/onsi/gomega"
. "github.com/apache/camel-k/e2e/support"
+ "github.com/apache/camel-k/pkg/util/olm"
)
func TestBasicUninstall(t *testing.T) {
@@ -40,10 +41,25 @@ func TestBasicUninstall(t *testing.T) {
// should be completely removed on uninstall
Expect(Kamel("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(TestContext, TestClient(), ns); err != nil {
+ t.Error(err)
+ t.FailNow()
+ }
+
+ if !uninstallViaOLM {
Eventually(Role(ns)).Should(BeNil())
Eventually(RoleBinding(ns)).Should(BeNil())
+ Eventually(ServiceAccount(ns, "camel-k-operator")).Should(BeNil())
+ } else {
+ Eventually(Role(ns)).ShouldNot(BeNil())
+ Eventually(RoleBinding(ns)).ShouldNot(BeNil())
+ }
+
Eventually(Configmap(ns, "camel-k-maven-settings")).Should(BeNil())
- Eventually(ServiceAccount(ns, "camel-k-operator")).Should(BeNil())
Eventually(OperatorPod(ns), TestTimeoutMedium).Should(BeNil())
Eventually(KameletList(ns)).Should(BeEmpty())
})
diff --git a/e2e/namespace/install/kustomize/common.go b/e2e/namespace/install/kustomize/common.go
index 15c12b655..adcc1ce5d 100644
--- a/e2e/namespace/install/kustomize/common.go
+++ b/e2e/namespace/install/kustomize/common.go
@@ -100,7 +100,7 @@ func ExecMakeError(t *testing.T, command *exec.Cmd) {
// Clean up the cluster ready for the next set of tests
func Cleanup() {
// Remove the locally installed operator
- Kamel("uninstall", "--olm=false").Execute()
+ UninstallAll()
// Ensure the CRDs & ClusterRoles are reinstalled if not already
Kamel("install", "--olm=false", "--cluster-setup").Execute()
diff --git a/e2e/namespace/upgrade/olm_install_test.go b/e2e/namespace/upgrade/olm_install_test.go
index a228978a7..bc12ea6a7 100644
--- a/e2e/namespace/upgrade/olm_install_test.go
+++ b/e2e/namespace/upgrade/olm_install_test.go
@@ -29,6 +29,7 @@ import (
. "github.com/apache/camel-k/e2e/support"
. "github.com/onsi/gomega"
+ "github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
@@ -36,6 +37,7 @@ import (
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/util/defaults"
+ "github.com/apache/camel-k/pkg/util/openshift"
)
const installCatalogSourceName = "test-camel-k-source"
@@ -53,7 +55,19 @@ func TestOLMInstallation(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
Expect(createOrUpdateCatalogSource(ns, installCatalogSourceName, newIIB)).To(Succeed())
- Eventually(catalogSourcePhase(ns, installCatalogSourceName), TestTimeoutMedium).Should(Equal("READY"))
+
+ ocp, err := openshift.IsOpenShift(TestClient())
+ assert.Nil(t, err)
+
+ if ocp {
+ // Wait for pull secret to be created in namespace
+ // eg. test-camel-k-source-dockercfg-zlltn
+ secretPrefix := fmt.Sprintf("%s-dockercfg-", installCatalogSourceName)
+ Eventually(SecretByName(ns, secretPrefix), TestTimeoutLong).Should(Not(BeNil()))
+ }
+
+ Eventually(catalogSourcePodRunning(ns, installCatalogSourceName), TestTimeoutMedium).Should(BeNil())
+ Eventually(catalogSourcePhase(ns, installCatalogSourceName), TestTimeoutLong).Should(Equal("READY"))
args := []string{"install", "-n", ns, "--olm=true", "--olm-source", installCatalogSourceName, "--olm-source-namespace", ns}
diff --git a/e2e/namespace/upgrade/olm_upgrade_test.go b/e2e/namespace/upgrade/olm_upgrade_test.go
index 1a27c7c60..6b71804c7 100644
--- a/e2e/namespace/upgrade/olm_upgrade_test.go
+++ b/e2e/namespace/upgrade/olm_upgrade_test.go
@@ -30,6 +30,7 @@ import (
. "github.com/apache/camel-k/e2e/support"
. "github.com/onsi/gomega"
+ "github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
@@ -41,6 +42,7 @@ import (
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/util/defaults"
+ "github.com/apache/camel-k/pkg/util/openshift"
)
const catalogSourceName = "test-camel-k-source"
@@ -66,6 +68,17 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
Expect(createOrUpdateCatalogSource(ns, catalogSourceName, prevIIB)).To(Succeed())
+ ocp, err := openshift.IsOpenShift(TestClient())
+ assert.Nil(t, err)
+
+ if ocp {
+ // Wait for pull secret to be created in namespace
+ // eg. test-camel-k-source-dockercfg-zlltn
+ secretPrefix := fmt.Sprintf("%s-dockercfg-", catalogSourceName)
+ Eventually(SecretByName(ns, secretPrefix), TestTimeoutLong).Should(Not(BeNil()))
+ }
+
+ Eventually(catalogSourcePodRunning(ns, catalogSourceName), TestTimeoutMedium).Should(BeNil())
Eventually(catalogSourcePhase(ns, catalogSourceName), TestTimeoutMedium).Should(Equal("READY"))
// Set KAMEL_BIN only for this test - don't override the ENV variable for all tests
diff --git a/e2e/namespace/upgrade/util.go b/e2e/namespace/upgrade/util.go
index 616ffcd00..42da566cc 100644
--- a/e2e/namespace/upgrade/util.go
+++ b/e2e/namespace/upgrade/util.go
@@ -23,9 +23,12 @@ limitations under the License.
package common
import (
+ "fmt"
"strings"
+ "time"
"unsafe"
+ corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -114,6 +117,52 @@ func catalogSourcePhase(ns, name string) func() string {
}
}
+func catalogSourcePod(ns, csName string) func() *corev1.Pod {
+ return func() *corev1.Pod {
+ podList, err := TestClient().CoreV1().Pods(ns).List(TestContext, metav1.ListOptions{})
+ if err != nil && errors.IsNotFound(err) {
+ return nil
+ } else if err != nil {
+ panic(err)
+ }
+
+ if len(podList.Items) == 0 {
+ return nil
+ }
+
+ for _, pod := range podList.Items {
+ if strings.HasPrefix(pod.Name, csName) {
+ return &pod
+ }
+ }
+
+ return nil
+ }
+}
+
+func catalogSourcePodRunning(ns, csName string) error {
+ podFunc := catalogSourcePod(ns, installCatalogSourceName)
+
+ for i := 1; i < 5; i++ {
+ csPod := podFunc()
+ if csPod.Status.Phase == "Running" {
+ return nil // Pod good to go
+ }
+
+ if i == 2 {
+ fmt.Println("Catalog Source Pod still not ready so delete & allow it to be redeployed ...")
+ if err := TestClient().Delete(TestContext, csPod); err != nil {
+ return err
+ }
+ }
+
+ fmt.Println("Catalog Source Pod not ready so waiting for 2 minutes ...")
+ time.Sleep(2 * time.Minute)
+ }
+
+ return fmt.Errorf("Catalog Source Pod failed to reach a 'running' state")
+}
+
func getSubscription(ns string) (*olm.Subscription, error) {
lst := olm.SubscriptionList{}
if err := TestClient().List(TestContext, &lst, ctrl.InNamespace(ns)); err != nil {
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index f4f797d53..4e4f0013f 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -33,6 +33,7 @@ import (
"os"
"os/exec"
"reflect"
+ "runtime/debug"
"strings"
"testing"
"time"
@@ -249,6 +250,12 @@ func KamelInstallWithContext(ctx context.Context, operatorID string, namespace s
installArgs = []string{"install", "-n", namespace, "--operator-id", operatorID}
}
+ logLevel := os.Getenv("CAMEL_K_LOG_LEVEL")
+ if len(logLevel) > 0 {
+ fmt.Printf("Setting log-level to %s\n", logLevel)
+ installArgs = append(installArgs, "--log-level", logLevel)
+ }
+
installArgs = append(installArgs, args...)
return KamelWithContext(ctx, installArgs...)
}
@@ -317,6 +324,12 @@ func KamelWithContext(ctx context.Context, args ...string) *cobra.Command {
var c *cobra.Command
var err error
+ if os.Getenv("CAMEL_K_LOG_LEVEL") == "debug" {
+ fmt.Printf("Executing kamel with command %+q\n", args)
+ fmt.Println("Printing stack for KamelWithContext")
+ debug.PrintStack()
+ }
+
kamelArgs := os.Getenv("KAMEL_ARGS")
kamelDefaultArgs := strings.Fields(kamelArgs)
args = append(kamelDefaultArgs, args...)
@@ -437,30 +450,34 @@ func Logs(ns, podName string, options corev1.PodLogOptions) func() string {
}
}
-func StructuredLogs(ns, podName string, options corev1.PodLogOptions, ignoreParseErrors bool) []util.LogEntry {
- byteReader, err := TestClient().CoreV1().Pods(ns).GetLogs(podName, &options).Stream(TestContext)
+func StructuredLogs(ns, podName string, options *corev1.PodLogOptions, ignoreParseErrors bool) ([]util.LogEntry, error) {
+
+ stream, err := TestClient().CoreV1().Pods(ns).GetLogs(podName, options).Stream(TestContext)
if err != nil {
- log.Error(err, "Error while reading container logs")
- return nil
+ msg := "Error while reading container logs"
+ log.Error(err, msg)
+ return nil, fmt.Errorf("%s: %w\n", msg, err)
}
defer func() {
- if err := byteReader.Close(); err != nil {
+ if err := stream.Close(); err != nil {
log.Error(err, "Error closing the stream")
}
}()
entries := make([]util.LogEntry, 0)
- scanner := bufio.NewScanner(byteReader)
+ scanner := bufio.NewScanner(stream)
for scanner.Scan() {
entry := util.LogEntry{}
t := scanner.Text()
err := json.Unmarshal([]byte(t), &entry)
if err != nil {
if ignoreParseErrors {
+ fmt.Printf("Warning: Ignoring parse error for logging line: '%s'\n", t)
continue
} else {
- log.Errorf(err, "Unable to parse structured content: %s", t)
- return nil
+ msg := fmt.Sprintf("Unable to parse structured content: %s", t)
+ log.Errorf(err, msg)
+ return nil, fmt.Errorf("%s %w\n", msg, err)
}
}
@@ -468,11 +485,18 @@ func StructuredLogs(ns, podName string, options corev1.PodLogOptions, ignorePars
}
if err := scanner.Err(); err != nil {
- log.Error(err, "Error while scanning container logs")
- return nil
+ msg := "Error while scanning container logs"
+ log.Error(err, msg)
+ return nil, fmt.Errorf("%s %w\n", msg, err)
+ }
+
+ if len(entries) == 0 {
+ msg := "Error fetched zero log entries"
+ log.Error(err, msg)
+ return nil, fmt.Errorf("%s %w\n", msg, err)
}
- return entries
+ return entries, nil
}
func IntegrationPodPhase(ns string, name string) func() corev1.PodPhase {
@@ -1143,6 +1167,23 @@ func OperatorPodPhase(ns string) func() corev1.PodPhase {
}
}
+func OperatorEnvVarValue(ns string, key string) func() string {
+ return func() string {
+ pod := OperatorPod(ns)()
+ if pod == nil || len(pod.Spec.Containers) == 0 {
+ return ""
+ }
+ envvars := pod.Spec.Containers[0].Env
+ for _, v := range envvars {
+ if v.Name == key {
+ return v.Value
+ }
+ }
+
+ return ""
+ }
+}
+
func Configmap(ns string, name string) func() *corev1.ConfigMap {
return func() *corev1.ConfigMap {
cm := corev1.ConfigMap{
@@ -1249,6 +1290,32 @@ func CreatePlainTextSecret(ns string, name string, data map[string]string) error
return TestClient().Create(TestContext, &sec)
}
+//
+// Finds a secret in the given namespace by name or prefix of name
+//
+func SecretByName(ns string, prefix string) func() *corev1.Secret {
+ return func() *corev1.Secret {
+ secretList, err := TestClient().CoreV1().Secrets(ns).List(TestContext, metav1.ListOptions{})
+ if err != nil && k8serrors.IsNotFound(err) {
+ return nil
+ } else if err != nil {
+ failTest(err)
+ }
+
+ if len(secretList.Items) == 0 {
+ return nil
+ }
+
+ for _, secret := range secretList.Items {
+ if strings.HasPrefix(secret.Name, prefix) {
+ return &secret
+ }
+ }
+
+ return nil
+ }
+}
+
func KnativeService(ns string, name string) func() *servingv1.Service {
return func() *servingv1.Service {
answer := servingv1.Service{
diff --git a/e2e/support/util/dump.go b/e2e/support/util/dump.go
index 2a069c637..847821c2a 100644
--- a/e2e/support/util/dump.go
+++ b/e2e/support/util/dump.go
@@ -138,7 +138,7 @@ func Dump(ctx context.Context, c client.Client, ns string, t *testing.T) error {
return err
}
- t.Logf("\nFound %d pods:\n", len(lst.Items))
+ t.Logf("\nFound %d pods in %q:\n", len(lst.Items), ns)
for _, pod := range lst.Items {
t.Logf("name=%s\n", pod.Name)
@@ -216,7 +216,7 @@ func Dump(ctx context.Context, c client.Client, ns string, t *testing.T) error {
return err
}
- t.Logf("\nFound %d pods:\n", len(lst.Items))
+ t.Logf("\nFound %d pods in global namespace %q:\n", len(lst.Items), opns)
for _, pod := range lst.Items {
if !strings.Contains(pod.Name, "camel-k") {
// ignore other global operators
@@ -252,11 +252,17 @@ func dumpConditions(prefix string, conditions []corev1.PodCondition, t *testing.
}
func dumpLogs(ctx context.Context, c client.Client, prefix string, ns string, name string, container string, t *testing.T) error {
- lines := int64(50)
- stream, err := c.CoreV1().Pods(ns).GetLogs(name, &corev1.PodLogOptions{
+ logOptions := &corev1.PodLogOptions{
Container: container,
- TailLines: &lines,
- }).Stream(ctx)
+ }
+
+ if os.Getenv("CAMEL_K_LOG_LEVEL") != "debug" {
+ // If not in debug mode then curtail the dumping of log lines
+ lines := int64(50)
+ logOptions.TailLines = &lines
+ }
+
+ stream, err := c.CoreV1().Pods(ns).GetLogs(name, logOptions).Stream(ctx)
if err != nil {
return err
}
diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go
index 6cec424d6..e789fb9b7 100644
--- a/pkg/cmd/version.go
+++ b/pkg/cmd/version.go
@@ -31,6 +31,7 @@ import (
"github.com/apache/camel-k/pkg/client"
platformutil "github.com/apache/camel-k/pkg/platform"
"github.com/apache/camel-k/pkg/util/defaults"
+ "github.com/apache/camel-k/pkg/util/log"
)
// VersionVariant may be overridden at build time.
@@ -155,7 +156,9 @@ func operatorInfo(ctx context.Context, c client.Client, namespace string) (map[s
}
}
- return fromCamelCase(infos), nil
+ ccInfo := fromCamelCase(infos)
+ log.Debugf("Operator Info for namespace %s: %v", namespace, ccInfo)
+ return ccInfo, nil
}
func fromCamelCase(infos map[string]string) map[string]string {
diff --git a/pkg/controller/integrationkit/integrationkit_controller.go b/pkg/controller/integrationkit/integrationkit_controller.go
index 02a5c7ce8..cdb41fe11 100644
--- a/pkg/controller/integrationkit/integrationkit_controller.go
+++ b/pkg/controller/integrationkit/integrationkit_controller.go
@@ -191,6 +191,7 @@ func (r *reconcileIntegrationKit) Reconcile(ctx context.Context, request reconci
// Make sure the operator is allowed to act on namespace
if ok, err := platform.IsOperatorAllowedOnNamespace(ctx, r.client, request.Namespace); err != nil {
+ log.Debugf("Error occurred when checking whether operator is allowed in namespace %s: %v", request.Namespace, err)
return reconcile.Result{}, err
} else if !ok {
rlog.Info("Ignoring request because namespace is locked")
@@ -221,6 +222,7 @@ func (r *reconcileIntegrationKit) Reconcile(ctx context.Context, request reconci
targetLog := rlog.ForIntegrationKit(target)
if target.Status.Phase == v1.IntegrationKitPhaseNone || target.Status.Phase == v1.IntegrationKitPhaseWaitingForPlatform {
+ rlog.Debug("Preparing to shift integration kit phase")
if target.Labels[v1.IntegrationKitTypeLabel] == v1.IntegrationKitTypeExternal {
target.Status.Phase = v1.IntegrationKitPhaseInitialization
return r.update(ctx, &instance, target)
@@ -236,6 +238,7 @@ func (r *reconcileIntegrationKit) Reconcile(ctx context.Context, request reconci
if instance.Status.Phase != target.Status.Phase {
if err != nil {
+ rlog.Debugf("Error occurred while searching for platform. Cannot advance phase until cleared: %v", err)
target.Status.SetErrorCondition(v1.IntegrationKitConditionPlatformAvailable, v1.IntegrationKitConditionPlatformAvailableReason, err)
}
diff --git a/pkg/platform/defaults.go b/pkg/platform/defaults.go
index 9e41d82cc..f1168c623 100644
--- a/pkg/platform/defaults.go
+++ b/pkg/platform/defaults.go
@@ -55,6 +55,7 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl
// update missing fields in the resource
if p.Status.Cluster == "" {
+ log.Debugf("Integration Platform [%s]: setting cluster status", p.Namespace)
// determine the kind of cluster the platform is installed into
isOpenShift, err := openshift.IsOpenShift(c)
switch {
@@ -68,6 +69,7 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl
}
if p.Status.Build.PublishStrategy == "" {
+ log.Debugf("Integration Platform [%s]: setting publishing strategy", p.Namespace)
if p.Status.Cluster == v1.IntegrationPlatformClusterOpenShift {
p.Status.Build.PublishStrategy = v1.IntegrationPlatformBuildPublishStrategyS2I
} else {
@@ -76,6 +78,7 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl
}
if p.Status.Build.BuildStrategy == "" {
+ log.Debugf("Integration Platform [%s]: setting build strategy", p.Namespace)
// Use the fastest strategy that they support (routine when possible)
if p.Status.Build.PublishStrategy == v1.IntegrationPlatformBuildPublishStrategyS2I ||
p.Status.Build.PublishStrategy == v1.IntegrationPlatformBuildPublishStrategySpectrum {
@@ -114,6 +117,7 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl
}
func CreateBuilderServiceAccount(ctx context.Context, client client.Client, p *v1.IntegrationPlatform) error {
+ log.Debugf("Integration Platform [%s]: creating build service account", p.Namespace)
sa := corev1.ServiceAccount{}
key := ctrl.ObjectKey{
Name: BuilderServiceAccount,
@@ -132,6 +136,7 @@ func configureRegistry(ctx context.Context, c client.Client, p *v1.IntegrationPl
if p.Status.Cluster == v1.IntegrationPlatformClusterOpenShift &&
p.Status.Build.PublishStrategy != v1.IntegrationPlatformBuildPublishStrategyS2I &&
p.Status.Build.Registry.Address == "" {
+ log.Debugf("Integration Platform [%s]: setting registry address", p.Namespace)
// Default to using OpenShift internal container images registry when using a strategy other than S2I
p.Status.Build.Registry.Address = "image-registry.openshift-image-registry.svc:5000"
@@ -140,10 +145,12 @@ func configureRegistry(ctx context.Context, c client.Client, p *v1.IntegrationPl
if err != nil {
return err
}
+ log.Debugf("Integration Platform [%s]: setting registry certificate authority", p.Namespace)
p.Status.Build.Registry.CA = cm.Name
// Default to using the registry secret that's configured for the builder service account
if p.Status.Build.Registry.Secret == "" {
+ log.Debugf("Integration Platform [%s]: setting registry secret", p.Namespace)
// Bind the required role to push images to the registry
err := createBuilderRegistryRoleBinding(ctx, c, p)
if err != nil {
@@ -174,23 +181,30 @@ func configureRegistry(ctx context.Context, c client.Client, p *v1.IntegrationPl
p.Status.Build.Registry.Address = *address
}
}
+
+ log.Debugf("Final Registry Address: %s", p.Status.Build.Registry.Address)
return nil
}
func setPlatformDefaults(p *v1.IntegrationPlatform, verbose bool) error {
if p.Status.Build.PublishStrategyOptions == nil {
+ log.Debugf("Integration Platform [%s]: setting publish strategy options", p.Namespace)
p.Status.Build.PublishStrategyOptions = map[string]string{}
}
if p.Status.Build.RuntimeVersion == "" {
+ log.Debugf("Integration Platform [%s]: setting runtime version", p.Namespace)
p.Status.Build.RuntimeVersion = defaults.DefaultRuntimeVersion
}
if p.Status.Build.BaseImage == "" {
+ log.Debugf("Integration Platform [%s]: setting base image", p.Namespace)
p.Status.Build.BaseImage = defaults.BaseImage()
}
if p.Status.Build.Maven.LocalRepository == "" {
+ log.Debugf("Integration Platform [%s]: setting local repository", p.Namespace)
p.Status.Build.Maven.LocalRepository = defaults.LocalRepository
}
if len(p.Status.Build.Maven.CLIOptions) == 0 {
+ log.Debugf("Integration Platform [%s]: setting CLI options", p.Namespace)
p.Status.Build.Maven.CLIOptions = []string{
"-V",
"--no-transfer-progress",
@@ -198,6 +212,7 @@ func setPlatformDefaults(p *v1.IntegrationPlatform, verbose bool) error {
}
}
if _, ok := p.Status.Build.PublishStrategyOptions[builder.KanikoPVCName]; !ok {
+ log.Debugf("Integration Platform [%s]: setting publish strategy options", p.Namespace)
p.Status.Build.PublishStrategyOptions[builder.KanikoPVCName] = p.Name
}
@@ -208,6 +223,7 @@ func setPlatformDefaults(p *v1.IntegrationPlatform, verbose bool) error {
log.Log.Infof("Build timeout minimum unit is sec (configured: %s, truncated: %s)", p.Status.Build.GetTimeout().Duration, d)
}
+ log.Debugf("Integration Platform [%s]: setting build timeout", p.Namespace)
p.Status.Build.Timeout = &metav1.Duration{
Duration: d,
}
@@ -230,6 +246,7 @@ func setPlatformDefaults(p *v1.IntegrationPlatform, verbose bool) error {
}
if len(p.Status.Kamelet.Repositories) == 0 {
+ log.Debugf("Integration Platform [%s]: setting kamelet repositories", p.Namespace)
p.Status.Kamelet.Repositories = append(p.Status.Kamelet.Repositories, v1.IntegrationPlatformKameletRepositorySpec{
URI: repository.DefaultRemoteRepository,
})
@@ -248,11 +265,14 @@ func setPlatformDefaults(p *v1.IntegrationPlatform, verbose bool) error {
func setStatusAdditionalInfo(platform *v1.IntegrationPlatform) {
platform.Status.Info = make(map[string]string)
+
+ log.Debugf("Integration Platform [%s]: setting build publish strategy", platform.Namespace)
if platform.Spec.Build.PublishStrategy == v1.IntegrationPlatformBuildPublishStrategyBuildah {
platform.Status.Info["buildahVersion"] = defaults.BuildahVersion
} else if platform.Spec.Build.PublishStrategy == v1.IntegrationPlatformBuildPublishStrategyKaniko {
platform.Status.Info["kanikoVersion"] = defaults.KanikoVersion
}
+ log.Debugf("Integration Platform [%s]: setting status info", platform.Namespace)
platform.Status.Info["goVersion"] = runtime.Version()
platform.Status.Info["goOS"] = runtime.GOOS
platform.Status.Info["gitCommit"] = defaults.GitCommit
diff --git a/pkg/platform/operator.go b/pkg/platform/operator.go
index 2f6f2cff6..39008d423 100644
--- a/pkg/platform/operator.go
+++ b/pkg/platform/operator.go
@@ -30,6 +30,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/predicate"
+ "github.com/apache/camel-k/pkg/util/log"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
)
@@ -46,8 +47,11 @@ var OperatorImage string
// IsCurrentOperatorGlobal returns true if the operator is configured to watch all namespaces.
func IsCurrentOperatorGlobal() bool {
if watchNamespace, envSet := os.LookupEnv(OperatorWatchNamespaceEnvVariable); !envSet || strings.TrimSpace(watchNamespace) == "" {
+ log.Debug("Operator is global to all namespaces")
return true
}
+
+ log.Debug("Operator is local to namespace")
return false
}
@@ -118,6 +122,7 @@ func IsOperatorAllowedOnNamespace(ctx context.Context, c ctrl.Reader, namespace
// allow global operators that use a proper operator id
if defaults.OperatorID() != "" {
+ log.Debugf("Operator ID: %s", defaults.OperatorID())
return true, nil
}
@@ -128,8 +133,11 @@ func IsOperatorAllowedOnNamespace(ctx context.Context, c ctrl.Reader, namespace
}
alreadyOwned, err := IsNamespaceLocked(ctx, c, namespace)
if err != nil {
+ log.Debugf("Error occurred while testing whether namespace is locked: %v", err)
return false, err
}
+
+ log.Debugf("Lock status of namespace %s: %t", namespace, alreadyOwned)
return !alreadyOwned, nil
}
diff --git a/pkg/platform/platform.go b/pkg/platform/platform.go
index 0f76690f6..2c354a4ba 100644
--- a/pkg/platform/platform.go
+++ b/pkg/platform/platform.go
@@ -22,6 +22,7 @@ import (
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/util/kubernetes"
+ "github.com/apache/camel-k/pkg/util/log"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
)
@@ -139,6 +140,8 @@ func findAny(ctx context.Context, c k8sclient.Reader, namespace string, active b
// findLocal returns the currently installed platform or any platform existing in local namespace.
func findLocal(ctx context.Context, c k8sclient.Reader, namespace string, active bool) (*v1.IntegrationPlatform, error) {
+ log.Debug("Finding available platforms")
+
lst, err := ListPrimaryPlatforms(ctx, c, namespace)
if err != nil {
return nil, err
@@ -147,6 +150,7 @@ func findLocal(ctx context.Context, c k8sclient.Reader, namespace string, active
for _, platform := range lst.Items {
platform := platform // pin
if IsActive(&platform) {
+ log.Debugf("Found active local integration platform %s", platform.Name)
return &platform, nil
}
}
@@ -154,9 +158,11 @@ func findLocal(ctx context.Context, c k8sclient.Reader, namespace string, active
if !active && len(lst.Items) > 0 {
// does not require the platform to be active, just return one if present
res := lst.Items[0]
+ log.Debugf("Found local integration platform %s", res.Name)
return &res, nil
}
+ log.Debugf("Not found a local integration platform")
return nil, k8serrors.NewNotFound(v1.Resource("IntegrationPlatform"), DefaultPlatformName)
}
diff --git a/pkg/util/kubernetes/client.go b/pkg/util/kubernetes/client.go
index 62261a212..9d0a896eb 100644
--- a/pkg/util/kubernetes/client.go
+++ b/pkg/util/kubernetes/client.go
@@ -30,11 +30,14 @@ import (
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/client"
+ "github.com/apache/camel-k/pkg/util/log"
)
func GetIntegrationPlatform(context context.Context, client ctrl.Reader, name string, namespace string) (*v1.IntegrationPlatform, error) {
platform := v1.NewIntegrationPlatform(namespace, name)
+ log.Debugf("Integration Platform [name: %s], [namespace: %s], [objectkey: %s]", name, namespace, ctrl.ObjectKeyFromObject(&platform))
if err := client.Get(context, ctrl.ObjectKeyFromObject(&platform), &platform); err != nil {
+ log.Debugf("Integration platform Error: %v", err)
return nil, err
}
@@ -43,7 +46,9 @@ func GetIntegrationPlatform(context context.Context, client ctrl.Reader, name st
func GetIntegrationKit(context context.Context, client ctrl.Reader, name string, namespace string) (*v1.IntegrationKit, error) {
kit := v1.NewIntegrationKit(namespace, name)
+ log.Debugf("Integration Kit [name: %s], [namespace: %s], [objectkey: %s]", name, namespace, ctrl.ObjectKeyFromObject(kit))
if err := client.Get(context, ctrl.ObjectKeyFromObject(kit), kit); err != nil {
+ log.Debugf("Integration kit Error: %v", err)
return nil, err
}
@@ -52,7 +57,9 @@ func GetIntegrationKit(context context.Context, client ctrl.Reader, name string,
func GetBuild(context context.Context, client client.Client, name string, namespace string) (*v1.Build, error) {
build := v1.NewBuild(namespace, name)
+ log.Debugf("Build [name: %s], [namespace: %s], [objectkey: %s]", name, namespace, ctrl.ObjectKeyFromObject(build))
if err := client.Get(context, ctrl.ObjectKeyFromObject(build), build); err != nil {
+ log.Debugf("Integration build Error: %v", err)
return nil, err
}
diff --git a/script/Makefile b/script/Makefile
index fe3c5957c..475c39afc 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -75,7 +75,7 @@ OPM := opm
# Used to push pre-release artifacts
STAGING_IMAGE_NAME := docker.io/camelk/camel-k
-STAGING_RUNTIME_REPO :=
+STAGING_RUNTIME_REPO :=
# Define here the repo containing the default Kamelet catalog (if any)
KAMELET_CATALOG_REPO := https://github.com/apache/camel-kamelets.git
@@ -260,24 +260,24 @@ test-fmt: do-build
#
test-integration: do-build
FAILED=0; STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \
- go test -timeout 60m -v ./e2e/global/common -tags=integration $(TEST_INTEGRATION_COMMON_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
- go test -timeout 60m -v ./e2e/global/common/build -tags=integration $(TEST_INTEGRATION_COMMON_BUILD_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
- go test -timeout 60m -v ./e2e/global/common/config -tags=integration $(TEST_INTEGRATION_COMMON_CONFIG_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
- go test -timeout 60m -v ./e2e/global/common/languages -tags=integration $(TEST_INTEGRATION_COMMON_LANG_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
- go test -timeout 60m -v ./e2e/global/common/traits -tags=integration $(TEST_INTEGRATION_COMMON_TRAITS_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
+ go test -timeout 90m -v ./e2e/global/common -tags=integration $(TEST_INTEGRATION_COMMON_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
+ go test -timeout 90m -v ./e2e/global/common/build -tags=integration $(TEST_INTEGRATION_COMMON_BUILD_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
+ go test -timeout 90m -v ./e2e/global/common/config -tags=integration $(TEST_INTEGRATION_COMMON_CONFIG_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
+ go test -timeout 90m -v ./e2e/global/common/languages -tags=integration $(TEST_INTEGRATION_COMMON_LANG_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
+ go test -timeout 90m -v ./e2e/global/common/traits -tags=integration $(TEST_INTEGRATION_COMMON_TRAITS_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
exit $${FAILED}
test-knative: do-build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/global/knative -tags=integration $(TEST_KNATIVE_RUN) -json 2>&1 | gotestfmt
+ go test -timeout 90m -v ./e2e/global/knative -tags=integration $(TEST_KNATIVE_RUN) -json 2>&1 | gotestfmt
test-builder: do-build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/global/builder -tags=integration $(TEST_BUILDER_RUN) -json 2>&1 | gotestfmt
+ go test -timeout 90m -v ./e2e/global/builder -tags=integration $(TEST_BUILDER_RUN) -json 2>&1 | gotestfmt
test-service-binding: do-build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/global/service-binding -tags=integration $(TEST_SERVICE_RUN) -json 2>&1 | gotestfmt
+ go test -timeout 90m -v ./e2e/global/service-binding -tags=integration $(TEST_SERVICE_RUN) -json 2>&1 | gotestfmt
test-local: do-build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
@@ -285,7 +285,7 @@ test-local: do-build
test-registry-maven-wagon: do-build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/global/registry -tags=integration $(TEST_REGISTRY_MAVEN_WAGON_RUN) -json 2>&1 | gotestfmt
+ go test -timeout 90m -v ./e2e/global/registry -tags=integration $(TEST_REGISTRY_MAVEN_WAGON_RUN) -json 2>&1 | gotestfmt
###############################
#
@@ -295,18 +295,18 @@ test-registry-maven-wagon: do-build
test-install: do-build
FAILED=0; STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \
- go test -timeout 60m -v ./e2e/namespace/install/ -tags=integration $(TEST_INSTALL_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
- go test -timeout 60m -v ./e2e/namespace/install/cli -tags=integration $(TEST_INSTALL_CLI_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
- go test -timeout 60m -v ./e2e/namespace/install/kustomize -tags=integration $(TEST_INSTALL_KUSTOMIZE_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
+ go test -timeout 90m -v ./e2e/namespace/install/ -tags=integration $(TEST_INSTALL_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
+ go test -timeout 90m -v ./e2e/namespace/install/cli -tags=integration $(TEST_INSTALL_CLI_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
+ go test -timeout 90m -v ./e2e/namespace/install/kustomize -tags=integration $(TEST_INSTALL_KUSTOMIZE_RUN) -json 2>&1 | gotestfmt || FAILED=1; \
exit $${FAILED}
test-quarkus-native: do-build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/namespace/native -tags=integration $(TEST_QUARKUS_RUN) -json 2>&1 | gotestfmt
+ go test -timeout 90m -v ./e2e/namespace/native -tags=integration $(TEST_QUARKUS_RUN) -json 2>&1 | gotestfmt
test-upgrade: do-build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/namespace/upgrade -tags=integration $(TEST_UPGRADE_RUN) -json 2>&1 | gotestfmt
+ go test -timeout 90m -v ./e2e/namespace/upgrade -tags=integration $(TEST_UPGRADE_RUN) -json 2>&1 | gotestfmt
build-kamel:
@echo "####### Building kamel CLI..."
[camel-k] 09/13: (e2e): Exposes maven-cli-options to allow maven build debugging
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit ef5c8f598005e49a4379d0e8a90226f57ca3feb6
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Fri Sep 30 22:43:43 2022 +0100
(e2e): Exposes maven-cli-options to allow maven build debugging
* test_support.go
* When installing for the tests, handle CAMEL_K_TEST_MAVEN_CLI_OPTIONS
to inject maven-cli options specified by the tests
* If e2e tests have a log-level of debug then set the maven-cli-options
to "-X" to retrieve debugging from maven builds
* Renames CAMEL_K_LOG_LEVEL with TEST prefix
---
.github/actions/e2e-builder/exec-tests.sh | 5 ++++-
.github/actions/e2e-common/exec-tests.sh | 5 ++++-
.github/actions/e2e-install/exec-tests.sh | 5 ++++-
.github/actions/e2e-knative-yaks/exec-tests.sh | 5 ++++-
.github/actions/e2e-knative/exec-tests.sh | 5 ++++-
.github/actions/e2e-upgrade/exec-tests.sh | 5 ++++-
e2e/support/test_support.go | 21 ++++++++++++++++++---
e2e/support/util/dump.go | 2 +-
8 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/.github/actions/e2e-builder/exec-tests.sh b/.github/actions/e2e-builder/exec-tests.sh
index 44501de07..a622897a3 100755
--- a/.github/actions/e2e-builder/exec-tests.sh
+++ b/.github/actions/e2e-builder/exec-tests.sh
@@ -117,7 +117,10 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
-export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
+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}
diff --git a/.github/actions/e2e-common/exec-tests.sh b/.github/actions/e2e-common/exec-tests.sh
index 8b687ba2a..0373a9971 100755
--- a/.github/actions/e2e-common/exec-tests.sh
+++ b/.github/actions/e2e-common/exec-tests.sh
@@ -117,7 +117,10 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
-export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
+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}
diff --git a/.github/actions/e2e-install/exec-tests.sh b/.github/actions/e2e-install/exec-tests.sh
index f85b44c67..44d5b75b3 100755
--- a/.github/actions/e2e-install/exec-tests.sh
+++ b/.github/actions/e2e-install/exec-tests.sh
@@ -115,7 +115,10 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
-export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
+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}
diff --git a/.github/actions/e2e-knative-yaks/exec-tests.sh b/.github/actions/e2e-knative-yaks/exec-tests.sh
index a6075dbbc..5fe7592ef 100755
--- a/.github/actions/e2e-knative-yaks/exec-tests.sh
+++ b/.github/actions/e2e-knative-yaks/exec-tests.sh
@@ -114,7 +114,10 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
-export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
+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}
diff --git a/.github/actions/e2e-knative/exec-tests.sh b/.github/actions/e2e-knative/exec-tests.sh
index 0e3d94517..aa365c96a 100755
--- a/.github/actions/e2e-knative/exec-tests.sh
+++ b/.github/actions/e2e-knative/exec-tests.sh
@@ -118,7 +118,10 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
-export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
+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}
diff --git a/.github/actions/e2e-upgrade/exec-tests.sh b/.github/actions/e2e-upgrade/exec-tests.sh
index 367a578bc..38dd6a626 100755
--- a/.github/actions/e2e-upgrade/exec-tests.sh
+++ b/.github/actions/e2e-upgrade/exec-tests.sh
@@ -115,7 +115,10 @@ export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
# Despite building a bundle we don't want it installed immediately so no OLM_INDEX_BUNDLE var
# Configure test options
-export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
+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_PREV_IIB=quay.io/operatorhubio/catalog:latest
export CAMEL_K_NEW_IIB=${BUNDLE_INDEX_IMAGE}
export CAMEL_K_PREV_UPGRADE_CHANNEL=${PREV_XY_CHANNEL}
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index aa1761d75..d363b620c 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -250,12 +250,27 @@ func KamelInstallWithContext(ctx context.Context, operatorID string, namespace s
installArgs = []string{"install", "-n", namespace, "--operator-id", operatorID}
}
- logLevel := os.Getenv("CAMEL_K_LOG_LEVEL")
+ logLevel := os.Getenv("CAMEL_K_TEST_LOG_LEVEL")
if len(logLevel) > 0 {
fmt.Printf("Setting log-level to %s\n", logLevel)
installArgs = append(installArgs, "--log-level", logLevel)
}
+ mvnCLIOptions := os.Getenv("CAMEL_K_TEST_MAVEN_CLI_OPTIONS")
+ if len(mvnCLIOptions) > 0 {
+ // Split the string by spaces
+ mvnCLIArr := strings.Split(mvnCLIOptions, " ")
+ for _, mc := range mvnCLIArr {
+ mc = strings.Trim(mc, " ")
+ if len(mc) == 0 {
+ continue
+ }
+
+ fmt.Printf("Adding maven cli option %s\n", mc)
+ installArgs = append(installArgs, "--maven-cli-option", mc)
+ }
+ }
+
installArgs = append(installArgs, args...)
return KamelWithContext(ctx, installArgs...)
}
@@ -324,7 +339,7 @@ func KamelWithContext(ctx context.Context, args ...string) *cobra.Command {
var c *cobra.Command
var err error
- if os.Getenv("CAMEL_K_LOG_LEVEL") == "debug" {
+ if os.Getenv("CAMEL_K_TEST_LOG_LEVEL") == "debug" {
fmt.Printf("Executing kamel with command %+q\n", args)
fmt.Println("Printing stack for KamelWithContext")
debug.PrintStack()
@@ -472,7 +487,7 @@ func StructuredLogs(ns, podName string, options *corev1.PodLogOptions, ignorePar
err := json.Unmarshal([]byte(t), &entry)
if err != nil {
if ignoreParseErrors {
- fmt.Printf("Warning: Ignoring parse error for logging line: '%s'\n", t)
+ fmt.Printf("Warning: Ignoring parse error for logging line: %q\n", t)
continue
} else {
msg := fmt.Sprintf("Unable to parse structured content: %s", t)
diff --git a/e2e/support/util/dump.go b/e2e/support/util/dump.go
index 847821c2a..d5da6fa99 100644
--- a/e2e/support/util/dump.go
+++ b/e2e/support/util/dump.go
@@ -256,7 +256,7 @@ func dumpLogs(ctx context.Context, c client.Client, prefix string, ns string, na
Container: container,
}
- if os.Getenv("CAMEL_K_LOG_LEVEL") != "debug" {
+ if os.Getenv("CAMEL_K_TEST_LOG_LEVEL") != "debug" {
// If not in debug mode then curtail the dumping of log lines
lines := int64(50)
logOptions.TailLines = &lines
[camel-k] 13/13: fix(e2e): Stop go panic if pod or pod status is not initialised
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit d82ae431e6ecdb541c6afa17b68849b586d0d71a
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Tue Oct 4 12:19:51 2022 +0100
fix(e2e): Stop go panic if pod or pod status is not initialised
* While checking for the catalogue source pod, the function needs to
assume that the pod may not yet exist.
---
e2e/namespace/upgrade/util.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/e2e/namespace/upgrade/util.go b/e2e/namespace/upgrade/util.go
index 42da566cc..7707ca72c 100644
--- a/e2e/namespace/upgrade/util.go
+++ b/e2e/namespace/upgrade/util.go
@@ -145,7 +145,7 @@ func catalogSourcePodRunning(ns, csName string) error {
for i := 1; i < 5; i++ {
csPod := podFunc()
- if csPod.Status.Phase == "Running" {
+ if csPod != nil && csPod.Status.Phase == "Running" {
return nil // Pod good to go
}
[camel-k] 02/13: fix(platform) Incorrect order of parameters
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 11ea8f6168bd335ab81e06b2fee6189209a81e19
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Fri Aug 12 23:22:47 2022 +0100
fix(platform) Incorrect order of parameters
---
pkg/platform/platform.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pkg/platform/platform.go b/pkg/platform/platform.go
index 83acfc3c8..0f76690f6 100644
--- a/pkg/platform/platform.go
+++ b/pkg/platform/platform.go
@@ -100,7 +100,7 @@ func getOrFindAny(ctx context.Context, c k8sclient.Reader, namespace string, nam
// getOrFindLocal returns the named platform or any other platform in the local namespace.
func getOrFindLocal(ctx context.Context, c k8sclient.Reader, namespace string, name string, active bool) (*v1.IntegrationPlatform, error) {
if name != "" {
- return get(ctx, c, name, namespace)
+ return get(ctx, c, namespace, name)
}
return findLocal(ctx, c, namespace, active)
[camel-k] 10/13: (e2e): Increases the download dependency timeout
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 9257d478cda83900f2cae9bae9deca12b63135a2
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Mon Oct 3 16:43:44 2022 +0100
(e2e): Increases the download dependency timeout
* The default timeout for download timeouts was so quick as to make the
test prone to failure. Increasing this timeout allows for more reliable
tests.
---
pkg/cmd/run_support.go | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/pkg/cmd/run_support.go b/pkg/cmd/run_support.go
index a25ca31b3..e929a67f3 100644
--- a/pkg/cmd/run_support.go
+++ b/pkg/cmd/run_support.go
@@ -28,6 +28,7 @@ import (
"path/filepath"
"reflect"
"strings"
+ "time"
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/client"
@@ -176,7 +177,10 @@ func fromMapToProperties(data interface{}, toString func(reflect.Value) string,
// downloadDependency downloads the file located at the given URL into a temporary folder and returns the local path to the generated temporary file.
func downloadDependency(ctx context.Context, url url.URL) (string, error) {
- req, err := http.NewRequestWithContext(ctx, http.MethodGet, url.String(), nil)
+ tctx, cancel := context.WithTimeout(ctx, 3*time.Second)
+ defer cancel()
+
+ req, err := http.NewRequestWithContext(tctx, http.MethodGet, url.String(), nil)
if err != nil {
return "", err
}
[camel-k] 05/13: (e2e): Mark KameletClasspathLoading test as temporarily problematic
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit f9637d67544820471efe77e5271cbddc018bf7a8
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Thu Sep 22 13:37:21 2022 +0100
(e2e): Mark KameletClasspathLoading test as temporarily problematic
* See issue #3667 for details
* Can re-enable once solution has been concluded
---
e2e/global/common/kamelet_test.go | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/e2e/global/common/kamelet_test.go b/e2e/global/common/kamelet_test.go
index 5c4242fd3..e6b8834fb 100644
--- a/e2e/global/common/kamelet_test.go
+++ b/e2e/global/common/kamelet_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package common
import (
+ "os"
"testing"
. "github.com/onsi/gomega"
@@ -31,7 +32,15 @@ import (
. "github.com/apache/camel-k/e2e/support"
)
+/*
+ * This seems to be problematic in a global context
+ * See https://github.com/apache/camel-k/issues/3667 for details
+ */
func TestKameletClasspathLoading(t *testing.T) {
+ if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
+ t.Skip("WARNING: Test marked as problematic ... skipping")
+ }
+
WithNewTestNamespace(t, func(ns string) {
operatorID := "camel-k-kamelet"
Expect(KamelInstallWithID(operatorID, ns).Execute()).To(Succeed())
[camel-k] 03/13: fix(bundle): Small fixes for bundle generation
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit eed9cbeab9b55756870c3672830046996c83bf31
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Wed Sep 21 16:42:13 2022 +0100
fix(bundle): Small fixes for bundle generation
* Bump the operator-sdk version to 1.16 as being used to perform the
generation
* Updates the samples to the correct syntax
---
config/manifests/bases/camel-k.clusterserviceversion.yaml | 2 +-
script/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/manifests/bases/camel-k.clusterserviceversion.yaml b/config/manifests/bases/camel-k.clusterserviceversion.yaml
index e33d68c07..79272fd23 100644
--- a/config/manifests/bases/camel-k.clusterserviceversion.yaml
+++ b/config/manifests/bases/camel-k.clusterserviceversion.yaml
@@ -26,7 +26,7 @@ metadata:
createdAt: 2022-09-05T12:56:17Z
description: Apache Camel K is a lightweight integration platform, born on Kubernetes,
with serverless superpowers.
- operators.operatorframework.io/builder: operator-sdk-v1.3.0
+ operators.operatorframework.io/builder: operator-sdk-v1.16.0
operators.operatorframework.io/internal-objects: '["builds.camel.apache.org","integrationkits.camel.apache.org","camelcatalogs.camel.apache.org"]'
operators.operatorframework.io/project_layout: go.kubebuilder.io/v2
repository: https://github.com/apache/camel-k
diff --git a/script/Makefile b/script/Makefile
index afba2fa97..fe3c5957c 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -23,7 +23,7 @@ KANIKO_VERSION := 0.17.1
INSTALL_DEFAULT_KAMELETS := true
CONTROLLER_GEN_VERSION := v0.6.1
CODEGEN_VERSION := v0.23.5
-OPERATOR_SDK_VERSION := v1.14.0
+OPERATOR_SDK_VERSION := v1.16.0
KUSTOMIZE_VERSION := v4.1.2
OPM_VERSION := v1.24.0
BASE_IMAGE := docker.io/adoptopenjdk/openjdk11:slim
[camel-k] 08/13: (e2e): Modify error of operator uninstall to warning
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 70e731405f46bb21113d79131b6c73700c8b186e
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Wed Sep 28 12:05:06 2022 +0100
(e2e): Modify error of operator uninstall to warning
* If operator is not uninstalled successfully then provide a warning
rather than throw an error as we want to try to keep the tests going
---
.github/actions/kamel-cleanup/uninstall-global-operator.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/actions/kamel-cleanup/uninstall-global-operator.sh b/.github/actions/kamel-cleanup/uninstall-global-operator.sh
index ba02a9089..94bec52f0 100755
--- a/.github/actions/kamel-cleanup/uninstall-global-operator.sh
+++ b/.github/actions/kamel-cleanup/uninstall-global-operator.sh
@@ -108,8 +108,8 @@ while eval "${command}"
do
((i++))
if [ "${i}" -gt "${timeout}" ]; then
- echo "kamel operator not successfully uninstalled, aborting due to ${timeout}s timeout"
- exit 1
+ echo "Warning: kamel operator not successfully uninstalled, aborting due to ${timeout}s timeout"
+ exit 0
fi
sleep 1
[camel-k] 06/13: (e2e): Refactor config test
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 62dee44e4e322d379f38ace0aa17c9524e25e7f4
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Thu Sep 22 21:32:38 2022 +0100
(e2e): Refactor config test
* Separate test tasks into separate tests in different namespaces to avoid
any contamination
---
e2e/global/common/config/config_test.go | 616 ++++++++++++++++++--------------
1 file changed, 352 insertions(+), 264 deletions(-)
diff --git a/e2e/global/common/config/config_test.go b/e2e/global/common/config/config_test.go
index 38eb54e7b..e518f8a1e 100644
--- a/e2e/global/common/config/config_test.go
+++ b/e2e/global/common/config/config_test.go
@@ -27,9 +27,10 @@ import (
"io/ioutil"
"testing"
- . "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
+ . "github.com/onsi/gomega"
+
corev1 "k8s.io/api/core/v1"
. "github.com/apache/camel-k/e2e/support"
@@ -37,256 +38,326 @@ import (
"github.com/apache/camel-k/pkg/util/gzip"
)
-func TestRunConfigExamples(t *testing.T) {
+func operatorID(ns string) string {
+ return fmt.Sprintf("camel-k-%s", ns)
+}
+
+func installWithID(ns string) {
+ Expect(KamelInstallWithID(operatorID(ns), ns).Execute()).To(Succeed())
+}
+
+func TestRunConfigExampleSimpleProperty(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- Expect(KamelInstallWithID(operatorID, ns).Execute()).To(Succeed())
+ installWithID(ns)
// Properties
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-route.groovy", "-p", "my.message=test-property").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("test-property"))
+ })
+}
- t.Run("Simple property", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/property-route.groovy", "-p", "my.message=test-property").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("test-property"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+func TestRunConfigExamplePropertyFile(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
- t.Run("Property file", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/property-file-route.groovy", "--property", "file:./files/my.properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello world"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-file-route.groovy", "--property", "file:./files/my.properties").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello world"))
+ })
+}
- t.Run("Property precedence", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/property-file-route.groovy", "-p", "my.key.2=universe", "-p", "file:./files/my.properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello universe"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+func TestRunConfigExamplePropertyPrecedence(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
- t.Run("Property from ConfigMap", func(t *testing.T) {
- var cmData = make(map[string]string)
- cmData["my.message"] = "my-configmap-property-value"
- CreatePlainTextConfigmap(ns, "my-cm-test-property", cmData)
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-file-route.groovy", "-p", "my.key.2=universe", "-p", "file:./files/my.properties").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello universe"))
+ })
+}
- Expect(KamelRunWithID(operatorID, ns, "./files/property-route.groovy", "-p", "configmap:my-cm-test-property").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-configmap-property-value"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+func TestRunConfigExamplePropertyConfigMap(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
- t.Run("Property from ConfigMap as property file", func(t *testing.T) {
- var cmData = make(map[string]string)
- cmData["my.properties"] = "my.message=my-configmap-property-entry"
- CreatePlainTextConfigmap(ns, "my-cm-test-properties", cmData)
+ var cmData = make(map[string]string)
+ cmData["my.message"] = "my-configmap-property-value"
+ CreatePlainTextConfigmap(ns, "my-cm-test-property", cmData)
- Expect(KamelRunWithID(operatorID, ns, "./files/property-route.groovy", "-p", "configmap:my-cm-test-properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-configmap-property-entry"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-route.groovy", "-p", "configmap:my-cm-test-property").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-configmap-property-value"))
+ })
+}
- t.Run("Property from Secret", func(t *testing.T) {
- var secData = make(map[string]string)
- secData["my.message"] = "my-secret-property-value"
- CreatePlainTextSecret(ns, "my-sec-test-property", secData)
+func TestRunConfigExampleConfigMapPropertyFile(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
- Expect(KamelRunWithID(operatorID, ns, "./files/property-route.groovy", "-p", "secret:my-sec-test-property").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-property-value"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+ var cmData = make(map[string]string)
+ cmData["my.properties"] = "my.message=my-configmap-property-entry"
+ CreatePlainTextConfigmap(ns, "my-cm-test-properties", cmData)
- t.Run("Property from Secret as property file", func(t *testing.T) {
- var secData = make(map[string]string)
- secData["my.properties"] = "my.message=my-secret-property-entry"
- CreatePlainTextSecret(ns, "my-sec-test-properties", secData)
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-route.groovy", "-p", "configmap:my-cm-test-properties").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-configmap-property-entry"))
+ })
+}
- Expect(KamelRunWithID(operatorID, ns, "./files/property-route.groovy", "-p", "secret:my-sec-test-properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-property-entry"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+func TestRunConfigExamplePropertySecret(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
- // Configmap
+ var secData = make(map[string]string)
+ secData["my.message"] = "my-secret-property-value"
+ CreatePlainTextSecret(ns, "my-sec-test-property", secData)
- // Store a configmap on the cluster
- var cmData = make(map[string]string)
- cmData["my-configmap-key"] = "my-configmap-content"
- CreatePlainTextConfigmap(ns, "my-cm", cmData)
-
- // Store a configmap with multiple values
- var cmDataMulti = make(map[string]string)
- cmDataMulti["my-configmap-key"] = "should-not-see-it"
- cmDataMulti["my-configmap-key-2"] = "my-configmap-content-2"
- CreatePlainTextConfigmap(ns, "my-cm-multi", cmDataMulti)
-
- t.Run("Config configmap", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/config-configmap-route.groovy", "--config", "configmap:my-cm").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "config-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "config-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "config-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-route.groovy", "-p", "secret:my-sec-test-property").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-property-value"))
+ })
+}
- t.Run("Resource configmap", func(t *testing.T) {
- // We can reuse the configmap created previously
+func TestRunConfigExampleSecretPropertyFile(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-configmap-route.groovy", "--resource", "configmap:my-cm").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+ var secData = make(map[string]string)
+ secData["my.properties"] = "my.message=my-secret-property-entry"
+ CreatePlainTextSecret(ns, "my-sec-test-properties", secData)
- t.Run("Resource configmap with destination", func(t *testing.T) {
- // We can reuse the configmap created previously
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-route.groovy", "-p", "secret:my-sec-test-properties").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-property-entry"))
+ })
+}
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-configmap-location-route.groovy", "--resource", "configmap:my-cm@/tmp/app").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-configmap-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-configmap-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-configmap-location-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+// Store a configmap on the cluster
+func createConfigMap(ns string) map[string]string {
+ var cmData = make(map[string]string)
+ cmData["my-configmap-key"] = "my-configmap-content"
+ CreatePlainTextConfigmap(ns, "my-cm", cmData)
+ return cmData
+}
- t.Run("Resource configmap with filtered key and destination", func(t *testing.T) {
- // We'll use the configmap contaning 2 values filtering only 1 key
+// Store a configmap with multiple values
+func createMultiConfigMap(ns string) map[string]string {
+ var cmDataMulti = make(map[string]string)
+ cmDataMulti["my-configmap-key"] = "should-not-see-it"
+ cmDataMulti["my-configmap-key-2"] = "my-configmap-content-2"
+ CreatePlainTextConfigmap(ns, "my-cm-multi", cmDataMulti)
+ return cmDataMulti
+}
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-configmap-key-location-route.groovy", "--resource", "configmap:my-cm-multi/my-configmap-key-2@/tmp/app/test.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-configmap-key-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-configmap-key-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-configmap-key-location-route"), TestTimeoutShort).ShouldNot(ContainSubstring(cmDataMulti["my-configmap-key"]))
- Eventually(IntegrationLogs(ns, "resource-configmap-key-location-route"), TestTimeoutShort).Should(ContainSubstring(cmDataMulti["my-configmap-key-2"]))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+func TestRunConfigPropertyConfigMap(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+ cmData := createConfigMap(ns)
+
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/config-configmap-route.groovy", "--config", "configmap:my-cm").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "config-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "config-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "config-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
+ })
+}
+
+func TestRunConfigResourceConfigMap(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+ cmData := createConfigMap(ns)
+
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-configmap-route.groovy", "--resource", "configmap:my-cm").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "resource-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "resource-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "resource-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
+ })
+}
+
+func TestRunConfigDestinationConfigMap(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+ cmData := createConfigMap(ns)
+
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-configmap-location-route.groovy", "--resource", "configmap:my-cm@/tmp/app").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "resource-configmap-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "resource-configmap-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "resource-configmap-location-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
+ })
+}
+
+func TestRunConfigFilteredConfigMap(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+ cmDataMulti := createMultiConfigMap(ns)
+
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-configmap-key-location-route.groovy", "--resource", "configmap:my-cm-multi/my-configmap-key-2@/tmp/app/test.txt").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "resource-configmap-key-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "resource-configmap-key-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "resource-configmap-key-location-route"), TestTimeoutShort).ShouldNot(ContainSubstring(cmDataMulti["my-configmap-key"]))
+ Eventually(IntegrationLogs(ns, "resource-configmap-key-location-route"), TestTimeoutShort).Should(ContainSubstring(cmDataMulti["my-configmap-key-2"]))
+ })
+}
+
+func TestRunConfigPropertyConfigMapFile(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
// Store a configmap as property file
var cmDataProps = make(map[string]string)
cmDataProps["my.properties"] = "my.key.1=hello\nmy.key.2=world"
CreatePlainTextConfigmap(ns, "my-cm-properties", cmDataProps)
- t.Run("Config configmap as property file", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/config-configmap-properties-route.groovy", "--config", "configmap:my-cm-properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "config-configmap-properties-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "config-configmap-properties-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "config-configmap-properties-route"), TestTimeoutShort).Should(ContainSubstring("hello world"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/config-configmap-properties-route.groovy", "--config", "configmap:my-cm-properties").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "config-configmap-properties-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "config-configmap-properties-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "config-configmap-properties-route"), TestTimeoutShort).Should(ContainSubstring("hello world"))
+ })
+}
- // Secret
+func createSecret(ns string) map[string]string {
+ // Store a secret on the cluster
+ var secData = make(map[string]string)
+ secData["my-secret-key"] = "very top secret"
+ CreatePlainTextSecret(ns, "my-sec", secData)
+ return secData
+}
- // Store a secret on the cluster
- var secData = make(map[string]string)
- secData["my-secret-key"] = "very top secret"
- CreatePlainTextSecret(ns, "my-sec", secData)
-
- // Store a secret with multi values
- var secDataMulti = make(map[string]string)
- secDataMulti["my-secret-key"] = "very top secret"
- secDataMulti["my-secret-key-2"] = "even more secret"
- CreatePlainTextSecret(ns, "my-sec-multi", secDataMulti)
-
- t.Run("Config secret", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/config-secret-route.groovy", "--config", "secret:my-sec").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "config-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "config-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "config-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"]))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+func createMultiSecret(ns string) map[string]string {
+ // Store a secret with multi values
+ var secDataMulti = make(map[string]string)
+ secDataMulti["my-secret-key"] = "very top secret"
+ secDataMulti["my-secret-key-2"] = "even more secret"
+ CreatePlainTextSecret(ns, "my-sec-multi", secDataMulti)
+ return secDataMulti
+}
- t.Run("Resource secret", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-secret-route.groovy", "--resource", "secret:my-sec").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"]))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+func TestRunConfigPropertyConfigSecret(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+ secData := createSecret(ns)
- // Config File
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/config-secret-route.groovy", "--config", "secret:my-sec").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "config-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "config-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "config-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"]))
+ })
+}
- t.Run("Plain text configuration file", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/config-file-route.groovy", "--config", "file:./files/resources-data.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "config-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "config-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "config-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
+func TestRunConfigPropertyResourceSecret(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+ secData := createSecret(ns)
- t.Run("Secret with filtered key", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/config-secret-key-route.groovy", "--config", "secret:my-sec-multi/my-secret-key-2").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "config-secret-key-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "config-secret-key-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "config-secret-key-route"), TestTimeoutShort).ShouldNot(ContainSubstring(secDataMulti["my-secret-key"]))
- Eventually(IntegrationLogs(ns, "config-secret-key-route"), TestTimeoutShort).Should(ContainSubstring(secDataMulti["my-secret-key-2"]))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-secret-route.groovy", "--resource", "secret:my-sec").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "resource-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "resource-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "resource-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"]))
+ })
+}
- // Resource File
+func TestRunConfigSecretFilteredKey(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+ secDataMulti := createMultiSecret(ns)
+
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/config-secret-key-route.groovy", "--config", "secret:my-sec-multi/my-secret-key-2").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "config-secret-key-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "config-secret-key-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "config-secret-key-route"), TestTimeoutShort).ShouldNot(ContainSubstring(secDataMulti["my-secret-key"]))
+ Eventually(IntegrationLogs(ns, "config-secret-key-route"), TestTimeoutShort).Should(ContainSubstring(secDataMulti["my-secret-key-2"]))
+ })
+}
- t.Run("Plain text resource file", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-route.groovy", "--resource", "file:./files/resources-data.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
+// Config File
+func TestRunConfigPlainTextFile(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
- t.Run("Plain text resource file with destination path", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-location-route.groovy", "--resource", "file:./files/resources-data.txt@/tmp/file.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-location-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/config-file-route.groovy", "--config", "file:./files/resources-data.txt").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "config-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "config-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "config-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
+ })
+}
- t.Run("Binary (zip) resource file", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-binary-route.groovy", "--resource", "file:./files/resources-data.zip", "-d", "camel:zipfile").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-binary-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-binary-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-binary-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
+// Resource File
+func TestRunConfigResourceFile(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
- t.Run("Base64 compressed binary resource file", func(t *testing.T) {
- // We calculate the expected content
- source, err := ioutil.ReadFile("./files/resources-data.txt")
- assert.Nil(t, err)
- expectedBytes, err := gzip.CompressBase64([]byte(source))
- assert.Nil(t, err)
-
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-base64-encoded-route.groovy", "--resource", "file:./files/resources-data.txt", "--compression=true").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-base64-encoded-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-base64-encoded-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-base64-encoded-route"), TestTimeoutShort).Should(ContainSubstring(string(expectedBytes)))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-file-route.groovy", "--resource", "file:./files/resources-data.txt").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "resource-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "resource-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "resource-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
+ })
+}
- t.Run("Plain text resource file with same content", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-route.groovy", "--resource", "file:./files/resources-data.txt",
- "--resource", "file:./files/resources-data-same.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
+func TestRunConfigDestinationPlainTextFile(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-file-location-route.groovy", "--resource", "file:./files/resources-data.txt@/tmp/file.txt").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "resource-file-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "resource-file-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "resource-file-location-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
+ })
+}
+
+func TestRunConfigZipFile(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-file-binary-route.groovy", "--resource", "file:./files/resources-data.zip", "-d", "camel:zipfile").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "resource-file-binary-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "resource-file-binary-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "resource-file-binary-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
+ })
+}
+
+func TestRunConfigBase64File(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ // We calculate the expected content
+ source, err := ioutil.ReadFile("./files/resources-data.txt")
+ assert.Nil(t, err)
+ expectedBytes, err := gzip.CompressBase64([]byte(source))
+ assert.Nil(t, err)
+
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-file-base64-encoded-route.groovy", "--resource", "file:./files/resources-data.txt", "--compression=true").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "resource-file-base64-encoded-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "resource-file-base64-encoded-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "resource-file-base64-encoded-route"), TestTimeoutShort).Should(ContainSubstring(string(expectedBytes)))
+ })
+}
+
+func TestRunConfigPlainTextFileSameContent(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-file-route.groovy", "--resource", "file:./files/resources-data.txt",
+ "--resource", "file:./files/resources-data-same.txt").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "resource-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "resource-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "resource-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
+ })
+}
+
+func TestRunConfigBuildProperty(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
// Build-Properties
t.Run("Build time property", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/build-property-route.groovy", "--build-property", "quarkus.application.name=my-super-application").Execute()).To(Succeed())
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-route.groovy", "--build-property", "quarkus.application.name=my-super-application").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "build-property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
Eventually(IntegrationConditionStatus(ns, "build-property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
Eventually(IntegrationLogs(ns, "build-property-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application"))
@@ -295,79 +366,96 @@ func TestRunConfigExamples(t *testing.T) {
// We need to check also that the property (which is available in the IntegrationKit) is correctly replaced and we don't reuse the same kit
t.Run("Build time property updated", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/build-property-route.groovy", "--name", "build-property-route-updated",
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-route.groovy", "--name", "build-property-route-updated",
"--build-property", "quarkus.application.name=my-super-application-updated").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "build-property-route-updated"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
Eventually(IntegrationConditionStatus(ns, "build-property-route-updated", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
Eventually(IntegrationLogs(ns, "build-property-route-updated"), TestTimeoutShort).Should(ContainSubstring("my-super-application-updated"))
// Verify the integration kits are different
Expect(IntegrationKit(ns, "build-property-route")).ShouldNot(Equal(IntegrationKit(ns, "build-property-route-updated")))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
+ })
+}
+
+func TestRunConfigBuildPropertyFile(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
// Build-Properties file
- t.Run("Build time property file", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-file-route.groovy", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application"))
+ })
+}
- t.Run("Build time property file with precedence", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "quarkus.application.name=my-overridden-application", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutMedium).Should(ContainSubstring("my-overridden-application"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+func TestRunConfigBuildPropertytFilePrecedence(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
- t.Run("Build time property from ConfigMap", func(t *testing.T) {
- var cmData = make(map[string]string)
- cmData["quarkus.application.name"] = "my-cool-application"
- CreatePlainTextConfigmap(ns, "my-cm-test-build-property", cmData)
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-file-route.groovy", "--build-property", "quarkus.application.name=my-overridden-application", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutMedium).Should(ContainSubstring("my-overridden-application"))
+ })
+}
- Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "configmap:my-cm-test-build-property").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutLong).Should(ContainSubstring("my-cool-application"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+func TestRunConfigBuildPropertyConfigMap(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
- t.Run("Build time property from ConfigMap as property file", func(t *testing.T) {
- var cmData = make(map[string]string)
- cmData["my.properties"] = "quarkus.application.name=my-super-cool-application"
- CreatePlainTextConfigmap(ns, "my-cm-test-build-properties", cmData)
+ var cmData = make(map[string]string)
+ cmData["quarkus.application.name"] = "my-cool-application"
+ CreatePlainTextConfigmap(ns, "my-cm-test-build-property", cmData)
- Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "configmap:my-cm-test-build-properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-super-cool-application"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-file-route.groovy", "--build-property", "configmap:my-cm-test-build-property").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutLong).Should(ContainSubstring("my-cool-application"))
+ })
+}
- t.Run("Build time property from Secret", func(t *testing.T) {
- var secData = make(map[string]string)
- secData["quarkus.application.name"] = "my-great-application"
- CreatePlainTextSecret(ns, "my-sec-test-build-property", secData)
+func TestRunConfigBuildPropertyConfigMapFile(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
- Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "secret:my-sec-test-build-property").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-great-application"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+ var cmData = make(map[string]string)
+ cmData["my.properties"] = "quarkus.application.name=my-super-cool-application"
+ CreatePlainTextConfigmap(ns, "my-cm-test-build-properties", cmData)
- t.Run("Build time property from Secret as property file", func(t *testing.T) {
- var secData = make(map[string]string)
- secData["my.properties"] = "quarkus.application.name=my-awsome-application"
- CreatePlainTextSecret(ns, "my-sec-test-build-properties", secData)
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-file-route.groovy", "--build-property", "configmap:my-cm-test-build-properties").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-super-cool-application"))
+ })
+}
- Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "secret:my-sec-test-build-properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-awsome-application"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+func TestRunConfigBuildPropertySecret(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ var secData = make(map[string]string)
+ secData["quarkus.application.name"] = "my-great-application"
+ CreatePlainTextSecret(ns, "my-sec-test-build-property", secData)
+
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-file-route.groovy", "--build-property", "secret:my-sec-test-build-property").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-great-application"))
+ })
+}
+
+func TestRunConfigBuildPropertySecretFile(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ var secData = make(map[string]string)
+ secData["my.properties"] = "quarkus.application.name=my-awsome-application"
+ CreatePlainTextSecret(ns, "my-sec-test-build-properties", secData)
+
+ Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-file-route.groovy", "--build-property", "secret:my-sec-test-build-properties").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-awsome-application"))
})
}
[camel-k] 11/13: (e2e): Splits the TestKamelCLIRun tests
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 667d4c1c012dde49cc6eeaeb697ffebc7941eb3c
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Mon Oct 3 16:52:40 2022 +0100
(e2e): Splits the TestKamelCLIRun tests
* Rather than trying to delete resources at the end of each sub-test, it
is simpler and more reliable to generate a new namespace for each and
have it deleted
* The sampleJar URL is changed for the http dependency tests to avoid the
request have to do a redirect. This improves the reliability of its
retrieval
* Sets the http dependency tests to problematic since on OCP4, the
repositories are not being detected by the maven build causing test
failures. See #3708.
---
e2e/namespace/install/cli/run_test.go | 267 ++++++++++++++++++++--------------
1 file changed, 156 insertions(+), 111 deletions(-)
diff --git a/e2e/namespace/install/cli/run_test.go b/e2e/namespace/install/cli/run_test.go
index ca0a10ef5..472ad0552 100644
--- a/e2e/namespace/install/cli/run_test.go
+++ b/e2e/namespace/install/cli/run_test.go
@@ -24,6 +24,7 @@ package common
import (
"fmt"
+ "os"
"testing"
. "github.com/onsi/gomega"
@@ -36,117 +37,161 @@ import (
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
-func TestKamelCLIRun(t *testing.T) {
+var sampleJar = "https://raw.githubusercontent.com/apache/camel-k/main/e2e/global/common/traits/files/jvm/sample-1.0.jar"
+
+func operatorID(ns string) string {
+ return fmt.Sprintf("camel-k-%s", ns)
+}
+
+func installWithID(ns string) {
+ Expect(KamelInstallWithID(operatorID(ns), ns).Execute()).To(Succeed())
+ Eventually(OperatorPod(ns)).ShouldNot(BeNil())
+ Eventually(PlatformPhase(ns), TestTimeoutLong).Should(Equal(v1.IntegrationPlatformPhaseReady))
+}
+
+func TestKamelCLIRunGitHubExampleJava(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ Expect(KamelRunWithID(operatorID(ns), ns,
+ "github:apache/camel-k/e2e/namespace/install/files/Java.java").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ })
+}
+
+func TestKamelCLIRunGitHubExampleJavaRaw(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ Expect(KamelRunWithID(operatorID(ns), ns,
+ "https://raw.githubusercontent.com/apache/camel-k/main/e2e/namespace/install/files/Java.java").Execute()).
+ To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ })
+}
+
+func TestKamelCLIRunGitHubExampleJavaBranch(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ Expect(KamelRunWithID(operatorID(ns), ns,
+ "github:apache/camel-k/e2e/namespace/install/files/Java.java?branch=main").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ })
+}
+
+func TestKamelCLIRunGitHubExampleGistID(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ name := "github-gist-id"
+ Expect(KamelRunWithID(operatorID(ns), ns, "--name", name,
+ "gist:e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
+ })
+}
+
+func TestKamelCLIRunGitHubExampleGistURL(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ name := "github-gist-url"
+ Expect(KamelRunWithID(operatorID(ns), ns, "--name", name,
+ "https://gist.github.com/lburgazzoli/e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
+ })
+}
+
+func TestKamelCLIRunAndUpdate(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ name := "run"
+ Expect(KamelRunWithID(operatorID(ns), ns, "files/run.yaml", "--name", name).Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magic default"))
+
+ // Re-run the Integration with an updated configuration
+ Expect(KamelRunWithID(operatorID(ns), ns, "files/run.yaml", "--name", name, "-p", "property=value").Execute()).
+ To(Succeed())
+
+ // Check the Deployment has progressed successfully
+ Eventually(DeploymentCondition(ns, name, appsv1.DeploymentProgressing), TestTimeoutShort).
+ Should(MatchFields(IgnoreExtras, Fields{
+ "Status": Equal(corev1.ConditionTrue),
+ "Reason": Equal("NewReplicaSetAvailable"),
+ }))
+
+ // Check the new configuration is taken into account
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutShort).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magic value"))
+
+ })
+}
+
+/*
+ * TODO
+ * The dependency cannot be read by maven while building. See #3708
+ *
+ * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
+ */
+func TestKamelCLIRunWithHttpDependency(t *testing.T) {
+ if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
+ t.Skip("WARNING: Test marked as problematic ... skipping")
+ }
+ WithNewTestNamespace(t, func(ns string) {
+ installWithID(ns)
+
+ fmt.Println("OperatorID: ", operatorID(ns))
+ Expect(KamelRunWithID(operatorID(ns), ns, "../../../global/common/traits/files/jvm/Classpath.java",
+ "-d", sampleJar, "--verbose",
+ ).Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
+ })
+}
+
+/*
+ * TODO
+ * The dependency cannot be read by maven while building. See #3708
+ *
+ * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
+ */
+func TestKamelCLIRunHttpDependencyUsingOptions(t *testing.T) {
+ if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
+ t.Skip("WARNING: Test marked as problematic ... skipping")
+ }
WithNewTestNamespace(t, func(ns string) {
- operatorID := fmt.Sprintf("camel-k-%s", ns)
- Expect(KamelInstallWithID(operatorID, ns).Execute()).To(Succeed())
-
- t.Run("Examples from GitHub", func(t *testing.T) {
- t.Run("Java", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns,
- "github:apache/camel-k/e2e/namespace/install/files/Java.java").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).
- Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
-
- t.Run("Java (RAW)", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns,
- "https://raw.githubusercontent.com/apache/camel-k/main/e2e/namespace/install/files/Java.java").Execute()).
- To(Succeed())
- Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).
- Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
-
- t.Run("Java (branch)", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns,
- "github:apache/camel-k/e2e/namespace/install/files/Java.java?branch=main").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).
- Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
-
- t.Run("Gist (ID)", func(t *testing.T) {
- name := "github-gist-id"
- Expect(KamelRunWithID(operatorID, ns, "--name", name,
- "gist:e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
- Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
-
- t.Run("Gist (URL)", func(t *testing.T) {
- name := "github-gist-url"
- Expect(KamelRunWithID(operatorID, ns, "--name", name,
- "https://gist.github.com/lburgazzoli/e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
- Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
-
- // Clean up
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
-
- t.Run("Run and update", func(t *testing.T) {
- name := "run"
- Expect(KamelRunWithID(operatorID, ns, "files/run.yaml", "--name", name).Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
- Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magic default"))
-
- // Re-run the Integration with an updated configuration
- Expect(KamelRunWithID(operatorID, ns, "files/run.yaml", "--name", name, "-p", "property=value").Execute()).
- To(Succeed())
-
- // Check the Deployment has progressed successfully
- Eventually(DeploymentCondition(ns, name, appsv1.DeploymentProgressing), TestTimeoutShort).
- Should(MatchFields(IgnoreExtras, Fields{
- "Status": Equal(corev1.ConditionTrue),
- "Reason": Equal("NewReplicaSetAvailable"),
- }))
-
- // Check the new configuration is taken into account
- Eventually(IntegrationPodPhase(ns, name), TestTimeoutShort).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
- Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magic value"))
-
- // Clean up
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
- t.Run("Run with http dependency", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "../../../global/common/traits/files/jvm/Classpath.java",
- "-d", "https://github.com/apache/camel-k/raw/main/e2e/global/common/traits/files/jvm/sample-1.0.jar",
- ).Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
- t.Run("Run with http dependency using options", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "../../../global/common/traits/files/jvm/Classpath.java",
- "-d", "https://github.com/apache/camel-k/raw/main/e2e/global/common/traits/files/jvm/sample-1.0.jar",
- "-d", "https://raw.githubusercontent.com/apache/camel-k/main/e2e/namespace/install/cli/files/Java.java|targetPath=/tmp/foo",
- ).Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- })
+ installWithID(ns)
+
+ Expect(KamelRunWithID(operatorID(ns), ns, "../../../global/common/traits/files/jvm/Classpath.java",
+ "-d", sampleJar, "--verbose",
+ "-d", "https://raw.githubusercontent.com/apache/camel-k/main/e2e/namespace/install/cli/files/Java.java|targetPath=/tmp/foo",
+ ).Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
})
}
[camel-k] 07/13: (e2e): check if namespace already exists
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 7591e0fb7a1bc3bcbca7a5d767101a4290623580
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Fri Sep 23 13:44:40 2022 +0100
(e2e): check if namespace already exists
* If test namespace exists then create a different one with extra suffix
---
e2e/support/test_support.go | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 4e4f0013f..aa1761d75 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -2161,6 +2161,19 @@ func deleteTestNamespace(t *testing.T, ns ctrl.Object) {
}
}
+func testNamespaceExists(ns string) (bool, error) {
+ _, err := TestClient().CoreV1().Namespaces().Get(TestContext, ns, metav1.GetOptions{})
+ if err != nil {
+ if k8serrors.IsNotFound(err) {
+ return false, nil
+ } else {
+ return false, err
+ }
+ }
+
+ return true, nil
+}
+
func newTestNamespace(injectKnativeBroker bool) ctrl.Object {
brokerLabel := "eventing.knative.dev/injection"
name := os.Getenv("CAMEL_K_TEST_NS")
@@ -2169,6 +2182,13 @@ func newTestNamespace(injectKnativeBroker bool) ctrl.Object {
}
c := TestClient()
+ if exists, err := testNamespaceExists(name); err != nil {
+ failTest(err)
+ } else if exists {
+ fmt.Println("Warning: namespace ", name, " already exists so using different namespace name")
+ name = fmt.Sprintf("%s-%d", name, time.Now().Second())
+ }
+
if oc, err := openshift.IsOpenShift(TestClient()); err != nil {
failTest(err)
} else if oc {