} }) 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()) })
BeforeEach(func() { fakeConfigSourceA.FetchConfigReturns(configA, nil) }) Context("and fetching via B succeeds", func() { var configB = atc.TaskConfig{ Params: map[string]string{"PARAM": "B"}, } BeforeEach(func() { fakeConfigSourceB.FetchConfigReturns(configB, nil) }) It("fetches via the input source", func() { Ω(fakeConfigSourceA.FetchConfigArgsForCall(0)).Should(Equal(repo)) Ω(fakeConfigSourceB.FetchConfigArgsForCall(0)).Should(Equal(repo)) }) It("succeeds", func() { Ω(fetchErr).ShouldNot(HaveOccurred()) }) It("returns the merged config", func() { Ω(fetchedConfig).Should(Equal(atc.TaskConfig{ Image: "some-image", Params: map[string]string{"PARAM": "B"}, })) }) })
BeforeEach(func() { fakeConfigSourceA.FetchConfigReturns(configA, nil) }) Context("and fetching via B succeeds", func() { var configB = atc.TaskConfig{ Params: map[string]string{"PARAM": "B"}, } BeforeEach(func() { fakeConfigSourceB.FetchConfigReturns(configB, nil) }) It("fetches via the input source", func() { Expect(fakeConfigSourceA.FetchConfigArgsForCall(0)).To(Equal(repo)) Expect(fakeConfigSourceB.FetchConfigArgsForCall(0)).To(Equal(repo)) }) It("succeeds", func() { Expect(fetchErr).NotTo(HaveOccurred()) }) It("returns the merged config", func() { Expect(fetchedConfig).To(Equal(atc.TaskConfig{ Image: "some-image", Params: map[string]string{"PARAM": "B"}, })) }) })