}) It("returns error if inner blobstore cleaning up fails", func() { innerBlobstore.CleanUpErr = errors.New("fake-clean-up-error") err := sha1VerifiableBlobstore.CleanUp("/some/file") Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-clean-up-error")) }) }) Describe("Create", func() { It("delegates to inner blobstore to create blob and returns sha1 of returned blob", func() { innerBlobstore.CreateBlobID = "fake-blob-id" blobID, sha1, err := sha1VerifiableBlobstore.Create(fixturePath) Expect(err).ToNot(HaveOccurred()) Expect(blobID).To(Equal("fake-blob-id")) Expect(sha1).To(Equal(fixtureSHA1)) Expect(innerBlobstore.CreateFileName).To(Equal(fixturePath)) }) It("returns error if inner blobstore blob creation fails", func() { innerBlobstore.CreateErr = errors.New("fake-create-error") _, _, err := sha1VerifiableBlobstore.Create(fixturePath) Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-create-error")) }) })
It("returns error if inner blobstore cleaning up fails", func() { innerBlobstore.CleanUpErr = errors.New("fake-clean-up-error") err := retryableBlobstore.CleanUp("/some/file") Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-clean-up-error")) }) }) Describe("Create", func() { It("delegates to inner blobstore to create blob", func() { innerBlobstore.CreateBlobID = "fake-blob-id" innerBlobstore.CreateFingerprint = "fake-fingerprint" blobID, sha1, err := retryableBlobstore.Create("fake-blob-path") Expect(err).ToNot(HaveOccurred()) Expect(blobID).To(Equal("fake-blob-id")) Expect(sha1).To(Equal("fake-fingerprint")) Expect(innerBlobstore.CreateFileName).To(Equal("fake-blob-path")) }) It("returns error if inner blobstore blob creation fails", func() { innerBlobstore.CreateErr = errors.New("fake-create-error") _, _, err := retryableBlobstore.Create("fake-blob-path") Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-create-error")) }) })