Example #1
0
				Expect(err.Error()).To(ContainSubstring("Reading fileName"))
			})

			It("deletes the file once read", func() {
				_, err := syncDNS.Run("fake-blobstore-id", "fake-fingerprint")
				Expect(err).ToNot(HaveOccurred())

				Expect(fakeFileSystem.FileExists("fake-blobstore-file-path")).To(BeFalse())
			})

			It("logs when the dns blob file can't be deleted", func() {
				fakeFileSystem.RegisterRemoveAllError("fake-blobstore-file-path", errors.New("fake-file-path-error"))
				_, err := syncDNS.Run("fake-blobstore-id", "fake-fingerprint")
				Expect(err).ToNot(HaveOccurred())

				tag, message, _ := logger.InfoArgsForCall(0)
				Expect(tag).To(Equal("Sync DNS action"))
				Expect(message).To(Equal("Failed to remove dns blob file at path 'fake-blobstore-file-path'"))
			})

			It("saves DNS records to the platform", func() {
				response, err := syncDNS.Run("fake-blobstore-id", "fake-fingerprint")
				Expect(err).ToNot(HaveOccurred())
				Expect(response).To(Equal("synced"))

				Expect(fakePlatform.SaveDNSRecordsError).To(BeNil())
				Expect(fakePlatform.SaveDNSRecordsDNSRecords).To(Equal(boshsettings.DNSRecords{
					Records: [][2]string{
						{"fake-ip0", "fake-name0"},
						{"fake-ip1", "fake-name1"},
					},