Ejemplo n.º 1
0
				))
			})
		})
	})

	Describe("Validate", func() {
		It("returns error if max tries is < 1", func() {
			err := boshblob.NewRetryableBlobstore(innerBlobstore, -1, logger).Validate()
			Expect(err).To(HaveOccurred())
			Expect(err.Error()).To(ContainSubstring("Max tries must be > 0"))

			err = boshblob.NewRetryableBlobstore(innerBlobstore, 0, logger).Validate()
			Expect(err).To(HaveOccurred())
			Expect(err.Error()).To(ContainSubstring("Max tries must be > 0"))
		})

		It("delegates to inner blobstore to validate", func() {
			err := retryableBlobstore.Validate()
			Expect(err).ToNot(HaveOccurred())
		})

		It("returns error if inner blobstore validation fails", func() {
			innerBlobstore.ValidateError = bosherr.Error("fake-validate-error")

			err := retryableBlobstore.Validate()
			Expect(err).To(HaveOccurred())
			Expect(err.Error()).To(ContainSubstring("fake-validate-error"))
		})
	})
})
Ejemplo n.º 2
0
			_, err := cascadingBlobstore.Create("createdFile")

			Expect(err).ToNot(BeNil())
			Expect(err.Error()).To(Equal("error creating"))
		})
	})

	Describe("Validate", func() {
		It("delegates the action to the inner blobstore", func() {
			err := cascadingBlobstore.Validate()

			Expect(err).To(BeNil())
		})

		It("returns an error if the inner blobstore fails to validate", func() {
			innerBlobstore.ValidateError = errors.New("error validating")

			err := cascadingBlobstore.Validate()

			Expect(err).ToNot(BeNil())
			Expect(err.Error()).To(Equal("error validating"))
		})
	})

	Describe("Delete", func() {
		It("deletes the blob from the blobManager, and calls Delete on inner blobstore", func() {
			blobID := "smurf-25"

			blobManager.DeleteReturns(nil)
			innerBlobstore.DeleteErr = nil