Expect(err.Error()).To(ContainSubstring("fake-stop-error")) Expect(fakeStage.PerformCalls).To(Equal([]*fakebiui.PerformCall{ {Name: "Waiting for the agent on VM 'fake-vm-cid'"}, { Name: "Stopping jobs on instance 'fake-job-name/0'", Error: stopError, }, })) }) }) Context("when unmounting disk fails", func() { BeforeEach(func() { fakeVM.ListDisksDisks = []bidisk.Disk{fakebidisk.NewFakeDisk("fake-disk")} fakeVM.UnmountDiskErr = bosherr.Error("fake-unmount-error") }) It("returns an error", func() { err := instance.Delete(pingTimeout, pingDelay, fakeStage) Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-unmount-error")) Expect(fakeStage.PerformCalls[2].Name).To(Equal("Unmounting disk 'fake-disk'")) Expect(fakeStage.PerformCalls[2].Error).To(HaveOccurred()) Expect(fakeStage.PerformCalls[2].Error.Error()).To(Equal("Unmounting disk 'fake-disk' from VM 'fake-vm-cid': fake-unmount-error")) }) }) }) Context("when agent fails to respond", func() {