Ejemplo n.º 1
0
				TTL:        time.Hour,
				Handle:     "some-volume-handle3",
				VolumeIdentifier: db.VolumeIdentifier{
					ResourceVersion: atc.Version{"some": "version"},
					ResourceHash:    "some-hash3",
				},
			}
			err = database.InsertVolume(volumeToInsert3)
			Expect(err).NotTo(HaveOccurred())

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

			reapedVolume := volumes[0]
			err = database.ReapVolume(reapedVolume.Handle)
			Expect(err).NotTo(HaveOccurred())

			volumes, err = database.GetVolumes()
			Expect(err).NotTo(HaveOccurred())
			Expect(len(volumes)).To(Equal(2))
			Expect(volumes).NotTo(ContainElement(reapedVolume))
		})

		It("can insert the same data twice, without erroring or data duplication", func() {
			err := database.InsertVolume(volumeToInsert)
			Expect(err).NotTo(HaveOccurred())

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