Ejemplo n.º 1
0
					err := act()
					Expect(err).ToNot(HaveOccurred())
					Expect(diskManager.FakePartitioner.PartitionCalled).To(BeFalse())
				})

				It("does not format the disk", func() {
					err := act()
					Expect(err).ToNot(HaveOccurred())
					Expect(diskManager.FakeFormatter.FormatCalled).To(BeFalse())
				})
			})
		})

		Context("when device path is not successfully resolved", func() {
			It("return an error", func() {
				devicePathResolver.GetRealDevicePathErr = errors.New("fake-get-real-device-path-err")

				err := act()
				Expect(err).To(HaveOccurred())
				Expect(err.Error()).To(ContainSubstring("fake-get-real-device-path-err"))
			})
		})
	})

	Describe("UnmountPersistentDisk", func() {
		act := func() (bool, error) { return platform.UnmountPersistentDisk("fake-device-path") }

		Context("when device path can be resolved", func() {
			BeforeEach(func() {
				devicePathResolver.RegisterRealDevicePath("fake-device-path", "fake-real-device-path")
			})