This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 782db9c3b18493f8e8c2df97f4731396538a37c3
Author: Pasquale Congiusti <pasquale.congiu...@gmail.com>
AuthorDate: Wed Feb 22 16:05:15 2023 +0100

    chore: make knative faster
---
 .github/actions/e2e-common/exec-tests.sh           |   2 +-
 e2e/common/startup_test.go                         |   2 +-
 e2e/common/teardown_test.go                        |   2 +-
 .../teardown_test.go => knative/default.go}        |  22 +--
 e2e/knative/kamelet_test.go                        | 102 +++++++------
 e2e/knative/knative_platform_test.go               |  91 ++++++------
 e2e/knative/knative_test.go                        | 158 +++++++++++----------
 e2e/knative/openapi_test.go                        |  67 +++------
 e2e/knative/pod_test.go                            |  25 ++--
 e2e/{common => knative}/startup_test.go            |   6 +-
 e2e/{common => knative}/teardown_test.go           |   4 +-
 script/Makefile                                    |   3 +
 12 files changed, 218 insertions(+), 266 deletions(-)

diff --git a/.github/actions/e2e-common/exec-tests.sh 
b/.github/actions/e2e-common/exec-tests.sh
index 507ca9f5c..c38482719 100755
--- a/.github/actions/e2e-common/exec-tests.sh
+++ b/.github/actions/e2e-common/exec-tests.sh
@@ -58,7 +58,7 @@ while getopts ":b:c:g:i:l:n:q:s:v:x:z:" opt; do
       SAVE_FAILED_TEST_NS=${OPTARG}
       ;;
     z)
-      CUSTOM_INSTALL_TEST=${OPTARG}
+      CUSTOM_INSTALL_TEST="${OPTARG}"
       ;;
     :)
       echo "ERROR: Option -$OPTARG requires an argument"
diff --git a/e2e/common/startup_test.go b/e2e/common/startup_test.go
index 546c3b190..fa6558b7d 100644
--- a/e2e/common/startup_test.go
+++ b/e2e/common/startup_test.go
@@ -32,7 +32,7 @@ import (
        v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
 )
 
