예제 #1
0
				vol1 = new(bfakes.FakeVolume)
				vol2 = new(bfakes.FakeVolume)
				fakeContainer.VolumeMountsReturns([]worker.VolumeMount{
					{
						Volume:    vol1,
						MountPath: "/tmp/build/get",
					},
					{
						Volume:    vol2,
						MountPath: "/tmp/build/forgetaboutit",
					},
				})
			})

			It("returns the volume and true", func() {
				volume, found := resource.CacheVolume()
				Expect(found).To(BeTrue())

				Expect(fakeContainer.VolumeMountsCallCount()).To(Equal(1))

				Expect(volume).To(Equal(vol1))
			})
		})

		Context("when the container does not have a volume mount for /tmp/build/get", func() {
			var vol1 *bfakes.FakeVolume

			BeforeEach(func() {
				vol1 = new(bfakes.FakeVolume)
				fakeContainer.VolumeMountsReturns([]worker.VolumeMount{
					{
예제 #2
0
파일: resource_test.go 프로젝트: ACPK/atc
			Expect(fakeContainer.ReleaseCallCount()).To(Equal(1))
			Expect(fakeContainer.ReleaseArgsForCall(0)).To(Equal(time.Hour))
		})
	})

	Describe("CacheVolume", func() {
		Context("when the container has one volume", func() {
			var vol1 *bfakes.FakeVolume

			BeforeEach(func() {
				vol1 = new(bfakes.FakeVolume)
				fakeContainer.VolumesReturns([]worker.Volume{vol1})
			})

			It("returns the volume and true", func() {
				volume, found, err := resource.CacheVolume()
				Expect(err).NotTo(HaveOccurred())
				Expect(found).To(BeTrue())

				Expect(fakeContainer.VolumesCallCount()).To(Equal(1))

				Expect(volume).To(Equal(vol1))
			})
		})

		Context("when the container has two volumes", func() {
			var vol1 *bfakes.FakeVolume
			var vol2 *bfakes.FakeVolume

			BeforeEach(func() {
				vol1 = new(bfakes.FakeVolume)