-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cnf ran: siteconfig-operator:ready-for-review: adding ocp-75376 test …
…case
- Loading branch information
Showing
2 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
tests/cnf/ran/gitopsztp/tests/ztp-siteconfig-operator.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package tests | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"github.com/openshift-kni/eco-goinfra/pkg/assisted" | ||
"github.com/openshift-kni/eco-goinfra/pkg/bmh" | ||
"github.com/openshift-kni/eco-goinfra/pkg/hive" | ||
"github.com/openshift-kni/eco-goinfra/pkg/ocm" | ||
"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() { | ||
// These tests use the hub and spoke architecture | ||
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") | ||
}) | ||
|
||
// 75376 - Detaching the AI single-node openshift (SNO) spoke cluster. | ||
It("Validate detaching the AI SNO spoke cluster", reportxml.ID("75376"), func() { | ||
// Update the ztp-test git path to detach site resources in root level kustimozation.yaml. | ||
By("updating the Argo CD clusters app with the detach AI SNO cluster instance git path") | ||
exists, err := gitdetails.UpdateArgoCdAppGitPath(tsparams.ArgoCdClustersAppName, | ||
tsparams.ZtpTestPathDetachAISNO, true) | ||
if !exists { | ||
Skip(err.Error()) | ||
} | ||
|
||
Expect(err).ToNot(HaveOccurred(), "Failed to update Argo CD clusters app with new git path") | ||
|
||
// Test expected results validation. | ||
By("checking the infra env manifests removed on hub") | ||
_, err = assisted.PullInfraEnvInstall(HubAPIClient, RANConfig.Spoke1Name, RANConfig.Spoke1Name) | ||
Expect(err).To(HaveOccurred(), "Found spoke infra env manifests but expected to be removed") | ||
|
||
By("checking the bare metal host manifests removed on hub") | ||
_, err = bmh.Pull(HubAPIClient, RANConfig.Spoke1Name, RANConfig.Spoke1Name) | ||
Expect(err).To(HaveOccurred(), "Found spoke bmh manifests but expected to be removed") | ||
|
||
By("checking the cluster deployment manifests removed on hub") | ||
_, err = hive.PullClusterDeployment(HubAPIClient, RANConfig.Spoke1Name, RANConfig.Spoke1Name) | ||
Expect(err).To(HaveOccurred(), "Found spoke cluster deployment manifests but expected to be removed") | ||
|
||
By("checking the NM state config manifests removed on hub") | ||
nmStateConfigList, err := assisted.ListNmStateConfigs(HubAPIClient, RANConfig.Spoke1Name) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to list NM state config manifests") | ||
Expect(nmStateConfigList).To(BeEmpty(), "Found spoke NM state config manifests but expected to be removed") | ||
|
||
By("checking the klusterlet addon config manifests removed on hub") | ||
_, err = ocm.PullKAC(HubAPIClient, RANConfig.Spoke1Name, RANConfig.Spoke1Name) | ||
Expect(err).To(HaveOccurred(), "Found spoke kac manifests but expected to be removed") | ||
|
||
By("checking the agent cluster install manifests removed on hub") | ||
_, err = assisted.PullAgentClusterInstall(HubAPIClient, RANConfig.Spoke1Name, RANConfig.Spoke1Name) | ||
Expect(err).To(HaveOccurred(), "Found spoke ACI manifests but expected to be removed") | ||
|
||
By("verifying installed spoke cluster should still be functional") | ||
_, err = version.GetOCPVersion(Spoke1APIClient) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to get OCP version from spoke and verify spoke cluster access") | ||
|
||
// Test_Teardown and expected results validation. | ||
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") | ||
|
||
By("checking the infra env manifests exists on hub") | ||
_, err = assisted.PullInfraEnvInstall(HubAPIClient, RANConfig.Spoke1Name, RANConfig.Spoke1Name) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to find spoke infra env manifests") | ||
|
||
By("checking the bare metal host manifests exists on hub") | ||
_, err = bmh.Pull(HubAPIClient, RANConfig.Spoke1Name, RANConfig.Spoke1Name) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to find spoke bmh manifests") | ||
|
||
By("checking the cluster deployment manifests exists on hub") | ||
_, err = hive.PullClusterDeployment(HubAPIClient, RANConfig.Spoke1Name, RANConfig.Spoke1Name) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to find spoke cluster deployment manifests") | ||
|
||
By("checking the NM state config manifests exists on hub") | ||
nmStateConfigList, err = assisted.ListNmStateConfigs(HubAPIClient, RANConfig.Spoke1Name) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to list NM state config manifests") | ||
Expect(nmStateConfigList).ToNot(BeEmpty(), "Failed to find NM state config manifests") | ||
|
||
By("checking the klusterlet addon config manifests exists on hub") | ||
_, err = ocm.PullKAC(HubAPIClient, RANConfig.Spoke1Name, RANConfig.Spoke1Name) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to find spoke kac manifests") | ||
|
||
By("checking the agent cluster install manifests exists on hub") | ||
_, err = assisted.PullAgentClusterInstall(HubAPIClient, RANConfig.Spoke1Name, RANConfig.Spoke1Name) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to find spoke agent cluster install manifests") | ||
}) | ||
}) |