Args: []string{"some", "args"}, }, } configSource.FetchConfigReturns(fetchedConfig, nil) }) Context("when creating the task's container works", func() { var ( fakeContainer *wfakes.FakeContainer fakeProcess *gfakes.FakeProcess ) BeforeEach(func() { fakeContainer = new(wfakes.FakeContainer) fakeContainer.HandleReturns("some-handle") fakeWorkerClient.CreateContainerReturns(fakeContainer, nil) fakeProcess = new(gfakes.FakeProcess) fakeProcess.IDReturns(42) fakeContainer.RunReturns(fakeProcess, nil) fakeContainer.StreamInReturns(nil) }) Describe("before having created the container", func() { BeforeEach(func() { taskDelegate.InitializingStub = func(atc.TaskConfig) { defer GinkgoRecover() Ω(fakeWorkerClient.CreateContainerCallCount()).Should(BeZero()) }
var ( workerA *fakes.FakeWorker workerB *fakes.FakeWorker fakeContainer *fakes.FakeContainer ) BeforeEach(func() { workerA = new(fakes.FakeWorker) workerB = new(fakes.FakeWorker) workerA.ActiveContainersReturns(3) workerB.ActiveContainersReturns(2) fakeContainer = new(fakes.FakeContainer) fakeContainer.HandleReturns("fake-container") fakeProvider.WorkersReturns([]Worker{workerA, workerB}, nil) }) Context("when a worker can locate the container", func() { BeforeEach(func() { workerA.LookupContainerReturns(fakeContainer, nil) workerB.LookupContainerReturns(nil, ErrContainerNotFound) }) It("returns the container", func() { Ω(foundContainer).Should(Equal(fakeContainer)) }) It("looks up by the given identifier", func() {