import ( "errors" . "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo" . "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega" boshblob "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/blobstore" fakeblob "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/blobstore/fakes" bosherr "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/errors" boshlog "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/logger" ) var _ = Describe("retryableBlobstore", func() { var ( innerBlobstore *fakeblob.FakeBlobstore logger boshlog.Logger retryableBlobstore boshblob.Blobstore ) BeforeEach(func() { innerBlobstore = &fakeblob.FakeBlobstore{} logger = boshlog.NewLogger(boshlog.LevelNone) retryableBlobstore = boshblob.NewRetryableBlobstore(innerBlobstore, 3, logger) }) Describe("Get", func() { Context("when inner blobstore succeeds before maximum number of get tries (first time)", func() { It("returns path without an error", func() { innerBlobstore.GetFileName = "fake-path" path, err := retryableBlobstore.Get("fake-blob-id", "fake-fingerprint")
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" boshblob "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/blobstore" fakeblob "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/blobstore/fakes" bosherr "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/errors" ) var _ = Describe("sha1VerifiableBlobstore", func() { const ( fixturePath = "test_assets/some.config" fixtureSHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709" ) var ( innerBlobstore *fakeblob.FakeBlobstore sha1VerifiableBlobstore boshblob.Blobstore ) BeforeEach(func() { innerBlobstore = &fakeblob.FakeBlobstore{} sha1VerifiableBlobstore = boshblob.NewSHA1VerifiableBlobstore(innerBlobstore) }) Describe("Get", func() { It("returns without an error if sha1 matches", func() { innerBlobstore.GetFileName = fixturePath fileName, err := sha1VerifiableBlobstore.Get("fake-blob-id", fixtureSHA1) Expect(err).ToNot(HaveOccurred()) Expect(innerBlobstore.GetBlobIDs).To(Equal([]string{"fake-blob-id"}))