コード例 #1
0
	var (
		err              error
		dnsDomainService softlayer.SoftLayer_Dns_Domain_Service
	)

	BeforeEach(func() {
		dnsDomainService, err = testhelpers.CreateDnsDomainService()
		Expect(err).ToNot(HaveOccurred())

		testhelpers.TIMEOUT = 30 * time.Second
		testhelpers.POLLING_INTERVAL = 10 * time.Second
	})

	Context("SoftLayer_Dns_Domain", func() {
		It("creates a DNS Domain, update it, and delete it", func() {
			createdDnsDomain := testhelpers.CreateTestDnsDomain("test.domain.name")

			testhelpers.WaitForCreatedDnsDomainToBePresent(createdDnsDomain.Id)

			result, err := dnsDomainService.GetObject(createdDnsDomain.Id)
			Expect(err).ToNot(HaveOccurred())

			Expect(result.Name).To(Equal("test.domain.name"))

			dnsDomains, err := dnsDomainService.GetByDomainName("test.domain.name")
			Expect(err).ToNot(HaveOccurred())
			Expect(len(dnsDomains)).To(BeNumerically(">", 0))

			deleted, err := dnsDomainService.DeleteObject(createdDnsDomain.Id)
			Expect(err).ToNot(HaveOccurred())
			Expect(deleted).To(BeTrue())
	)

	BeforeEach(func() {
		dnsDomainResourceRecordService, err = testhelpers.CreateDnsDomainResourceRecordService()
		Expect(err).ToNot(HaveOccurred())

		dnsDomainService, err = testhelpers.CreateDnsDomainService()
		Expect(err).ToNot(HaveOccurred())

		testhelpers.TIMEOUT = 30 * time.Second
		testhelpers.POLLING_INTERVAL = 10 * time.Second
	})

	Context("SoftLayer_Dns_Domain_ResourceRecord", func() {
		It("creates a DNS Domain resource record, update it, and delete it", func() {
			testDnsDomain := testhelpers.CreateTestDnsDomain("test.domain.records.name")
			createdDnsDomainResourceRecord := testhelpers.CreateTestDnsDomainResourceRecord(testDnsDomain.Id)

			testhelpers.WaitForCreatedDnsDomainResourceRecordToBePresent(createdDnsDomainResourceRecord.Id)

			result, err := dnsDomainResourceRecordService.GetObject(createdDnsDomainResourceRecord.Id)
			Expect(err).ToNot(HaveOccurred())

			Expect(result.Data).To(Equal("127.0.0.1"))
			Expect(result.Host).To(Equal("test.example.com"))
			Expect(result.ResponsiblePerson).To(Equal("*****@*****.**"))
			Expect(result.Ttl).To(Equal(900))
			Expect(result.Type).To(Equal("a"))

			result.Host = "edited.test.example.com"
			result.ResponsiblePerson = "*****@*****.**"