Example #1
0
				Expect(path).To(Equal("drippy/result.json"))
				Expect(ioutil.ReadAll(contents)).To(Equal([]byte("result metadata")))
			})

			Context("when the blob bucket returns error(s)", func() {
				It("returns an error uploading the droplet file", func() {
					fakeBlobStore.UploadReturns(errors.New("some error"))

					err := dropletRunner.ImportDroplet("drippy", dropletPathArg, metadataPathArg)
					Expect(err).To(MatchError("some error"))
				})

				It("returns an error uploading the metadata file", func() {
					fakeBlobStore.UploadStub = func(path string, contents io.ReadSeeker) error {
						if strings.HasSuffix(path, "result.json") {
							return errors.New("some error")
						}
						return nil
					}

					err := dropletRunner.ImportDroplet("drippy", dropletPathArg, metadataPathArg)
					Expect(err).To(MatchError("some error"))
				})
			})
		})

		Context("when the droplet files do not exist", func() {
			It("returns an error opening the droplet file", func() {
				err := dropletRunner.ImportDroplet("drippy", "some/missing/droplet/path", metadataPathArg)
				Expect(err).To(MatchError("open some/missing/droplet/path: no such file or directory"))
			})