コード例 #1
0
				})
			})

			Context("umount", func() {
				It("should be able to unmount", func() {
					volumeId := "fake-volume"

					err := client.Unmount(logger, "fakedriver", volumeId)
					Expect(err).NotTo(HaveOccurred())
					Expect(fakeDriver.UnmountCallCount()).To(Equal(1))
					Expect(fakeDriver.RemoveCallCount()).To(Equal(0))
				})

				It("should not be able to unmount when driver unmount fails", func() {
					fakeDriver.UnmountReturns(voldriver.ErrorResponse{Err: "unmount failure"})
					volumeId := "fake-volume"

					err := client.Unmount(logger, "fakedriver", volumeId)
					Expect(err).To(HaveOccurred())
				})
				Context("with metrics", func() {
					var sender *fake.FakeMetricSender

					BeforeEach(func() {
						sender = fake.NewFakeMetricSender()
						metrics.Initialize(sender, nil)

					})

					It("should emit unmount time on successful unmount", func() {
コード例 #2
0
				fakeDriver.ListReturns(voldriver.ListResponse{Volumes: []voldriver.VolumeInfo{
					{
						Name:       "a-volume",
						Mountpoint: "foo",
					},
				}})
			})

			It("should unmount the volume", func() {
				err := purger.PurgeMounts(logger)
				Expect(err).NotTo(HaveOccurred())

				Expect(fakeDriver.UnmountCallCount()).To(Equal(1))
			})

			Context("when the unmount fails", func() {
				BeforeEach(func() {
					fakeDriver.UnmountReturns(voldriver.ErrorResponse{Err: "badness"})
				})

				It("should log but not fail", func() {
					err := purger.PurgeMounts(logger)
					Expect(err).NotTo(HaveOccurred())

					Expect(logger.TestSink.LogMessages()).To(ContainElement("mount-purger.purge-mounts.failed-purging-volume-mount"))
				})
			})
		})
	})
})