Ω(fakeWorkerClient.CreateContainerCallCount()).Should(BeZero()) } }) It("invokes the delegate's Initializing callback", func() { Ω(taskDelegate.InitializingCallCount()).Should(Equal(1)) Ω(taskDelegate.InitializingArgsForCall(0)).Should(Equal(fetchedConfig)) }) }) It("looked up the container via the session ID", func() { Ω(fakeWorkerClient.LookupContainerArgsForCall(0)).Should(Equal(identifier)) }) It("gets the config from the input artifact soruce", func() { Ω(configSource.FetchConfigCallCount()).Should(Equal(1)) Ω(configSource.FetchConfigArgsForCall(0)).Should(Equal(repo)) }) It("creates a container with the config's image and the session ID as the handle", func() { Ω(fakeWorkerClient.CreateContainerCallCount()).Should(Equal(1)) createdIdentifier, spec := fakeWorkerClient.CreateContainerArgsForCall(0) Ω(createdIdentifier).Should(Equal(identifier)) taskSpec := spec.(worker.TaskContainerSpec) Ω(taskSpec.Platform).Should(Equal("some-platform")) Ω(taskSpec.Tags).Should(ConsistOf("config", "step", "tags")) Ω(taskSpec.Image).Should(Equal("some-image")) Ω(taskSpec.Privileged).Should(BeFalse()) })
Context("and fetching via B fails", func() { disaster := errors.New("nope") BeforeEach(func() { fakeConfigSourceB.FetchConfigReturns(atc.TaskConfig{}, disaster) }) It("returns the error", func() { Ω(fetchErr).Should(Equal(disaster)) }) }) }) Context("when fetching via A fails", func() { disaster := errors.New("nope") BeforeEach(func() { fakeConfigSourceA.FetchConfigReturns(atc.TaskConfig{}, disaster) }) It("returns the error", func() { Ω(fetchErr).Should(Equal(disaster)) }) It("does not fetch via B", func() { Ω(fakeConfigSourceB.FetchConfigCallCount()).Should(Equal(0)) }) }) }) })
Context("and fetching via B fails", func() { disaster := errors.New("nope") BeforeEach(func() { fakeConfigSourceB.FetchConfigReturns(atc.TaskConfig{}, disaster) }) It("returns the error", func() { Expect(fetchErr).To(Equal(disaster)) }) }) }) Context("when fetching via A fails", func() { disaster := errors.New("nope") BeforeEach(func() { fakeConfigSourceA.FetchConfigReturns(atc.TaskConfig{}, disaster) }) It("returns the error", func() { Expect(fetchErr).To(Equal(disaster)) }) It("does not fetch via B", func() { Expect(fakeConfigSourceB.FetchConfigCallCount()).To(Equal(0)) }) }) }) })