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 97c24bab2d14e1cbfe2f6a7cb6c9209aa900be57
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Thu Jan 26 14:49:44 2023 +0100

    chore: install Kamelet catalog
---
 e2e/global/common/scale_binding_test.go             |  2 +-
 e2e/namespace/install/cli/bind_test.go              |  2 +-
 e2e/namespace/install/cli/uninstall_test.go         |  6 +++---
 e2e/namespace/install/operator_id_filtering_test.go |  4 ++--
 e2e/support/test_support.go                         | 13 +++++++------
 5 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/e2e/global/common/scale_binding_test.go 
b/e2e/global/common/scale_binding_test.go
index 2c1cf41d1..1a0dafb4f 100644
--- a/e2e/global/common/scale_binding_test.go
+++ b/e2e/global/common/scale_binding_test.go
@@ -51,7 +51,7 @@ func TestKameletBindingScale(t *testing.T) {
        WithNewTestNamespace(t, func(ns string) {
                name := "binding"
                operatorID := "camel-k-kamelet-scale"
-               Expect(KamelInstallWithID(operatorID, ns, 
"-w").Execute()).To(Succeed())
+               Expect(KamelInstallWithIDAndKameletCatalog(operatorID, ns, 
"-w").Execute()).To(Succeed())
                Expect(KamelBindWithID(operatorID, ns, 
"timer-source?message=HelloBinding", "log-sink", "--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))
diff --git a/e2e/namespace/install/cli/bind_test.go 
b/e2e/namespace/install/cli/bind_test.go
index 1bd527d5e..f2c831873 100644
--- a/e2e/namespace/install/cli/bind_test.go
+++ b/e2e/namespace/install/cli/bind_test.go
@@ -35,7 +35,7 @@ import (
 func TestKamelCLIBind(t *testing.T) {
        WithNewTestNamespace(t, func(ns string) {
                operatorID := "camel-k-cli-bind"
-               Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
+               Expect(KamelInstallWithIDAndKameletCatalog(operatorID, 
ns).Execute()).To(Succeed())
                Expect(CreateTimerKamelet(ns, 
"test-timer-source")()).To(Succeed())
 
                t.Run("bind timer to log", func(t *testing.T) {
diff --git a/e2e/namespace/install/cli/uninstall_test.go 
b/e2e/namespace/install/cli/uninstall_test.go
index 514b46484..009016b33 100644
--- a/e2e/namespace/install/cli/uninstall_test.go
+++ b/e2e/namespace/install/cli/uninstall_test.go
@@ -51,8 +51,8 @@ func TestBasicUninstall(t *testing.T) {
                }
 
                if !uninstallViaOLM {
-               Eventually(Role(ns)).Should(BeNil())
-               Eventually(RoleBinding(ns)).Should(BeNil())
+                       Eventually(Role(ns)).Should(BeNil())
+                       Eventually(RoleBinding(ns)).Should(BeNil())
                        Eventually(ServiceAccount(ns, 
"camel-k-operator")).Should(BeNil())
                } else {
                        Eventually(Role(ns)).ShouldNot(BeNil())
@@ -130,7 +130,7 @@ func TestUninstallSkipKamelets(t *testing.T) {
        WithNewTestNamespace(t, func(ns string) {
                // a successful new installation
                operatorID := fmt.Sprintf("camel-k-%s", ns)
-               Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
+               Expect(KamelInstallWithIDAndKameletCatalog(operatorID, 
ns).Execute()).To(Succeed())
                Eventually(OperatorPod(ns)).ShouldNot(BeNil())
                Eventually(KameletList(ns)).ShouldNot(BeEmpty())
                // on uninstall it should remove everything except kamelets
diff --git a/e2e/namespace/install/operator_id_filtering_test.go 
b/e2e/namespace/install/operator_id_filtering_test.go
index 498618ea9..a25fa2583 100644
--- a/e2e/namespace/install/operator_id_filtering_test.go
+++ b/e2e/namespace/install/operator_id_filtering_test.go
@@ -53,11 +53,11 @@ func TestOperatorIDFiltering(t *testing.T) {
                WithNewTestNamespace(t, func(nsop1 string) {
                        WithNewTestNamespace(t, func(nsop2 string) {
                                operator1 := "operator-1"
-                               Expect(KamelInstallWithID(operator1, nsop1, 
"--global", "--force").Execute()).To(Succeed())
+                               
Expect(KamelInstallWithIDAndKameletCatalog(operator1, nsop1, "--global", 
"--force").Execute()).To(Succeed())
                                Eventually(PlatformPhase(nsop1), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
 
                                operator2 := "operator-2"
-                               Expect(KamelInstallWithID(operator2, nsop2, 
"--global", "--force").Execute()).To(Succeed())
+                               
Expect(KamelInstallWithIDAndKameletCatalog(operator2, nsop2, "--global", 
"--force").Execute()).To(Succeed())
                                Eventually(PlatformPhase(nsop2), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
 
                                t.Run("Operators ignore non-scoped 
integrations", func(t *testing.T) {
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index f819566d0..d696e7d40 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -228,10 +228,14 @@ func KamelInstall(namespace string, args ...string) 
*cobra.Command {
 }
 
 func KamelInstallWithID(operatorID string, namespace string, args ...string) 
*cobra.Command {
-       return KamelInstallWithContext(TestContext, operatorID, namespace, 
args...)
+       return kamelInstallWithContext(TestContext, operatorID, namespace, 
true, args...)
 }
 
-func KamelInstallWithContext(ctx context.Context, operatorID string, namespace 
string, args ...string) *cobra.Command {
+func KamelInstallWithIDAndKameletCatalog(operatorID string, namespace string, 
args ...string) *cobra.Command {
+       return kamelInstallWithContext(TestContext, operatorID, namespace, 
false, args...)
+}
+
+func kamelInstallWithContext(ctx context.Context, operatorID string, namespace 
string, skipKameletCatalog bool, args ...string) *cobra.Command {
        var installArgs []string
 
        globalTest := os.Getenv("CAMEL_K_FORCE_GLOBAL_TEST") == "true"
@@ -250,10 +254,7 @@ func KamelInstallWithContext(ctx context.Context, 
operatorID string, namespace s
                installArgs = []string{"install", "-n", namespace, 
"--operator-id", operatorID}
        }
 
-       // Default behavior, we don't install Kamelet catalog to spare resources
-       // They need to be installed on purpose if required to be tested
-       enableKamelets := os.Getenv("CAMEL_K_TEST_KAMELET_CATALOG_INSTALL") == 
"true"
-       if !enableKamelets {
+       if skipKameletCatalog {
                installArgs = append(installArgs, "--operator-env-vars", 
"KAMEL_INSTALL_DEFAULT_KAMELETS=false")
        }
 

Reply via email to