|
| 1 | +package e2e |
| 2 | + |
| 3 | +import ( |
| 4 | + . "github.com/onsi/ginkgo/v2" |
| 5 | + . "github.com/onsi/gomega" |
| 6 | + |
| 7 | + "github.com/openshift/rosa/tests/ci/labels" |
| 8 | + "github.com/openshift/rosa/tests/utils/exec/rosacli" |
| 9 | + "github.com/openshift/rosa/tests/utils/helper" |
| 10 | +) |
| 11 | + |
| 12 | +var _ = Describe("DNS domain tests", |
| 13 | + labels.Feature.Ingress, |
| 14 | + func() { |
| 15 | + defer GinkgoRecover() |
| 16 | + |
| 17 | + var ( |
| 18 | + rosaClient *rosacli.Client |
| 19 | + dnsDomainService rosacli.OCMResourceService |
| 20 | + dnsDomainC string |
| 21 | + dnsDomainH string |
| 22 | + ) |
| 23 | + |
| 24 | + BeforeEach(func() { |
| 25 | + |
| 26 | + By("Init the client") |
| 27 | + rosaClient = rosacli.NewClient() |
| 28 | + dnsDomainService = rosaClient.OCMResource |
| 29 | + |
| 30 | + }) |
| 31 | + |
| 32 | + It("can create/list/delete dns-domain via rosacli - [id:65793]", |
| 33 | + labels.Critical, labels.Runtime.OCMResources, |
| 34 | + func() { |
| 35 | + By("Create dns-domain for classic cluster") |
| 36 | + outputC, err := dnsDomainService.CreateDNSDomain() |
| 37 | + Expect(err).ToNot(HaveOccurred()) |
| 38 | + defer func() { |
| 39 | + By("Delete the created dns-domain for classic cluster") |
| 40 | + output, err := dnsDomainService.DeleteDNSDomain(dnsDomainC) |
| 41 | + Expect(err).ToNot(HaveOccurred()) |
| 42 | + Expect(output.String()).To(ContainSubstring("Successfully deleted dns domain '%s'", dnsDomainC)) |
| 43 | + |
| 44 | + By("Check the created dns-domain for classic cluster delete") |
| 45 | + out, err := dnsDomainService.ListDNSDomain() |
| 46 | + Expect(err).ToNot(HaveOccurred()) |
| 47 | + Expect(out.String()).ToNot(ContainSubstring(dnsDomainC)) |
| 48 | + }() |
| 49 | + dnsDomainC, err = helper.ExtractDNSDomainID(outputC) |
| 50 | + Expect(err).ToNot(HaveOccurred()) |
| 51 | + |
| 52 | + By("List the created dns-domain for classic cluster") |
| 53 | + out, err := dnsDomainService.ListDNSDomain() |
| 54 | + Expect(err).ToNot(HaveOccurred()) |
| 55 | + dnsDomainList, err := dnsDomainService.ReflectDNSDomainList(out) |
| 56 | + Expect(err).ToNot(HaveOccurred()) |
| 57 | + dnsDomain := dnsDomainList.GetDNSDomain(dnsDomainC) |
| 58 | + Expect(dnsDomain.ID).To(Equal(dnsDomainC)) |
| 59 | + Expect(dnsDomain.UserDefined).To(Equal("Yes")) |
| 60 | + Expect(dnsDomain.Architecture).To(Equal("classic")) |
| 61 | + |
| 62 | + By("Create dns-domain for hosted-cp cluster") |
| 63 | + outputH, err := dnsDomainService.CreateDNSDomain("--hosted-cp") |
| 64 | + Expect(err).ToNot(HaveOccurred()) |
| 65 | + defer func() { |
| 66 | + By("Delete the created dns-domain for hosted-cp cluster") |
| 67 | + output, err := dnsDomainService.DeleteDNSDomain(dnsDomainH) |
| 68 | + Expect(err).ToNot(HaveOccurred()) |
| 69 | + Expect(output.String()).To(ContainSubstring("Successfully deleted dns domain '%s'", dnsDomainH)) |
| 70 | + |
| 71 | + By("Check the created dns-domain for hosted-cp cluster delete") |
| 72 | + out, err := dnsDomainService.ListDNSDomain() |
| 73 | + Expect(err).ToNot(HaveOccurred()) |
| 74 | + Expect(out.String()).ToNot(ContainSubstring(dnsDomainH)) |
| 75 | + }() |
| 76 | + dnsDomainH, err = helper.ExtractDNSDomainID(outputH) |
| 77 | + Expect(err).ToNot(HaveOccurred()) |
| 78 | + |
| 79 | + By("List the created dns-domain for hosted-cp cluster") |
| 80 | + out, err = dnsDomainService.ListDNSDomain() |
| 81 | + Expect(err).ToNot(HaveOccurred()) |
| 82 | + dnsDomainList, err = dnsDomainService.ReflectDNSDomainList(out) |
| 83 | + Expect(err).ToNot(HaveOccurred()) |
| 84 | + dnsDomain = dnsDomainList.GetDNSDomain(dnsDomainH) |
| 85 | + Expect(dnsDomain.ID).To(Equal(dnsDomainH)) |
| 86 | + Expect(dnsDomain.UserDefined).To(Equal("Yes")) |
| 87 | + Expect(dnsDomain.Architecture).To(Equal("hcp")) |
| 88 | + |
| 89 | + By("List the created dns-domain with '--hosted-cp' flag") |
| 90 | + out, err = dnsDomainService.ListDNSDomain("--hosted-cp") |
| 91 | + Expect(err).ToNot(HaveOccurred()) |
| 92 | + dnsDomainList, err = dnsDomainService.ReflectDNSDomainList(out) |
| 93 | + Expect(err).ToNot(HaveOccurred()) |
| 94 | + dnsDomain = dnsDomainList.GetDNSDomain(dnsDomainH) |
| 95 | + Expect(dnsDomain.ID).To(Equal(dnsDomainH)) |
| 96 | + Expect(dnsDomain.UserDefined).To(Equal("Yes")) |
| 97 | + Expect(dnsDomain.Architecture).To(Equal("hcp")) |
| 98 | + }) |
| 99 | + |
| 100 | + }) |
0 commit comments