Ejemplo n.º 1
0
		Context("expired volumes", func() {
			BeforeEach(func() {
				volumeToInsert.TTL = -time.Hour
			})

			It("does not return them", func() {
				volumes, err := database.GetVolumes()
				Expect(err).NotTo(HaveOccurred())
				Expect(len(volumes)).To(Equal(0))
			})
		})

		Context("TTL's", func() {
			It("can be retrieved by volume handler", func() {
				actualTTL, err := database.GetVolumeTTL(volumeToInsert.Handle)
				Expect(err).NotTo(HaveOccurred())
				Expect(actualTTL).To(Equal(volumeToInsert.TTL))
			})

			It("can be updated", func() {
				volumes, err := database.GetVolumes()
				Expect(err).NotTo(HaveOccurred())
				Expect(len(volumes)).To(Equal(1))

				err = database.SetVolumeTTL(volumes[0].Handle, -time.Hour)
				Expect(err).NotTo(HaveOccurred())

				volumes, err = database.GetVolumes()
				Expect(err).NotTo(HaveOccurred())
				Expect(len(volumes)).To(Equal(0))