Skip to content

Commit

Permalink
system-test: Unify delete workload mechanism in ran du tests
Browse files Browse the repository at this point in the history
Signed-off-by: Rodrigo Lopez <[email protected]>
  • Loading branch information
Rodrigo Lopez committed Jun 28, 2024
1 parent 3d5944e commit f8c94ee
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
})
8 changes: 8 additions & 0 deletions tests/system-tests/ran-du/tests/stability-no-workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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")
Expand Down
5 changes: 2 additions & 3 deletions tests/system-tests/ran-du/tests/stability-workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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")
})
})

0 comments on commit f8c94ee

Please sign in to comment.