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 d46121de7fbc05805ec68c3a6245560ee68dbc64
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Mon Jul 1 14:44:09 2024 +0200

    fix(e2e): remove uninstall unsupported methods
---
 e2e/advanced/build_max_pipelines_test.go      |  4 ++++
 e2e/advanced/build_order_strategy_test.go     |  2 ++
 e2e/install/helm/setup_test.go                |  5 +----
 e2e/install/kustomize/setup_test.go           | 12 ------------
 e2e/install/upgrade/kustomize_upgrade_test.go | 10 ----------
 e2e/install/upgrade/olm_upgrade_test.go       | 19 +------------------
 e2e/support/test_support.go                   | 13 -------------
 e2e/support/test_util.go                      | 25 -------------------------
 script/Makefile                               |  2 +-
 9 files changed, 9 insertions(+), 83 deletions(-)

diff --git a/e2e/advanced/build_max_pipelines_test.go 
b/e2e/advanced/build_max_pipelines_test.go
index 8da4241da..064a5866a 100644
--- a/e2e/advanced/build_max_pipelines_test.go
+++ b/e2e/advanced/build_max_pipelines_test.go
@@ -105,6 +105,7 @@ func kitMaxBuildLimit(t *testing.T, maxRunningBuilds int32, 
condition func(runni
 }
 
 func TestKitMaxBuildLimitSequential(t *testing.T) {
+       t.Parallel()
        // We must verify we have at least 1 build at a time
        var condition = func(runningBuilds int) bool {
                return runningBuilds <= 1
@@ -113,6 +114,7 @@ func TestKitMaxBuildLimitSequential(t *testing.T) {
 }
 
 func TestKitMaxBuildLimitFIFO(t *testing.T) {
+       t.Parallel()
        // We may have up to 2 parallel builds
        var condition = func(runningBuilds int) bool {
                return runningBuilds <= 2
@@ -121,6 +123,7 @@ func TestKitMaxBuildLimitFIFO(t *testing.T) {
 }
 
 func TestKitMaxBuildLimitDependencies(t *testing.T) {
+       t.Parallel()
        // We may have up to 2 parallel builds
        var condition = func(runningBuilds int) bool {
                return runningBuilds <= 2
@@ -129,6 +132,7 @@ func TestKitMaxBuildLimitDependencies(t *testing.T) {
 }
 
 func TestMaxBuildLimitWaitingBuilds(t *testing.T) {
+       t.Parallel()
        WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
                InstallOperator(t, ctx, g, ns)
 
diff --git a/e2e/advanced/build_order_strategy_test.go 
b/e2e/advanced/build_order_strategy_test.go
index e20cb8454..56e64d55c 100644
--- a/e2e/advanced/build_order_strategy_test.go
+++ b/e2e/advanced/build_order_strategy_test.go
@@ -36,6 +36,7 @@ import (
 )
 
 func TestRunBuildOrderStrategyMatchingDependencies(t *testing.T) {
+       t.Parallel()
        WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
                InstallOperator(t, ctx, g, ns)
 
@@ -111,6 +112,7 @@ func TestRunBuildOrderStrategyMatchingDependencies(t 
*testing.T) {
 }
 
 func TestRunBuildOrderStrategyFIFO(t *testing.T) {
+       t.Parallel()
        WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
                InstallOperator(t, ctx, g, ns)
                // Update platform with parameters required by this test
diff --git a/e2e/install/helm/setup_test.go b/e2e/install/helm/setup_test.go
index e65395b6b..b21646abd 100644
--- a/e2e/install/helm/setup_test.go
+++ b/e2e/install/helm/setup_test.go
@@ -37,10 +37,7 @@ import (
        . "github.com/onsi/gomega"
 )
 
-func TestHelmInstallRunUninstall(t *testing.T) {
-       // Ensure no CRDs are already installed
-       ctx := TestContext()
-       Cleanup(t, ctx)
+func TestHelmInstallation(t *testing.T) {
        KAMEL_INSTALL_REGISTRY := os.Getenv("KAMEL_INSTALL_REGISTRY")
 
        WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
diff --git a/e2e/install/kustomize/setup_test.go 
b/e2e/install/kustomize/setup_test.go
index ceacdb156..dadb28c5a 100644
--- a/e2e/install/kustomize/setup_test.go
+++ b/e2e/install/kustomize/setup_test.go
@@ -40,14 +40,8 @@ import (
 )
 
 func TestKustomizeNamespaced(t *testing.T) {
-       // TODO, likely we need to adjust this test with a Kustomize overlay 
for Openshift
-       // which would not require the registry setting
        KAMEL_INSTALL_REGISTRY := os.Getenv("KAMEL_INSTALL_REGISTRY")
        kustomizeDir := testutil.MakeTempCopyDir(t, "../../../install")
-       ctx := TestContext()
-       // Ensure no CRDs are already installed
-       Cleanup(t, ctx)
-
        WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
                g.Expect(KAMEL_INSTALL_REGISTRY).NotTo(Equal(""))
                // We must change a few values in the Kustomize config
@@ -137,14 +131,8 @@ func TestKustomizeNamespaced(t *testing.T) {
 }
 
 func TestKustomizeDescoped(t *testing.T) {
-       // TODO, likely we need to adjust this test with a Kustomize overlay 
for Openshift
-       // which would not require the registry setting
        KAMEL_INSTALL_REGISTRY := os.Getenv("KAMEL_INSTALL_REGISTRY")
        kustomizeDir := testutil.MakeTempCopyDir(t, "../../../install")
-       ctx := TestContext()
-       // Ensure no CRDs are already installed
-       Cleanup(t, ctx)
-
        WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
                g.Expect(KAMEL_INSTALL_REGISTRY).NotTo(Equal(""))
                // We must change a few values in the Kustomize config
diff --git a/e2e/install/upgrade/kustomize_upgrade_test.go 
b/e2e/install/upgrade/kustomize_upgrade_test.go
index 73b4894f3..24aa400a7 100644
--- a/e2e/install/upgrade/kustomize_upgrade_test.go
+++ b/e2e/install/upgrade/kustomize_upgrade_test.go
@@ -33,7 +33,6 @@ import (
        . "github.com/onsi/gomega"
 
        corev1 "k8s.io/api/core/v1"
-       kerrors "k8s.io/apimachinery/pkg/api/errors"
 
        . "github.com/apache/camel-k/v2/e2e/support"
        testutil "github.com/apache/camel-k/v2/e2e/support/util"
@@ -56,15 +55,6 @@ func TestKustomizeUpgrade(t *testing.T) {
                // Set KAMEL_BIN only for this test - don't override the ENV 
variable for all tests
                g.Expect(os.Setenv("KAMEL_BIN", kamel)).To(Succeed())
 
-               if len(CRDs(t)()) > 0 {
-                       // Clean up old installation - maybe leftover from 
another test
-                       if err := UninstallAll(t, ctx); err != nil && 
!kerrors.IsNotFound(err) {
-                               t.Error(err)
-                               t.FailNow()
-                       }
-               }
-               g.Eventually(CRDs(t)).Should(HaveLen(0))
-
                // Should both install the CRDs and kamel in the given namespace
                g.Expect(Kamel(t, ctx, "install", "-n", ns, "--global", 
"--olm=false", "--force").Execute()).To(Succeed())
                // Check the operator pod is running
diff --git a/e2e/install/upgrade/olm_upgrade_test.go 
b/e2e/install/upgrade/olm_upgrade_test.go
index 7544ce7a8..c2b0abc70 100644
--- a/e2e/install/upgrade/olm_upgrade_test.go
+++ b/e2e/install/upgrade/olm_upgrade_test.go
@@ -33,7 +33,6 @@ import (
        v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
        . "github.com/onsi/gomega"
        "github.com/stretchr/testify/require"
-       kerrors "k8s.io/apimachinery/pkg/api/errors"
        "k8s.io/apimachinery/pkg/types"
        ctrl "sigs.k8s.io/controller-runtime/pkg/client"
 
@@ -84,19 +83,11 @@ func TestOLMOperatorUpgrade(t *testing.T) {
                // Set KAMEL_BIN only for this test - don't override the ENV 
variable for all tests
                g.Expect(os.Setenv("KAMEL_BIN", kamel)).To(Succeed())
 
-               if len(CRDs(t)()) > 0 {
-                       // Clean up old installation - maybe leftover from 
another test
-                       if err := UninstallAll(t, ctx); err != nil && 
!kerrors.IsNotFound(err) {
-                               t.Error(err)
-                               t.FailNow()
-                       }
-               }
-               g.Eventually(CRDs(t)).Should(HaveLen(0))
-
                args := []string{
                        "install",
                        "-n", ns,
                        "--olm=true",
+                       "--force",
                        "--olm-source", catalogSourceName,
                        "--olm-source-namespace", ns,
                        "--base-image", defaults.BaseImage(),
@@ -255,14 +246,6 @@ func TestOLMOperatorUpgrade(t *testing.T) {
                                Should(Equal(corev1.ConditionTrue))
                        g.Eventually(IntegrationConditionStatus(t, ctx, ns, 
kbindName, v1.IntegrationConditionReady), TestTimeoutMedium).
                                Should(Equal(corev1.ConditionTrue))
-
-                       // Clean up
-                       g.Expect(Kamel(t, ctx, "delete", "--all", "-n", 
ns).Execute()).To(Succeed())
-                       // Delete Integration Platform as it does not get 
removed with uninstall and might cause next tests to fail
-                       DeletePlatform(t, ctx, ns)()
-                       g.Expect(Kamel(t, ctx, "uninstall", "-n", 
ns).Execute()).To(Succeed())
-                       // Clean up cluster-wide resources that are not removed 
by OLM
-                       g.Expect(Kamel(t, ctx, "uninstall", "--all", "-n", ns, 
"--olm=false").Execute()).To(Succeed())
                })
        })
 }
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 5c41ec0e1..2527942d5 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -2816,19 +2816,6 @@ func userCleanup(t *testing.T) {
 func invokeUserTestCode(t *testing.T, ctx context.Context, ns string, doRun 
func(context.Context, *gomega.WithT, string)) {
        defer func() {
                DumpNamespace(t, ctx, ns)
-
-               osns := os.Getenv("CAMEL_K_GLOBAL_OPERATOR_NS")
-
-               // Try to clean up namespace
-               if ns != osns && HasPlatform(t, ctx, ns)() {
-                       t.Logf("Clean up test namespace: %s", ns)
-
-                       if err := Kamel(t, ctx, "uninstall", "-n", ns, 
"--skip-crd", "--skip-cluster-roles").Execute(); err != nil {
-                               t.Logf("Error while cleaning up namespace %s: 
%v\n", ns, err)
-                       }
-
-                       t.Logf("Successfully cleaned up test namespace: %s", ns)
-               }
        }()
 
        g := gomega.NewWithT(t)
diff --git a/e2e/support/test_util.go b/e2e/support/test_util.go
index 4d9585083..084b3b04d 100644
--- a/e2e/support/test_util.go
+++ b/e2e/support/test_util.go
@@ -31,8 +31,6 @@ import (
        "sync"
        "testing"
 
-       "github.com/apache/camel-k/v2/pkg/util/log"
-
        . "github.com/onsi/gomega"
        "github.com/onsi/gomega/gexec"
        . "github.com/onsi/gomega/gstruct"
@@ -129,26 +127,3 @@ func ExpectExecSucceed(t *testing.T, g *WithT, command 
*exec.Cmd) {
        require.NoError(t, err)
        assert.NotContains(t, strings.ToUpper(cmdErr.String()), "ERROR")
 }
-
-// Cleanup Clean up the cluster ready for the next set of tests
-func Cleanup(t *testing.T, ctx context.Context) {
-       // Remove the locally installed operator
-       if err := UninstallAll(t, ctx); err != nil {
-               log.Error(err, "Failed to uninstall Camel K")
-       }
-
-       // Ensure the CRDs & ClusterRoles are reinstalled if not already
-       if err := Kamel(t, ctx, "install", "--olm=false", 
"--cluster-setup").Execute(); err != nil {
-               log.Error(err, "Failed to perform Camel K cluster setup")
-       }
-}
-
-// UninstallAll Removes all items
-func UninstallAll(t *testing.T, ctx context.Context) error {
-       return Kamel(t, ctx, "uninstall", "--olm=false", "--all").Execute()
-}
-
-// UninstallFromNamespace Removes operator from given namespace
-func UninstallFromNamespace(t *testing.T, ctx context.Context, ns string) 
error {
-       return Kamel(t, ctx, "uninstall", "--olm=false", "-n", ns).Execute()
-}
diff --git a/script/Makefile b/script/Makefile
index 73cb4398c..f55a04222 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -299,7 +299,7 @@ test-smoke:
 #
 test-advanced:
        FAILED=0; STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)"; \
-       go test -p=$(TEST_ADVANCED_PARALLEL_COUNT) -timeout 90m -v 
./e2e/advanced --parallel 1 -tags=integration $(GOTESTFMT) || ((FAILED++)); \
+       go test -p 1 -timeout 90m -v ./e2e/advanced --parallel 
$(TEST_ADVANCED_PARALLEL_COUNT) -tags=integration $(GOTESTFMT) || ((FAILED++)); 
\
        exit $${FAILED}
 
 #

Reply via email to