) var _ = Describe("Baggage-collecting image resource volumes", func() { Context("when there is a single job", func() { var ( fakeWorkerClient *wfakes.FakeClient workerA *wfakes.FakeWorker workerB *wfakes.FakeWorker workerBBaggageClaimClient *bcfakes.FakeClient dockerVolume *bcfakes.FakeVolume workerC *wfakes.FakeWorker workerCBaggageClaimClient *bcfakes.FakeClient crossedWiresVolume *bcfakes.FakeVolume fakeBaggageCollectorDB *fakes.FakeBaggageCollectorDB fakePipelineDBFactory *dbfakes.FakePipelineDBFactory expectedOldVersionTTL = 4 * time.Minute expectedLatestVersionTTL = time.Duration(0) expectedOneOffTTL = 5 * time.Hour baggageCollector lostandfound.BaggageCollector savedPipeline db.SavedPipeline fakePipelineDB *dbfakes.FakePipelineDB ) BeforeEach(func() { fakeWorkerClient = new(wfakes.FakeClient)
logger, metadata, session, initType, []string{"resource", "tags"}, cacheIdentifier, ) }) Context("when a container does not exist for the session", func() { BeforeEach(func() { workerClient.FindContainerForIdentifierReturns(nil, false, nil) }) Context("when a worker is found", func() { var satisfyingWorker *wfakes.FakeWorker BeforeEach(func() { satisfyingWorker = new(wfakes.FakeWorker) workerClient.SatisfyingReturns(satisfyingWorker, nil) satisfyingWorker.CreateContainerReturns(fakeContainer, nil) }) Context("when the worker supports volume management", func() { var fakeBaggageclaimClient *bfakes.FakeClient BeforeEach(func() { fakeBaggageclaimClient = new(bfakes.FakeClient) satisfyingWorker.VolumeManagerReturns(fakeBaggageclaimClient, true) })
wfakes "github.com/concourse/atc/worker/fakes" bcfakes "github.com/concourse/baggageclaim/fakes" ) var _ = Describe("Baggage-collecting image resource volumes created by one-off builds", func() { var ( fakeWorkerClient *wfakes.FakeClient worker1 *wfakes.FakeWorker worker2 *wfakes.FakeWorker baggageClaimClient2 *bcfakes.FakeClient volume2 *bcfakes.FakeVolume fakeBaggageCollectorDB *fakes.FakeBaggageCollectorDB fakePipelineDBFactory *dbfakes.FakePipelineDBFactory expectedOldVersionTTL = 4 * time.Minute expectedLatestVersionTTL = time.Duration(0) expectedOneOffTTL = 5 * time.Hour baggageCollector lostandfound.BaggageCollector savedPipeline db.SavedPipeline fakePipelineDB *dbfakes.FakePipelineDB ) BeforeEach(func() { fakeWorkerClient = new(wfakes.FakeClient) worker1 = new(wfakes.FakeWorker)
{ Name: "some-resource-type", Type: "some-underlying-type", Source: atc.Source{"some": "source"}, }, } }) JustBeforeEach(func() { satisfyingWorker, satisfyingErr = pool.Satisfying(spec, resourceTypes) }) Context("with multiple workers", func() { var ( workerA *fakes.FakeWorker workerB *fakes.FakeWorker workerC *fakes.FakeWorker ) BeforeEach(func() { workerA = new(fakes.FakeWorker) workerB = new(fakes.FakeWorker) workerC = new(fakes.FakeWorker) workerA.SatisfyingReturns(workerA, nil) workerB.SatisfyingReturns(workerB, nil) workerC.SatisfyingReturns(nil, errors.New("nope")) fakeProvider.WorkersReturns([]Worker{workerA, workerB, workerC}, nil) })
) BeforeEach(func() { id = Identifier{Name: "some-name"} spec = ResourceTypeContainerSpec{Type: "some-type"} }) JustBeforeEach(func() { createdContainer, createErr = pool.CreateContainer(id, spec) }) Context("with multiple workers", func() { var ( workerA *fakes.FakeWorker workerB *fakes.FakeWorker workerC *fakes.FakeWorker fakeContainer *fakes.FakeContainer ) BeforeEach(func() { workerA = new(fakes.FakeWorker) workerB = new(fakes.FakeWorker) workerC = new(fakes.FakeWorker) workerA.ActiveContainersReturns(3) workerB.ActiveContainersReturns(2) workerA.SatisfiesReturns(true) workerB.SatisfiesReturns(true)
"github.com/concourse/atc/lostandfound/fakes" "github.com/concourse/atc/worker" wfakes "github.com/concourse/atc/worker/fakes" "github.com/concourse/baggageclaim" bcfakes "github.com/concourse/baggageclaim/fakes" ) var _ = Describe("Baggage Collector", func() { var ( fakeWorkerClient *wfakes.FakeClient fakeWorker *wfakes.FakeWorker fakeBaggageClaimClient *bcfakes.FakeClient fakeBaggageCollectorDB *fakes.FakeBaggageCollectorDB fakePipelineDBFactory *dbfakes.FakePipelineDBFactory expectedOldResourceGracePeriod = 4 * time.Minute expectedLatestVersionTTL = time.Duration(0) expectedOneOffTTL = 5 * time.Hour baggageCollector lostandfound.BaggageCollector ) type resourceConfigAndVersions struct { config atc.ResourceConfig versions []atc.Version versionsToDisable []int } type baggageCollectionExample struct { pipelineData map[string][]resourceConfigAndVersions
wfakes "github.com/concourse/atc/worker/fakes" bcfakes "github.com/concourse/baggageclaim/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Volumes are reaped", func() { var ( fakeWorkerClient *wfakes.FakeClient fakeWorker *wfakes.FakeWorker fakeBaggageClaimClient *bcfakes.FakeClient fakePipelineDBFactory *dbfakes.FakePipelineDBFactory fakeBaggageCollectorDB *fakes.FakeBaggageCollectorDB expectedOldResourceGracePeriod = 4 * time.Minute expectedOneOffTTL = 5 * time.Hour baggageCollector lostandfound.BaggageCollector returnedSavedVolume db.SavedVolume newestReturnedSavedVolume db.SavedVolume returnedVolumes []db.SavedVolume ) BeforeEach(func() { fakeWorkerClient = new(wfakes.FakeClient) fakeWorker = new(wfakes.FakeWorker) fakeBaggageClaimClient = new(bcfakes.FakeClient) baggageCollectorLogger := lagertest.NewTestLogger("test") fakeBaggageCollectorDB = new(fakes.FakeBaggageCollectorDB) fakePipelineDBFactory = new(dbfakes.FakePipelineDBFactory)