-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCM-8152 | test: automated id:38816 List cluster via ROSA cli will wo…
…rk well
- Loading branch information
1 parent
3596c43
commit 208d3c4
Showing
2 changed files
with
117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package e2e | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
"github.com/openshift/rosa/tests/ci/labels" | ||
"github.com/openshift/rosa/tests/utils/config" | ||
"github.com/openshift/rosa/tests/utils/exec/rosacli" | ||
"github.com/openshift/rosa/tests/utils/log" | ||
) | ||
|
||
var _ = Describe("List resources", | ||
labels.Day2, | ||
labels.FeatureMachinepool, | ||
labels.NonHCPCluster, | ||
func() { | ||
defer GinkgoRecover() | ||
var ( | ||
clusterID string | ||
rosaClient *rosacli.Client | ||
ocmResourceService rosacli.OCMResourceService | ||
) | ||
|
||
BeforeEach(func() { | ||
By("Get the cluster") | ||
clusterID = config.GetClusterID() | ||
Expect(clusterID).ToNot(Equal(""), "ClusterID is required. Please export CLUSTER_ID") | ||
|
||
By("Init the client") | ||
rosaClient = rosacli.NewClient() | ||
ocmResourceService = rosaClient.OCMResource | ||
}) | ||
|
||
AfterEach(func() { | ||
By("Clean remaining resources") | ||
rosaClient.CleanResources(clusterID) | ||
|
||
}) | ||
|
||
It("can create/describe/delete admin user - [id:38816]", | ||
labels.Medium, | ||
func() { | ||
var ( | ||
clusterData []string | ||
) | ||
|
||
By("List all clusters") | ||
clusterList, _, err := ocmResourceService.ListClusters() | ||
Expect(err).To(BeNil()) | ||
if err != nil { | ||
log.Logger.Errorf("Failed to fetch clusters: %v", err) | ||
return | ||
} | ||
|
||
for _, it := range clusterList.ClusterList { | ||
clusterData = append(clusterData, it.ID) | ||
} | ||
Expect(err).To(BeNil()) | ||
Expect(clusterData).Should(ContainElement(clusterID)) | ||
|
||
clusterData = []string{} | ||
By("List clusters with '--all' flag") | ||
clusterList, _, err = ocmResourceService.ListClusters("--all") | ||
Expect(err).To(BeNil()) | ||
if err != nil { | ||
log.Logger.Errorf("Failed to fetch clusters: %v", err) | ||
return | ||
} | ||
for _, it := range clusterList.ClusterList { | ||
clusterData = append(clusterData, it.ID) | ||
} | ||
Expect(err).To(BeNil()) | ||
Expect(clusterData).Should(ContainElement(clusterID)) | ||
}) | ||
}) |
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