コード例 #1
0
				blobID, fingerprint, err := retryableBlobstore.Create("fake-file-name")
				Expect(err).ToNot(HaveOccurred())
				Expect(blobID).To(Equal("fake-blob-id"))
				Expect(fingerprint).To(Equal("fake-fingerprint"))

				Expect(innerBlobstore.CreateFileNames).To(Equal([]string{"fake-file-name"}))
			})
		})

		Context("when inner blobstore succeed exactly at maximum number of create tries", func() {
			It("returns blobID and fingerprint without an error", func() {
				innerBlobstore.CreateBlobIDs = []string{"", "", "fake-last-blob-id"}
				innerBlobstore.CreateFingerprints = []string{"", "", "fake-last-fingerprint"}
				innerBlobstore.CreateErrs = []error{
					errors.New("fake-create-err-1"),
					errors.New("fake-create-err-2"),
					nil,
				}

				blobID, fingerprint, err := retryableBlobstore.Create("fake-file-name")
				Expect(err).ToNot(HaveOccurred())
				Expect(blobID).To(Equal("fake-last-blob-id"))
				Expect(fingerprint).To(Equal("fake-last-fingerprint"))

				Expect(innerBlobstore.CreateFileNames).To(Equal(
					[]string{"fake-file-name", "fake-file-name", "fake-file-name"},
				))
			})
		})

		Context("when inner blobstore does not succeed before maximum number of create tries", func() {