Beispiel #1
0
		logger        *lagertest.TestLogger
	)

	BeforeEach(func() {
		fakeVolume = new(bfakes.FakeVolume)
		fakeDB = new(fakes.FakeVolumeFactoryDB)
		fakeClock = fakeclock.NewFakeClock(time.Unix(123, 456))
		logger = lagertest.NewTestLogger("test")

		volumeFactory = worker.NewVolumeFactory(fakeDB, fakeClock)
	})

	Context("VolumeFactory", func() {
		Describe("Build", func() {
			It("releases the volume it was given", func() {
				_, err := volumeFactory.Build(logger, fakeVolume)
				Expect(err).ToNot(HaveOccurred())
				Expect(fakeVolume.ReleaseCallCount()).To(Equal(1))
				actualTTL := fakeVolume.ReleaseArgsForCall(0)
				Expect(actualTTL).To(BeNil())
			})

			It("embeds the original volume in the wrapped volume", func() {
				fakeVolume.HandleReturns("some-handle")
				vol, err := volumeFactory.Build(logger, fakeVolume)
				Expect(err).ToNot(HaveOccurred())
				Expect(vol.Handle()).To(Equal("some-handle"))
			})
		})
	})
Beispiel #2
0
		fakeDB        *fakes.FakeVolumeFactoryDB
		fakeClock     *fakeclock.FakeClock
	)

	BeforeEach(func() {
		fakeVolume = new(bfakes.FakeVolume)
		fakeDB = new(fakes.FakeVolumeFactoryDB)
		fakeClock = fakeclock.NewFakeClock(time.Unix(123, 456))

		volumeFactory = worker.NewVolumeFactory(lagertest.NewTestLogger("test"), fakeDB, fakeClock)
	})

	Context("VolumeFactory", func() {
		Describe("Build", func() {
			It("releases the volume it was given", func() {
				_, err := volumeFactory.Build(fakeVolume)
				Expect(err).ToNot(HaveOccurred())
				Expect(fakeVolume.ReleaseCallCount()).To(Equal(1))
				actualTTL := fakeVolume.ReleaseArgsForCall(0)
				Expect(actualTTL).To(Equal(time.Duration(0)))
			})

			It("embeds the original volume in the wrapped volume", func() {
				fakeVolume.HandleReturns("some-handle")
				vol, err := volumeFactory.Build(fakeVolume)
				Expect(err).ToNot(HaveOccurred())
				Expect(vol.Handle()).To(Equal("some-handle"))
			})
		})
	})