Skip to content

Commit

Permalink
OCM-9940 | test: automated id:34950 check available regions
Browse files Browse the repository at this point in the history
  • Loading branch information
jerichokeyne committed Oct 7, 2024
1 parent 402028c commit 99ae50e
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/e2e/test_rosacli_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,51 @@ var _ = Describe("Region",
}
})

It("Available regions can be listed by ROSA cli - [id:34950]",
labels.Medium, labels.Runtime.OCMResources,
func() {
By("Can list regions")
regions, _, err := ocmResourceService.ListRegion()
Expect(err).ToNot(HaveOccurred())
Expect(len(regions)).NotTo(Equal(0))

By("Make sure help message works")
_, out, err := ocmResourceService.ListRegion("--help")
Expect(err).ToNot(HaveOccurred())
Expect(len(regions)).NotTo(Equal(0))
Expect(out.String()).To(ContainSubstring("List regions that are available for the current AWS account"))

By("Make sure regions are coming from the right endpoint")
regions, out, err = ocmResourceService.ListRegion("--debug")
Expect(err).ToNot(HaveOccurred())
Expect(len(regions)).NotTo(Equal(0))
regex :=
".*Request URL is 'https://api.*.openshift.com/api/clusters_mgmt/v1/cloud_providers/aws/available_regions.*"
Expect(out.String()).To(MatchRegexp(regex))

By("Can list multi-az regions")
multiAZRegions, _, err := ocmResourceService.ListRegion("--multi-az")
Expect(err).ToNot(HaveOccurred())
Expect(len(multiAZRegions)).NotTo(Equal(0))
for _, r := range multiAZRegions {
Expect(r.MultiAZSupported).To(Equal("true"))
}

By("Can list hosted-cp regions")
hostedCPRegions, _, err := ocmResourceService.ListRegion("--hosted-cp")
Expect(err).ToNot(HaveOccurred())
Expect(len(hostedCPRegions)).NotTo(Equal(0))
for _, r := range hostedCPRegions {
Expect(r.HypershiftSupported).To(Equal("true"))
}

By("Check unsupported flag")
invalidFlag, out, err := ocmResourceService.ListRegion("--invalid")
Expect(err).To(HaveOccurred())
Expect(invalidFlag).To(BeEmpty())
Expect(out.String()).To(ContainSubstring("unknown flag: --invalid"))
})

It("List instance-types with region flag - [id:72174]",
labels.Low, labels.Runtime.OCMResources,
func() {
Expand Down

0 comments on commit 99ae50e

Please sign in to comment.