From 3202cbd271cb8289cf3e792d6c9c53b5c0c0bfea Mon Sep 17 00:00:00 2001 From: Peri M Date: Tue, 10 Sep 2024 18:00:59 +0200 Subject: [PATCH] siteconfig-operator: cnf: draft:adding recovery test cases --- .../ran/gitopsztp/internal/tsparams/consts.go | 2 + .../tests/ztp-siteconfig-operator.go | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 tests/cnf/ran/gitopsztp/tests/ztp-siteconfig-operator.go diff --git a/tests/cnf/ran/gitopsztp/internal/tsparams/consts.go b/tests/cnf/ran/gitopsztp/internal/tsparams/consts.go index 75f60d4f8..d564345d1 100644 --- a/tests/cnf/ran/gitopsztp/internal/tsparams/consts.go +++ b/tests/cnf/ran/gitopsztp/internal/tsparams/consts.go @@ -25,6 +25,8 @@ const ( LabelMachineConfigTestCases = "ztp-machine-config" // LabelSpokeCheckerTests is the label for a particular set of test cases. LabelSpokeCheckerTests = "ztp-spoke-checker" + // LabelSiteconfigOperatorTestCases is the label for the Siteconfig operator test cases. + LabelSiteconfigOperatorTestCases = "ztp-siteconfig-operator" // MultiClusterHubOperator is the name of the multi cluster hub operator. MultiClusterHubOperator = "multiclusterhub-operator" diff --git a/tests/cnf/ran/gitopsztp/tests/ztp-siteconfig-operator.go b/tests/cnf/ran/gitopsztp/tests/ztp-siteconfig-operator.go new file mode 100644 index 000000000..76aa10858 --- /dev/null +++ b/tests/cnf/ran/gitopsztp/tests/ztp-siteconfig-operator.go @@ -0,0 +1,43 @@ +package tests + +import ( + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "github.com/openshift-kni/eco-goinfra/pkg/reportxml" + "github.com/openshift-kni/eco-gotests/tests/cnf/ran/gitopsztp/internal/gitdetails" + "github.com/openshift-kni/eco-gotests/tests/cnf/ran/gitopsztp/internal/tsparams" + . "github.com/openshift-kni/eco-gotests/tests/cnf/ran/internal/raninittools" + "github.com/openshift-kni/eco-gotests/tests/cnf/ran/internal/version" +) + +var _ = Describe("ZTP Siteconfig Operator Tests", Label(tsparams.LabelSiteconfigOperatorTestCases), func() { + BeforeEach(func() { + By("verifying that ZTP meets the minimum version") + versionInRange, err := version.IsVersionStringInRange(RANConfig.ZTPVersion, "4.17", "") + Expect(err).ToNot(HaveOccurred(), "Failed to compare ZTP version string") + + if !versionInRange { + Skip("ZTP Siteconfig operator tests require ZTP 4.17 or later") + } + + }) + + AfterEach(func() { + By("resetting the clusters app back to the original settings") + err := gitdetails.SetGitDetailsInArgoCd( + tsparams.ArgoCdClustersAppName, tsparams.ArgoCdAppDetails[tsparams.ArgoCdClustersAppName], true, false) + Expect(err).ToNot(HaveOccurred(), "Failed to reset clusters app git details") + }) + + // 75382 - Recovery test by referencing non-existent cluster template configmap. + It("Verify new siteconfig operator’s recovery mechanism by referencing non-existent "+ + "cluster template configmap", reportxml.ID("75382"), func() { + // Test validation steps automation code implementation is in-progress. + }) + + // 75383 - Recovery test by referencing non-existent extra manifests configmap. + It("Verify new siteconfig operator’s recovery mechanism by referencing non-existent "+ + "extra manifests configmap", reportxml.ID("75383"), func() { + // Test validation steps automation code implementation is in-progress. + }) +})