diff --git a/tests/system-tests/ran-du/tests/launch-workload-multiple-iter-loadavg.go b/tests/system-tests/ran-du/tests/launch-workload-multiple-iter-loadavg.go index 8b7bce61c..ee1d12f5a 100644 --- a/tests/system-tests/ran-du/tests/launch-workload-multiple-iter-loadavg.go +++ b/tests/system-tests/ran-du/tests/launch-workload-multiple-iter-loadavg.go @@ -81,7 +81,7 @@ var _ = Describe( }) AfterAll(func() { By("Cleaning up test workload resources") - err := randutestworkload.CleanNameSpace(randuparams.DefaultTimeout, RanDuTestConfig.TestWorkload.Namespace) - Expect(err).ToNot(HaveOccurred(), "Failed to clean workload test namespace objects") + _, err := shell.ExecuteCmd(RanDuTestConfig.TestWorkload.DeleteShellCmd) + Expect(err).ToNot(HaveOccurred(), "Failed to delete workload") }) }) diff --git a/tests/system-tests/ran-du/tests/stability-no-workload.go b/tests/system-tests/ran-du/tests/stability-no-workload.go index fb4cd25f5..6ae845c47 100644 --- a/tests/system-tests/ran-du/tests/stability-no-workload.go +++ b/tests/system-tests/ran-du/tests/stability-no-workload.go @@ -6,8 +6,10 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/openshift-kni/eco-goinfra/pkg/namespace" "github.com/openshift-kni/eco-goinfra/pkg/reportxml" "github.com/openshift-kni/eco-gotests/tests/system-tests/internal/platform" + "github.com/openshift-kni/eco-gotests/tests/system-tests/internal/shell" "github.com/openshift-kni/eco-gotests/tests/system-tests/internal/stability" . "github.com/openshift-kni/eco-gotests/tests/system-tests/ran-du/internal/randuinittools" ) @@ -23,6 +25,12 @@ var _ = Describe( ) BeforeAll(func() { + if namespace.NewBuilder(APIClient, RanDuTestConfig.TestWorkload.Namespace).Exists() { + By("Cleaning up test workload resources") + _, err := shell.ExecuteCmd(RanDuTestConfig.TestWorkload.DeleteShellCmd) + Expect(err).ToNot(HaveOccurred(), "Failed to delete workload") + } + By("Fetching Cluster name") clusterName, err = platform.GetOCPClusterName(APIClient) Expect(err).ToNot(HaveOccurred(), "Failed to get cluster name") diff --git a/tests/system-tests/ran-du/tests/stability-workload.go b/tests/system-tests/ran-du/tests/stability-workload.go index af55ccc86..026be9d2e 100644 --- a/tests/system-tests/ran-du/tests/stability-workload.go +++ b/tests/system-tests/ran-du/tests/stability-workload.go @@ -14,7 +14,6 @@ import ( "github.com/openshift-kni/eco-gotests/tests/system-tests/internal/stability" . "github.com/openshift-kni/eco-gotests/tests/system-tests/ran-du/internal/randuinittools" "github.com/openshift-kni/eco-gotests/tests/system-tests/ran-du/internal/randuparams" - "github.com/openshift-kni/eco-gotests/tests/system-tests/ran-du/internal/randutestworkload" ) var _ = Describe( @@ -131,7 +130,7 @@ var _ = Describe( }) AfterAll(func() { By("Cleaning up test workload resources") - err := randutestworkload.CleanNameSpace(randuparams.DefaultTimeout, RanDuTestConfig.TestWorkload.Namespace) - Expect(err).ToNot(HaveOccurred(), "Failed to clean workload test namespace objects") + _, err := shell.ExecuteCmd(RanDuTestConfig.TestWorkload.DeleteShellCmd) + Expect(err).ToNot(HaveOccurred(), "Failed to delete workload") }) })