Exemple #1
0
		})

		JustBeforeEach(func() {
			insertedWorker, err = database.SaveWorker(workerToInsert, 2*time.Minute)
			Expect(err).NotTo(HaveOccurred())

			insertedWorker2, err = database.SaveWorker(workerToInsert2, 2*time.Minute)
			Expect(err).NotTo(HaveOccurred())

			volumeToInsert.WorkerName = insertedWorker.Name
			err = database.InsertVolume(volumeToInsert)
			Expect(err).NotTo(HaveOccurred())
		})

		It("can be retrieved", func() {
			volumes, err := database.GetVolumes()
			Expect(err).NotTo(HaveOccurred())
			Expect(len(volumes)).To(Equal(1))
			actualVolume := volumes[0]
			Expect(actualVolume.WorkerName).To(Equal(volumeToInsert.WorkerName))
			Expect(actualVolume.TTL).To(Equal(volumeToInsert.TTL))
			Expect(actualVolume.ExpiresIn).To(BeNumerically("~", volumeToInsert.TTL, time.Second))
			Expect(actualVolume.Handle).To(Equal(volumeToInsert.Handle))
			Expect(actualVolume.ResourceVersion).To(Equal(volumeToInsert.ResourceVersion))
			Expect(actualVolume.ResourceHash).To(Equal(volumeToInsert.ResourceHash))
			Expect(actualVolume.WorkerName).To(Equal(insertedWorker.Name))
		})

		It("can be reaped", func() {
			volumeToInsert2 := db.Volume{
				WorkerName: insertedWorker2.Name,