Exemple #1
0
				vol, err := volumeFactory.Build(logger, fakeVolume)
				Expect(err).ToNot(HaveOccurred())
				Expect(vol.Handle()).To(Equal("some-handle"))
			})
		})
	})

	Context("Volume", func() {
		var expectedTTL time.Duration
		var expectedTTL2 time.Duration

		BeforeEach(func() {
			expectedTTL = 10 * time.Second
			expectedTTL2 = 5 * time.Second
			fakeVolume.HandleReturns("some-handle")
			fakeDB.GetVolumeTTLReturns(expectedTTL, nil)
		})

		It("heartbeats", func() {
			vol, err := volumeFactory.Build(logger, fakeVolume)
			Expect(err).ToNot(HaveOccurred())

			By("looking up the initial ttl in the database")
			Expect(fakeDB.GetVolumeTTLCallCount()).To(Equal(1))
			actualHandle := fakeDB.GetVolumeTTLArgsForCall(0)
			Expect(actualHandle).To(Equal("some-handle"))

			By("using that ttl to heartbeat the volume initially")
			Expect(fakeVolume.SetTTLCallCount()).To(Equal(1))
			actualTTL := fakeVolume.SetTTLArgsForCall(0)
			Expect(actualTTL).To(Equal(expectedTTL))