Exemple #1
0
var _ = Describe("Volumes", func() {
	var (
		volumeFactory worker.VolumeFactory
		fakeVolume    *bfakes.FakeVolume
		fakeDB        *fakes.FakeVolumeFactoryDB
		fakeClock     *fakeclock.FakeClock
		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)
Exemple #2
0
)

var _ = Describe("Volumes", func() {
	var (
		volumeFactory worker.VolumeFactory
		fakeVolume    *bfakes.FakeVolume
		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)