Esempio n. 1
0
package resource_test

import (
	"errors"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	. "github.com/concourse/atc/resource"
)

var _ = Describe("Resource", func() {
	Describe("Release", func() {
		It("releases the container", func() {
			resource.Release()

			Ω(fakeContainer.ReleaseCallCount()).Should(Equal(1))
		})
	})

	Describe("Destroy", func() {
		It("destroys the container", func() {
			err := resource.Destroy()
			Ω(err).ShouldNot(HaveOccurred())

			Ω(fakeContainer.DestroyCallCount()).Should(Equal(1))
		})

		It("only destroys on the first call", func() {
			err := resource.Destroy()
			Ω(err).ShouldNot(HaveOccurred())
Esempio n. 2
0
import (
	"time"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	. "github.com/concourse/atc/resource"
	"github.com/concourse/atc/worker"
	bfakes "github.com/concourse/baggageclaim/fakes"
)

var _ = Describe("Resource", func() {
	Describe("Release", func() {
		It("releases the container", func() {
			resource.Release(worker.FinalTTL(time.Hour))

			Expect(fakeContainer.ReleaseCallCount()).To(Equal(1))
			Expect(fakeContainer.ReleaseArgsForCall(0)).To(Equal(worker.FinalTTL(time.Hour)))
		})
	})

	Describe("CacheVolume", func() {
		Context("when the container has a volume mount for /tmp/build/get", func() {
			var vol1 *bfakes.FakeVolume
			var vol2 *bfakes.FakeVolume

			BeforeEach(func() {
				vol1 = new(bfakes.FakeVolume)
				vol2 = new(bfakes.FakeVolume)
				fakeContainer.VolumeMountsReturns([]worker.VolumeMount{
Esempio n. 3
0
import (
	"time"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	. "github.com/concourse/atc/resource"
	"github.com/concourse/atc/worker"
	bfakes "github.com/concourse/baggageclaim/fakes"
)

var _ = Describe("Resource", func() {
	Describe("Release", func() {
		It("releases the container", func() {
			resource.Release(time.Hour)

			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})
			})