Example #1
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))
			})

			It("can be updated to zero to mean 'keep around forever'", func() {
				volumes, err := database.GetVolumes()
				Expect(err).NotTo(HaveOccurred())
				Expect(len(volumes)).To(Equal(1))

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