예제 #1
0
파일: vm_test.go 프로젝트: vestel/bosh-init
		BeforeEach(func() {
			disk = fakebidisk.NewFakeDisk("fake-disk-cid")
		})

		It("detaches disk from vm in the cloud", func() {
			err := vm.DetachDisk(disk)
			Expect(err).ToNot(HaveOccurred())
			Expect(fakeCloud.DetachDiskInput).To(Equal(fakebicloud.DetachDiskInput{
				VMCID:   "fake-vm-cid",
				DiskCID: "fake-disk-cid",
			}))
		})

		Context("when detaching disk to cloud fails", func() {
			BeforeEach(func() {
				fakeCloud.DetachDiskErr = errors.New("fake-detach-error")
			})

			It("returns an error", func() {
				err := vm.DetachDisk(disk)
				Expect(err).To(HaveOccurred())
				Expect(err.Error()).To(ContainSubstring("fake-detach-error"))
			})
		})
	})

	Describe("UnmountDisk", func() {
		var disk *fakebidisk.FakeDisk

		BeforeEach(func() {
			disk = fakebidisk.NewFakeDisk("fake-disk-cid")