コード例 #1
0
		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())

			testhelpers.WaitForDeletedDnsDomainToNoLongerBePresent(createdDnsDomain.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 = "*****@*****.**"
			dnsDomainResourceRecordService.EditObject(createdDnsDomainResourceRecord.Id, result)

			result2, err := dnsDomainResourceRecordService.GetObject(createdDnsDomainResourceRecord.Id)
			Expect(err).ToNot(HaveOccurred())
			Expect(result2.Host).To(Equal("edited.test.example.com"))
			Expect(result2.ResponsiblePerson).To(Equal("*****@*****.**"))

			deleted, err := dnsDomainResourceRecordService.DeleteObject(createdDnsDomainResourceRecord.Id)
			Expect(err).ToNot(HaveOccurred())
			Expect(deleted).To(BeTrue())

			//clean up
			deletedDns, err := dnsDomainService.DeleteObject(testDnsDomain.Id)
			Expect(err).ToNot(HaveOccurred())
			Expect(deletedDns).To(BeTrue())
		})
	})
})