-func TestDefaultCamelKInstallStartup(t *testing.T) {
+func TestCommonCamelKInstallStartup(t *testing.T) {
        RegisterTestingT(t)
 
        ns := NewTestNamespace(false)
diff --git a/e2e/common/teardown_test.go b/e2e/common/teardown_test.go
index 682e6ffce..c990fbbfe 100644
--- a/e2e/common/teardown_test.go
+++ b/e2e/common/teardown_test.go
@@ -30,7 +30,7 @@ import (
        . "github.com/apache/camel-k/e2e/support"
 )
 
-func TestDefaultCamelKInstallTeardown(t *testing.T) {
+func TestCommonCamelKInstallTeardown(t *testing.T) {
        RegisterTestingT(t)
 
        ns := GetCIProcessID()
diff --git a/e2e/common/teardown_test.go b/e2e/knative/default.go
similarity index 64%
copy from e2e/common/teardown_test.go
copy to e2e/knative/default.go
index 682e6ffce..280d6c93f 100644
--- a/e2e/common/teardown_test.go
+++ b/e2e/knative/default.go
@@ -1,8 +1,6 @@
 //go:build integration
 // +build integration
 
-// To enable compilation of this file in Goland, go to "Settings -> Go -> 
Vendoring & Build Tags -> Custom Tags" and add "integration"
-
 /*
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
@@ -20,21 +18,9 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 */
 
-package common
-
-import (
-       "testing"
-
-       . "github.com/onsi/gomega"
-
-       . "github.com/apache/camel-k/e2e/support"
-)
+package knative
 
-func TestDefaultCamelKInstallTeardown(t *testing.T) {
-       RegisterTestingT(t)
+import "github.com/apache/camel-k/e2e/support"
 
-       ns := GetCIProcessID()
-       Expect(ns).ShouldNot(BeNil())
-       Expect(DeleteNamespace(t, ns)).To(Succeed())
-       DeleteCIProcessID()
-}
+var ns = support.GetCIProcessID()
+var operatorID = support.GetCIProcessID()
diff --git a/e2e/knative/kamelet_test.go b/e2e/knative/kamelet_test.go
index 811149ccb..6d9a6d583 100644
--- a/e2e/knative/kamelet_test.go
+++ b/e2e/knative/kamelet_test.go
@@ -39,61 +39,57 @@ import (
 
 // Test that a KameletBinding can be changed and the changes are propagated to 
the Integration
 func TestKameletChange(t *testing.T) {
-       WithNewTestNamespace(t, func(ns string) {
-               operatorID := "camel-k-kamelet-change"
-               timerSource := "my-timer-source"
-
-               Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
-               Expect(CreateTimerKamelet(ns, timerSource)()).To(Succeed())
-               Expect(CreateKnativeChannel(ns, "messages")()).To(Succeed())
-
-               Expect(KamelRunWithID(operatorID, ns, "files/display.groovy", 
"-w").Execute()).To(Succeed())
-
-               from := corev1.ObjectReference{
-                       Kind:       "Kamelet",
-                       APIVersion: v1alpha1.SchemeGroupVersion.String(),
-                       Name:       timerSource,
-               }
-
-               to := corev1.ObjectReference{
-                       Kind:       "InMemoryChannel",
-                       Name:       "messages",
-                       APIVersion: messaging.SchemeGroupVersion.String(),
-               }
-
-               timerBinding := "timer-binding"
-               annotations := map[string]string{
-                       "trait.camel.apache.org/health.enabled":                
 "true",
-                       
"trait.camel.apache.org/health.readiness-initial-delay": "10",
-               }
-
-               // Create the KameletBinding
-               Expect(BindKameletTo(ns, timerBinding, annotations, from, to, 
map[string]string{"message": "message is Hello"}, 
map[string]string{})()).To(Succeed())
-
-               Eventually(IntegrationPodPhase(ns, timerBinding), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
-               Eventually(IntegrationConditionStatus(ns, "timer-binding", 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-               Eventually(IntegrationLogs(ns, "display"), 
TestTimeoutShort).Should(ContainSubstring("message is Hello"))
-
-               Eventually(KameletBindingCondition(ns, timerBinding, 
v1alpha1.KameletBindingConditionReady), TestTimeoutMedium).Should(And(
+       RegisterTestingT(t)
+
+       timerSource := "my-timer-source"
+       Expect(CreateTimerKamelet(ns, timerSource)()).To(Succeed())
+       Expect(CreateKnativeChannel(ns, "messages")()).To(Succeed())
+       Expect(KamelRunWithID(operatorID, ns, "files/display.groovy", 
"-w").Execute()).To(Succeed())
+
+       from := corev1.ObjectReference{
+               Kind:       "Kamelet",
+               APIVersion: v1alpha1.SchemeGroupVersion.String(),
+               Name:       timerSource,
+       }
+
+       to := corev1.ObjectReference{
+               Kind:       "InMemoryChannel",
+               Name:       "messages",
+               APIVersion: messaging.SchemeGroupVersion.String(),
+       }
+
+       timerBinding := "timer-binding"
+       annotations := map[string]string{
+               "trait.camel.apache.org/health.enabled":                 "true",
+               "trait.camel.apache.org/health.readiness-initial-delay": "10",
+       }
+
+       // Create the KameletBinding
+       Expect(BindKameletTo(ns, timerBinding, annotations, from, to, 
map[string]string{"message": "message is Hello"}, 
map[string]string{})()).To(Succeed())
+
+       Eventually(IntegrationPodPhase(ns, timerBinding), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
+       Eventually(IntegrationConditionStatus(ns, "timer-binding", 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+       Eventually(IntegrationLogs(ns, "display"), 
TestTimeoutShort).Should(ContainSubstring("message is Hello"))
+
+       Eventually(KameletBindingCondition(ns, timerBinding, 
v1alpha1.KameletBindingConditionReady), TestTimeoutMedium).Should(And(
+               WithTransform(KameletBindingConditionStatusExtract, 
Equal(corev1.ConditionTrue)),
+               WithTransform(KameletBindingConditionReason, 
Equal(v1.IntegrationConditionDeploymentReadyReason)),
+               WithTransform(KameletBindingConditionMessage, 
Equal(fmt.Sprintf("1/1 ready replicas"))),
+       ))
+
+       // Update the KameletBinding
+       Expect(BindKameletTo(ns, "timer-binding", annotations, from, to, 
map[string]string{"message": "message is Hi"}, 
map[string]string{})()).To(Succeed())
+
+       Eventually(IntegrationPodPhase(ns, "timer-binding"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
+       Eventually(IntegrationConditionStatus(ns, "timer-binding", 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+       Eventually(IntegrationLogs(ns, "display"), 
TestTimeoutShort).Should(ContainSubstring("message is Hi"))
+
+       Eventually(KameletBindingCondition(ns, timerBinding, 
v1alpha1.KameletBindingConditionReady), TestTimeoutMedium).
+               Should(And(
                        WithTransform(KameletBindingConditionStatusExtract, 
Equal(corev1.ConditionTrue)),
                        WithTransform(KameletBindingConditionReason, 
Equal(v1.IntegrationConditionDeploymentReadyReason)),
-                       WithTransform(KameletBindingConditionMessage, 
Equal(fmt.Sprintf("1/1 ready replicas"))),
+                       WithTransform(KameletBindingConditionMessage, 
Equal("1/1 ready replicas")),
                ))
 
-               // Update the KameletBinding
-               Expect(BindKameletTo(ns, "timer-binding", annotations, from, 
to, map[string]string{"message": "message is Hi"}, 
map[string]string{})()).To(Succeed())
-
-               Eventually(IntegrationPodPhase(ns, "timer-binding"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
-               Eventually(IntegrationConditionStatus(ns, "timer-binding", 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-               Eventually(IntegrationLogs(ns, "display"), 
TestTimeoutShort).Should(ContainSubstring("message is Hi"))
-
-               Eventually(KameletBindingCondition(ns, timerBinding, 
v1alpha1.KameletBindingConditionReady), TestTimeoutMedium).
-                       Should(And(
-                               
WithTransform(KameletBindingConditionStatusExtract, 
Equal(corev1.ConditionTrue)),
-                               WithTransform(KameletBindingConditionReason, 
Equal(v1.IntegrationConditionDeploymentReadyReason)),
-                               WithTransform(KameletBindingConditionMessage, 
Equal("1/1 ready replicas")),
-                       ))
-
-               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-       })
+       Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
 }
diff --git a/e2e/knative/knative_platform_test.go 
b/e2e/knative/knative_platform_test.go
index 5b4bdb88d..594718b51 100644
--- a/e2e/knative/knative_platform_test.go
+++ b/e2e/knative/knative_platform_test.go
@@ -39,51 +39,50 @@ import (
 )
 
 func TestKnativePlatform(t *testing.T) {
-       WithNewTestNamespace(t, func(ns string) {
-               installed, err := knative.IsInstalled(TestClient())
-               Expect(err).NotTo(HaveOccurred())
-               if !installed {
-                       t.Error("Knative not installed in the cluster")
-                       t.FailNow()
-               }
-
-               operatorID := "camel-k-knative"
-               Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
-               Eventually(PlatformPhase(ns), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
-               Eventually(PlatformProfile(ns), 
TestTimeoutShort).Should(Equal(v1.TraitProfile("")))
-               cluster := Platform(ns)().Status.Cluster
-
-               t.Run("run yaml on cluster profile", func(t *testing.T) {
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/yaml.yaml", "--profile", string(cluster)).Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
-                       Eventually(IntegrationLogs(ns, "yaml"), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
-                       Eventually(IntegrationProfile(ns, "yaml"), 
TestTimeoutShort).Should(Equal(v1.TraitProfile(string(cluster))))
-                       // Change something in the integration to produce a 
redeploy
-                       Expect(UpdateIntegration(ns, "yaml", func(it 
*v1.Integration) {
-                               it.Spec.Profile = ""
-                               content, err := dsl.ToYamlDSL(it.Spec.Flows)
-                               assert.NoError(t, err)
-                               newData := strings.ReplaceAll(string(content), 
"string!", "string!!!")
-                               newFlows, err := dsl.FromYamlDSLString(newData)
-                               assert.NoError(t, err)
-                               it.Spec.Flows = newFlows
-                       })).To(Succeed())
-                       // Spec profile should be reset by "kamel run"
-                       Eventually(IntegrationSpecProfile(ns, 
"yaml")).Should(Equal(v1.TraitProfile("")))
-                       // When integration is running again ...
-                       Eventually(IntegrationPhase(ns, 
"yaml")).Should(Equal(v1.IntegrationPhaseRunning))
-                       Eventually(IntegrationLogs(ns, "yaml"), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!!!"))
-                       // It should keep the old profile saved in status
-                       Eventually(IntegrationProfile(ns, "yaml"), 
TestTimeoutMedium).Should(Equal(v1.TraitProfile(cluster)))
-
-                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-               })
-
-               t.Run("run yaml on automatic profile", func(t *testing.T) {
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/yaml.yaml").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
-                       Eventually(IntegrationProfile(ns, "yaml"), 
TestTimeoutShort).Should(Equal(v1.TraitProfileKnative))
-                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-               })
+       RegisterTestingT(t)
+
+       installed, err := knative.IsInstalled(TestClient())
+       Expect(err).NotTo(HaveOccurred())
+       if !installed {
+               t.Error("Knative not installed in the cluster")
+               t.FailNow()
+       }
+
+       operatorID := "camel-k-knative"
+       Eventually(PlatformPhase(ns), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+       Eventually(PlatformProfile(ns), 
TestTimeoutShort).Should(Equal(v1.TraitProfile("")))
+       cluster := Platform(ns)().Status.Cluster
+
+       t.Run("run yaml on cluster profile", func(t *testing.T) {
+               Expect(KamelRunWithID(operatorID, ns, "files/yaml.yaml", 
"--profile", string(cluster)).Execute()).To(Succeed())
+               Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
+               Eventually(IntegrationLogs(ns, "yaml"), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+               Eventually(IntegrationProfile(ns, "yaml"), 
TestTimeoutShort).Should(Equal(v1.TraitProfile(string(cluster))))
+               // Change something in the integration to produce a redeploy
+               Expect(UpdateIntegration(ns, "yaml", func(it *v1.Integration) {
+                       it.Spec.Profile = ""
+                       content, err := dsl.ToYamlDSL(it.Spec.Flows)
+                       assert.NoError(t, err)
+                       newData := strings.ReplaceAll(string(content), 
"string!", "string!!!")
+                       newFlows, err := dsl.FromYamlDSLString(newData)
+                       assert.NoError(t, err)
+                       it.Spec.Flows = newFlows
+               })).To(Succeed())
+               // Spec profile should be reset by "kamel run"
+               Eventually(IntegrationSpecProfile(ns, 
"yaml")).Should(Equal(v1.TraitProfile("")))
+               // When integration is running again ...
+               Eventually(IntegrationPhase(ns, 
"yaml")).Should(Equal(v1.IntegrationPhaseRunning))
+               Eventually(IntegrationLogs(ns, "yaml"), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!!!"))
+               // It should keep the old profile saved in status
+               Eventually(IntegrationProfile(ns, "yaml"), 
TestTimeoutMedium).Should(Equal(v1.TraitProfile(cluster)))
+
+               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+       })
+
+       t.Run("run yaml on automatic profile", func(t *testing.T) {
+               Expect(KamelRunWithID(operatorID, ns, 
"files/yaml.yaml").Execute()).To(Succeed())
+               Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
+               Eventually(IntegrationProfile(ns, "yaml"), 
TestTimeoutShort).Should(Equal(v1.TraitProfileKnative))
+               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
        })
 }
diff --git a/e2e/knative/knative_test.go b/e2e/knative/knative_test.go
index a5931d687..6c69a05de 100644
--- a/e2e/knative/knative_test.go
+++ b/e2e/knative/knative_test.go
@@ -36,96 +36,98 @@ import (
 )
 
 func TestKnative(t *testing.T) {
-       WithNewTestNamespace(t, func(ns string) {
-               Expect(CreateKnativeChannel(ns, "messages")()).To(Succeed())
-               Expect(CreateKnativeChannel(ns, "words")()).To(Succeed())
-               operatorID := fmt.Sprintf("camel-k-%s", ns)
-               Expect(KamelInstallWithID(operatorID, ns, "--trait-profile", 
"knative").Execute()).To(Succeed())
-
-               t.Run("Service combo", func(t *testing.T) {
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/knative2.groovy").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "knative2"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
-                       Eventually(IntegrationConditionStatus(ns, "knative2", 
camelv1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(v1.ConditionTrue))
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/knative3.groovy").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "knative3"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
-                       Eventually(IntegrationConditionStatus(ns, "knative3", 
camelv1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(v1.ConditionTrue))
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/knative1.groovy").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "knative1"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
-                       Eventually(IntegrationConditionStatus(ns, "knative1", 
camelv1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(v1.ConditionTrue))
-                       // Correct logs
-                       Eventually(IntegrationLogs(ns, "knative1"), 
TestTimeoutMedium).Should(ContainSubstring("Received from 2: Hello from 
knative2"))
-                       Eventually(IntegrationLogs(ns, "knative1"), 
TestTimeoutMedium).Should(ContainSubstring("Received from 3: Hello from 
knative3"))
-                       // Incorrect logs
-                       Consistently(IntegrationLogs(ns, "knative1"), 
10*time.Second).ShouldNot(ContainSubstring("Received from 2: Hello from 
knative3"))
-                       Consistently(IntegrationLogs(ns, "knative1"), 
10*time.Second).ShouldNot(ContainSubstring("Received from 3: Hello from 
knative2"))
-                       // Clean up
-                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-               })
-
-               t.Run("Channel combo v1beta1", func(t *testing.T) {
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/knativech2.groovy").Execute()).To(Succeed())
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/knativech1.groovy").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "knativech2"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
-                       Eventually(IntegrationPodPhase(ns, "knativech1"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
-                       Eventually(IntegrationLogs(ns, "knativech2"), 
TestTimeoutMedium).Should(ContainSubstring("Received: Hello from knativech1"))
-                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-               })
+       RegisterTestingT(t)
+
+       Expect(CreateKnativeChannel(ns, "messages")()).To(Succeed())
+       Expect(CreateKnativeChannel(ns, "words")()).To(Succeed())
+       operatorID := fmt.Sprintf("camel-k-%s", ns)
+       Expect(KamelInstallWithID(operatorID, ns, "--trait-profile", 
"knative").Execute()).To(Succeed())
+
+       t.Run("Service combo", func(t *testing.T) {
+               Expect(KamelRunWithID(operatorID, ns, 
"files/knative2.groovy").Execute()).To(Succeed())
+               Eventually(IntegrationPodPhase(ns, "knative2"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(IntegrationConditionStatus(ns, "knative2", 
camelv1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(v1.ConditionTrue))
+               Expect(KamelRunWithID(operatorID, ns, 
"files/knative3.groovy").Execute()).To(Succeed())
+               Eventually(IntegrationPodPhase(ns, "knative3"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(IntegrationConditionStatus(ns, "knative3", 
camelv1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(v1.ConditionTrue))
+               Expect(KamelRunWithID(operatorID, ns, 
"files/knative1.groovy").Execute()).To(Succeed())
+               Eventually(IntegrationPodPhase(ns, "knative1"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(IntegrationConditionStatus(ns, "knative1", 
camelv1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(v1.ConditionTrue))
+               // Correct logs
+               Eventually(IntegrationLogs(ns, "knative1"), 
TestTimeoutMedium).Should(ContainSubstring("Received from 2: Hello from 
knative2"))
+               Eventually(IntegrationLogs(ns, "knative1"), 
TestTimeoutMedium).Should(ContainSubstring("Received from 3: Hello from 
knative3"))
+               // Incorrect logs
+               Consistently(IntegrationLogs(ns, "knative1"), 
10*time.Second).ShouldNot(ContainSubstring("Received from 2: Hello from 
knative3"))
+               Consistently(IntegrationLogs(ns, "knative1"), 
10*time.Second).ShouldNot(ContainSubstring("Received from 3: Hello from 
knative2"))
+               // Clean up
+               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+       })
 
-               t.Run("Channel combo get to post", func(t *testing.T) {
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/knativegetpost2.groovy").Execute()).To(Succeed())
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/knativegetpost1.groovy").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "knativegetpost2"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
-                       Eventually(IntegrationPodPhase(ns, "knativegetpost1"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
-                       Eventually(IntegrationLogs(ns, "knativegetpost2"), 
TestTimeoutMedium).Should(ContainSubstring(`Received ""`))
-                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-               })
+       t.Run("Channel combo v1beta1", func(t *testing.T) {
+               Expect(KamelRunWithID(operatorID, ns, 
"files/knativech2.groovy").Execute()).To(Succeed())
+               Expect(KamelRunWithID(operatorID, ns, 
"files/knativech1.groovy").Execute()).To(Succeed())
+               Eventually(IntegrationPodPhase(ns, "knativech2"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(IntegrationPodPhase(ns, "knativech1"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(IntegrationLogs(ns, "knativech2"), 
TestTimeoutMedium).Should(ContainSubstring("Received: Hello from knativech1"))
+               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+       })
 
-               t.Run("Multi channel chain", func(t *testing.T) {
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/knativemultihop3.groovy").Execute()).To(Succeed())
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/knativemultihop2.groovy").Execute()).To(Succeed())
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/knativemultihop1.groovy").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "knativemultihop3"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
-                       Eventually(IntegrationPodPhase(ns, "knativemultihop2"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
-                       Eventually(IntegrationPodPhase(ns, "knativemultihop1"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
-                       Eventually(IntegrationLogs(ns, "knativemultihop3"), 
TestTimeoutMedium).Should(ContainSubstring(`From messages: message`))
-                       Eventually(IntegrationLogs(ns, "knativemultihop3"), 
TestTimeoutMedium).Should(ContainSubstring(`From words: word`))
-                       Eventually(IntegrationLogs(ns, "knativemultihop3"), 
TestTimeoutMedium).Should(ContainSubstring(`From words: transformed message`))
-                       Eventually(IntegrationLogs(ns, "knativemultihop3"), 
10*time.Second).ShouldNot(ContainSubstring(`From messages: word`))
-                       Eventually(IntegrationLogs(ns, "knativemultihop3"), 
10*time.Second).ShouldNot(ContainSubstring(`From words: message`))
-                       Eventually(IntegrationLogs(ns, "knativemultihop3"), 
10*time.Second).ShouldNot(ContainSubstring(`From messages: transformed 
message`))
-                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-               })
+       t.Run("Channel combo get to post", func(t *testing.T) {
+               Expect(KamelRunWithID(operatorID, ns, 
"files/knativegetpost2.groovy").Execute()).To(Succeed())
+               Expect(KamelRunWithID(operatorID, ns, 
"files/knativegetpost1.groovy").Execute()).To(Succeed())
+               Eventually(IntegrationPodPhase(ns, "knativegetpost2"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(IntegrationPodPhase(ns, "knativegetpost1"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(IntegrationLogs(ns, "knativegetpost2"), 
TestTimeoutMedium).Should(ContainSubstring(`Received ""`))
+               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+       })
 
-               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), 
TestTimeoutLong).Should(Equal(v1.ConditionTrue))
+       t.Run("Multi channel chain", func(t *testing.T) {
+               Expect(KamelRunWithID(operatorID, ns, 
"files/knativemultihop3.groovy").Execute()).To(Succeed())
+               Expect(KamelRunWithID(operatorID, ns, 
"files/knativemultihop2.groovy").Execute()).To(Succeed())
+               Expect(KamelRunWithID(operatorID, ns, 
"files/knativemultihop1.groovy").Execute()).To(Succeed())
+               Eventually(IntegrationPodPhase(ns, "knativemultihop3"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(IntegrationPodPhase(ns, "knativemultihop2"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(IntegrationPodPhase(ns, "knativemultihop1"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(IntegrationLogs(ns, "knativemultihop3"), 
TestTimeoutMedium).Should(ContainSubstring(`From messages: message`))
+               Eventually(IntegrationLogs(ns, "knativemultihop3"), 
TestTimeoutMedium).Should(ContainSubstring(`From words: word`))
+               Eventually(IntegrationLogs(ns, "knativemultihop3"), 
TestTimeoutMedium).Should(ContainSubstring(`From words: transformed message`))
+               Eventually(IntegrationLogs(ns, "knativemultihop3"), 
10*time.Second).ShouldNot(ContainSubstring(`From messages: word`))
+               Eventually(IntegrationLogs(ns, "knativemultihop3"), 
10*time.Second).ShouldNot(ContainSubstring(`From words: message`))
+               Eventually(IntegrationLogs(ns, "knativemultihop3"), 
10*time.Second).ShouldNot(ContainSubstring(`From messages: transformed 
message`))
+               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+       })
 
-                       t.Run("Scale to zero", func(t *testing.T) {
-                               Eventually(IntegrationPod(ns, "flow"), 
TestTimeoutLong).Should(BeNil())
-                       })
+       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), 
TestTimeoutLong).Should(Equal(v1.ConditionTrue))
 
-                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+               t.Run("Scale to zero", func(t *testing.T) {
+                       Eventually(IntegrationPod(ns, "flow"), 
TestTimeoutLong).Should(BeNil())
                })
 
-               t.Run("Knative-service disabled", func(t *testing.T) {
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/http_out.groovy", "-t", 
"knative-service.enabled=false").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "http-out"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
-                       Eventually(Service(ns, "http-out"), 
TestTimeoutShort).ShouldNot(BeNil())
-                       Consistently(KnativeService(ns, "http-out"), 
TestTimeoutShort).Should(BeNil())
-                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-               })
+               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+       })
 
-               t.Run("Knative-service priority", func(t *testing.T) {
-                       Expect(KamelRunWithID(operatorID, ns, 
"files/http_out.groovy").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "http-out"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
-                       Eventually(KnativeService(ns, "http-out"), 
TestTimeoutShort).ShouldNot(BeNil())
-                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-               })
+       t.Run("Knative-service disabled", func(t *testing.T) {
+               Expect(KamelRunWithID(operatorID, ns, "files/http_out.groovy", 
"-t", "knative-service.enabled=false").Execute()).To(Succeed())
+               Eventually(IntegrationPodPhase(ns, "http-out"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(Service(ns, "http-out"), 
TestTimeoutShort).ShouldNot(BeNil())
+               Consistently(KnativeService(ns, "http-out"), 
TestTimeoutShort).Should(BeNil())
+               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+       })
+
+       t.Run("Knative-service priority", func(t *testing.T) {
+               Expect(KamelRunWithID(operatorID, ns, 
"files/http_out.groovy").Execute()).To(Succeed())
+               Eventually(IntegrationPodPhase(ns, "http-out"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(KnativeService(ns, "http-out"), 
TestTimeoutShort).ShouldNot(BeNil())
+               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
        })
 }
 
 func TestRunBroker(t *testing.T) {
+       RegisterTestingT(t)
+
        WithNewTestNamespaceWithKnativeBroker(t, func(ns string) {
                operatorID := fmt.Sprintf("camel-k-%s", ns)
                Expect(KamelInstallWithID(operatorID, ns, "--trait-profile", 
"knative").Execute()).To(Succeed())
diff --git a/e2e/knative/openapi_test.go b/e2e/knative/openapi_test.go
index 1c6e9fa2b..42d6c4941 100644
--- a/e2e/knative/openapi_test.go
+++ b/e2e/knative/openapi_test.go
@@ -23,62 +23,29 @@ limitations under the License.
 package knative
 
 import (
-       "testing"
-
-       . "github.com/onsi/gomega"
-
-       corev1 "k8s.io/api/core/v1"
-
        . "github.com/apache/camel-k/e2e/support"
-       v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+       . "github.com/onsi/gomega"
+       "testing"
 )
 
 func TestOpenAPIService(t *testing.T) {
-       WithNewTestNamespace(t, func(ns string) {
-               operatorID := "camel-k-openapi-service"
-               Expect(KamelInstallWithID(operatorID, ns, "--trait-profile", 
string(v1.TraitProfileKnative)).Execute()).To(Succeed())
-               Expect(KamelRunWithID(operatorID, ns,
-                       "--name", "petstore",
-                       "--open-api", "file:files/petstore-api.yaml",
-                       "files/petstore.groovy",
-               ).Execute()).To(Succeed())
-
-               Eventually(KnativeService(ns, "petstore"), TestTimeoutLong).
-                       Should(Not(BeNil()))
-
-               Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
-                       Should(ContainSubstring("Started listPets 
(rest://get:/v1:/pets)"))
-               Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
-                       Should(ContainSubstring("Started createPets 
(rest://post:/v1:/pets)"))
-               Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
-                       Should(ContainSubstring("Started showPetById 
(rest://get:/v1:/pets/%7BpetId%7D)"))
-
-               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-       })
-}
+       RegisterTestingT(t)
 
-func TestOpenAPIDeployment(t *testing.T) {
-       WithNewTestNamespace(t, func(ns string) {
-               operatorID := "camel-k-openapi-deployment"
-               Expect(KamelInstallWithID(operatorID, ns, "--trait-profile", 
string(v1.TraitProfileKubernetes)).Execute()).To(Succeed())
-               Expect(KamelRunWithID(operatorID, ns,
-                       "--name", "petstore",
-                       "--open-api", "file:files/petstore-api.yaml",
-                       "files/petstore.groovy",
-               ).Execute()).To(Succeed())
+       Expect(KamelRunWithID(operatorID, ns,
+               "--name", "petstore",
+               "--open-api", "file:files/petstore-api.yaml",
+               "files/petstore.groovy",
+       ).Execute()).To(Succeed())
 
-               Eventually(IntegrationPodPhase(ns, "petstore"), 
TestTimeoutLong).
-                       Should(Equal(corev1.PodRunning))
-               Eventually(Deployment(ns, "petstore"), TestTimeoutLong).
-                       Should(Not(BeNil()))
+       Eventually(KnativeService(ns, "petstore"), TestTimeoutLong).
+               Should(Not(BeNil()))
 
-               Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
-                       Should(ContainSubstring("Started listPets 
(rest://get:/v1:/pets)"))
-               Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
-                       Should(ContainSubstring("Started createPets 
(rest://post:/v1:/pets)"))
-               Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
-                       Should(ContainSubstring("Started showPetById 
(rest://get:/v1:/pets/%7BpetId%7D)"))
+       Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
+               Should(ContainSubstring("Started listPets 
(rest://get:/v1:/pets)"))
+       Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
+               Should(ContainSubstring("Started createPets 
(rest://post:/v1:/pets)"))
+       Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
+               Should(ContainSubstring("Started showPetById 
(rest://get:/v1:/pets/%7BpetId%7D)"))
 
-               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-       })
+       Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
 }
diff --git a/e2e/knative/pod_test.go b/e2e/knative/pod_test.go
index f134a94d4..59938f0ac 100644
--- a/e2e/knative/pod_test.go
+++ b/e2e/knative/pod_test.go
@@ -34,17 +34,16 @@ import (
 )
 
 func TestPodTraitWithKnative(t *testing.T) {
-       WithNewTestNamespace(t, func(ns string) {
-               operatorID := "camel-k-trait-pod-knative"
-               Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
-               Expect(KamelRunWithID(operatorID, ns, 
"files/podtest-knative2.groovy",
-                       "--pod-template", 
"files/template-knative.yaml").Execute()).To(Succeed())
-               Eventually(IntegrationPodPhase(ns, "podtest-knative2"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
-               Eventually(IntegrationConditionStatus(ns, "podtest-knative2", 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-               Expect(KamelRunWithID(operatorID, ns, 
"files/podtest-knative1.groovy").Execute()).To(Succeed())
-               Eventually(IntegrationPodPhase(ns, "podtest-knative1"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
-               Eventually(IntegrationConditionStatus(ns, "podtest-knative1", 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-
-               Eventually(IntegrationLogs(ns, "podtest-knative1"), 
TestTimeoutShort).Should(ContainSubstring("hello from the template"))
-       })
+       RegisterTestingT(t)
+
+       Expect(KamelRunWithID(operatorID, ns, "files/podtest-knative2.groovy",
+               "--pod-template", 
"files/template-knative.yaml").Execute()).To(Succeed())
+       Eventually(IntegrationPodPhase(ns, "podtest-knative2"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
+       Eventually(IntegrationConditionStatus(ns, "podtest-knative2", 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+       Expect(KamelRunWithID(operatorID, ns, 
"files/podtest-knative1.groovy").Execute()).To(Succeed())
+       Eventually(IntegrationPodPhase(ns, "podtest-knative1"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
+       Eventually(IntegrationConditionStatus(ns, "podtest-knative1", 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+       Eventually(IntegrationLogs(ns, "podtest-knative1"), 
TestTimeoutShort).Should(ContainSubstring("hello from the template"))
+
+       Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
 }
diff --git a/e2e/common/startup_test.go b/e2e/knative/startup_test.go
similarity index 92%
copy from e2e/common/startup_test.go
copy to e2e/knative/startup_test.go
index 546c3b190..b40f2df41 100644
--- a/e2e/common/startup_test.go
+++ b/e2e/knative/startup_test.go
@@ -20,7 +20,7 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 */
 
-package common
+package knative
 
 import (
        "testing"
@@ -32,7 +32,7 @@ import (
        v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
 )
 
-func TestDefaultCamelKInstallStartup(t *testing.T) {
+func TestKNativeCamelKInstallStartup(t *testing.T) {
        RegisterTestingT(t)
 
        ns := NewTestNamespace(false)
@@ -41,7 +41,7 @@ func TestDefaultCamelKInstallStartup(t *testing.T) {
        // we store this value as it will be used for cleaning in the teardown 
process
        SaveCIProcessID(ns.GetName())
 
-       Expect(KamelInstallWithIDAndKameletCatalog(ns.GetName(), 
ns.GetName()).Execute()).To(Succeed())
+       Expect(KamelInstallWithIDAndKameletCatalog(ns.GetName(), ns.GetName(), 
"--trait-profile", "knative").Execute()).To(Succeed())
        Eventually(OperatorPod(ns.GetName())).ShouldNot(BeNil())
        Eventually(Platform(ns.GetName())).ShouldNot(BeNil())
        Eventually(PlatformConditionStatus(ns.GetName(), 
v1.IntegrationPlatformConditionReady), TestTimeoutShort).
diff --git a/e2e/common/teardown_test.go b/e2e/knative/teardown_test.go
similarity index 94%
copy from e2e/common/teardown_test.go
copy to e2e/knative/teardown_test.go
index 682e6ffce..3a2a0f883 100644
--- a/e2e/common/teardown_test.go
+++ b/e2e/knative/teardown_test.go
@@ -20,7 +20,7 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 */
 
-package common
+package knative
 
 import (
        "testing"
@@ -30,7 +30,7 @@ import (
        . "github.com/apache/camel-k/e2e/support"
 )
 
-func TestDefaultCamelKInstallTeardown(t *testing.T) {
+func TestKNativeCamelKInstallTeardown(t *testing.T) {
        RegisterTestingT(t)
 
        ns := GetCIProcessID()
diff --git a/script/Makefile b/script/Makefile
index be5f0bf10..ef460562d 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -297,7 +297,10 @@ test-install-upgrade: do-build
 #
 test-knative: do-build
        STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
+       go test -timeout 30m -v ./e2e/knative/startup_test.go -tags=integration 
$(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || FAILED=1; \
        go test -timeout 60m -v ./e2e/knative -tags=integration 
$(TEST_KNATIVE_RUN) $(GOTESTFMT)
+       go test -timeout 30m -v ./e2e/knative/teardown_test.go 
-tags=integration $(TEST_INTEGRATION_COMMON_LANG_RUN) $(GOTESTFMT) || FAILED=1; 
\
+       exit $${FAILED}
 
 #
 # Builder tests that require a custom build strategy


Reply via email to