This is an automated email from the ASF dual-hosted git repository.
squakez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 63da8861a test(e2e): complete IntegrationProfile e2e coverage (closes
#6948) (#6951)
63da8861a is described below
commit 63da8861a277a34221e34c1747a5162ba529b1a2
Author: painbaba <[email protected]>
AuthorDate: Thu Nov 12 12:59:19 2026 +0530
test(e2e): complete IntegrationProfile e2e coverage (closes #6948) (#6951)
* test(e2e): complete IntegrationProfile e2e coverage (closes #6948)
Signed-off-by: zwork <zwork@local>
* test(e2e): drop in-code issue references
---------
Signed-off-by: zwork <zwork@local>
Co-authored-by: zwork <zwork@local>
---
e2e/common/misc/files/profile-property.yaml | 25 +++++++
e2e/common/misc/integration_profile_test.go | 103 ++++++++++++++++++++++++++++
2 files changed, 128 insertions(+)
diff --git a/e2e/common/misc/files/profile-property.yaml
b/e2e/common/misc/files/profile-property.yaml
new file mode 100644
index 000000000..d3494ab76
--- /dev/null
+++ b/e2e/common/misc/files/profile-property.yaml
@@ -0,0 +1,25 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+- from:
+ uri: "timer:profile"
+ parameters:
+ period: "1000"
+ steps:
+ - setBody:
+ simple: "The value of profile.property is
${properties:profile.property}"
+ - to: "log:info"
diff --git a/e2e/common/misc/integration_profile_test.go
b/e2e/common/misc/integration_profile_test.go
index c9c47ecc9..34edf8b9c 100644
--- a/e2e/common/misc/integration_profile_test.go
+++ b/e2e/common/misc/integration_profile_test.go
@@ -29,11 +29,114 @@ import (
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
+ ctrl "sigs.k8s.io/controller-runtime/pkg/client"
. "github.com/apache/camel-k/v2/e2e/support"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
+ trait "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
)
+// TestIntegrationProfileProperties verifies that a user provided
IntegrationProfile
+// (selected through the camel.apache.org/integration-profile.id annotation on
the
+// Integration) applies its traits, here the camel.properties trait holding a
+// parameter that we can check on the Integration log.
+func TestIntegrationProfileProperties(t *testing.T) {
+ t.Parallel()
+
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ integrationProfile := v1.NewIntegrationProfile(ns, "my-profile")
+ integrationProfile.Spec.Traits = v1.Traits{
+ Camel: &trait.CamelTrait{
+ Properties:
[]string{"profile.property=profile-annotation-value"},
+ },
+ }
+
+ g.Expect(CreateIntegrationProfile(t, ctx,
&integrationProfile)).To(Succeed())
+
+ t.Run("Run sample integration", func(t *testing.T) {
+ name := RandomizedSuffixName("profile")
+ g.Expect(KamelRun(t, ctx, ns,
+ "--name", name,
+ "--annotation",
"camel.apache.org/integration-profile.id=my-profile",
+
"files/profile-property.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
name, v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutShort).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name),
TestTimeoutShort).
+ Should(ContainSubstring("The value of
profile.property is profile-annotation-value"))
+ })
+ })
+}
+
+// TestIntegrationProfileFromNamespaceAnnotation verifies that an Integration
without
+// any explicit profile annotation uses the IntegrationProfile selected by the
+// camel.apache.org/integration-profile.id annotation set on its namespace.
+func TestIntegrationProfileFromNamespaceAnnotation(t *testing.T) {
+ t.Parallel()
+
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ integrationProfile := v1.NewIntegrationProfile(ns, "ns-profile")
+ integrationProfile.Spec.Traits = v1.Traits{
+ Camel: &trait.CamelTrait{
+ Properties:
[]string{"profile.property=namespace-annotation-value"},
+ },
+ }
+
+ g.Expect(CreateIntegrationProfile(t, ctx,
&integrationProfile)).To(Succeed())
+
+ namespace := &corev1.Namespace{}
+ g.Expect(TestClient(t).Get(ctx, ctrl.ObjectKey{Name: ns},
namespace)).To(Succeed())
+ if namespace.Annotations == nil {
+ namespace.Annotations = make(map[string]string)
+ }
+ namespace.Annotations[v1.IntegrationProfileAnnotation] =
"ns-profile"
+ g.Expect(TestClient(t).Update(ctx, namespace)).To(Succeed())
+
+ t.Run("Run sample integration", func(t *testing.T) {
+ name := RandomizedSuffixName("profile-ns-annotation")
+ g.Expect(KamelRun(t, ctx, ns,
+ "--name", name,
+
"files/profile-property.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
name, v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutShort).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name),
TestTimeoutShort).
+ Should(ContainSubstring("The value of
profile.property is namespace-annotation-value"))
+ })
+ })
+}
+
+// TestIntegrationProfileDefault verifies that an Integration without any
explicit
+// profile annotation, running in a namespace which is not annotated either,
uses
+// the "default" IntegrationProfile when it exists in its own namespace.
+// See https://github.com/apache/camel-k/issues/6776
+func TestIntegrationProfileDefault(t *testing.T) {
+ t.Parallel()
+
+ WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ integrationProfile := v1.NewIntegrationProfile(ns,
v1.DefaultIntegrationProfileName)
+ integrationProfile.Spec.Traits = v1.Traits{
+ Camel: &trait.CamelTrait{
+ Properties:
[]string{"profile.property=default-profile-value"},
+ },
+ }
+
+ g.Expect(CreateIntegrationProfile(t, ctx,
&integrationProfile)).To(Succeed())
+
+ t.Run("Run sample integration", func(t *testing.T) {
+ name := RandomizedSuffixName("profile-default")
+ g.Expect(KamelRun(t, ctx, ns,
+ "--name", name,
+
"files/profile-property.yaml").Execute()).To(Succeed())
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
name, v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutShort).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns, name),
TestTimeoutShort).
+ Should(ContainSubstring("The value of
profile.property is default-profile-value"))
+ })
+ })
+}
+
func TestIntegrationProfileDependencies(t *testing.T) {
t.Parallel()