Exemplo n.º 1
0
							"bucket_name": "bucket-name",
							"droplet_name": "other-drippy"
						}
					}`,
				},
			}
			fakeAppExaminer.ListAppsReturns(appInfos, nil)

			err := dropletRunner.RemoveDroplet("drippy")
			Expect(err).ToNot(HaveOccurred())

			Expect(fakeBlobBucket.ListCallCount()).To(Equal(1))
			prefix, _, _, _ := fakeBlobBucket.ListArgsForCall(0)
			Expect(prefix).To(Equal("drippy/"))

			Expect(fakeBlobBucket.DelCallCount()).To(Equal(3))
		})

		It("returns an error when querying the blob store fails", func() {
			config.SetBlobTarget("blob-host", 7474, "access-key", "secret-key", "bucket-name")
			config.Save()

			fakeBlobBucket.ListReturns(nil, errors.New("boom"))

			err := dropletRunner.RemoveDroplet("drippy")
			Expect(err).To(HaveOccurred())
		})

		It("returns an error when the app specifies that the droplet is in use", func() {
			config.SetBlobTarget("blob-host", 7474, "access-key", "secret-key", "bucket-name")
			config.Save()