Example #1
0
			Context("when DNS records is invalid", func() {
				BeforeEach(func() {
					err := fakeFileSystem.WriteFileString("fake-blobstore-file-path", "")
					Expect(err).ToNot(HaveOccurred())
				})

				It("fails unmarshalling the DNS records from the file", func() {
					_, err := syncDNS.Run("fake-blobstore-id", "fake-fingerprint")
					Expect(err).To(HaveOccurred())
					Expect(err.Error()).To(ContainSubstring("Unmarshalling DNS records"))
				})
			})

			Context("when platform fails to save DNS records", func() {
				BeforeEach(func() {
					fakePlatform.SaveDNSRecordsError = errors.New("fake-error")
				})

				It("fails to save DNS records on the platform", func() {
					_, err := syncDNS.Run("fake-blobstore-id", "fake-fingerprint")
					Expect(err).To(HaveOccurred())
					Expect(err.Error()).To(ContainSubstring("Saving DNS records in platform"))
				})
			})
		})

		Context("when blobstore does not contain DNS records", func() {
			It("fails getting the DNS records", func() {
				_, err := syncDNS.Run("fake-blobstore-id", "fake-fingerprint")
				Expect(err).To(HaveOccurred())
			})