}, atc.Plan{ Location: &atc.Location{ Hook: "success", }, Task: &atc.TaskPlan{ Name: "some-success-task-3", Config: &atc.TaskConfig{}, }, }, }, }, }, } build, err := execEngine.CreateBuild(logger, buildModel, plan) Expect(err).NotTo(HaveOccurred()) build.Resume(logger) }) It("constructs the steps correctly", func() { Expect(fakeFactory.TaskCallCount()).To(Equal(3)) logger, sourceName, workerID, delegate, _, _, _ := fakeFactory.TaskArgsForCall(0) Expect(logger).NotTo(BeNil()) Expect(sourceName).To(Equal(exec.SourceName("some-success-task-1"))) Expect(workerID).To(Equal(worker.Identifier{ BuildID: 84, Type: db.ContainerTypeTask, Name: "some-success-task-1", }))
fakeDelegate = new(fakes.FakeBuildDelegate) fakeDelegateFactory.DelegateReturns(fakeDelegate) fakeGetDelegate = new(execfakes.FakeGetDelegate) fakeDelegate.InputDelegateReturns(fakeGetDelegate) plan = atc.Plan{ Location: nil, Get: &atc.GetPlan{ Name: "some input", }, } }) It("constructs the step correctly", func() { build, err := execEngine.CreateBuild(buildModel, plan) Ω(err).ShouldNot(HaveOccurred()) build.Resume(logger) Ω(fakeFactory.GetCallCount()).Should(Equal(1)) sourceName, workerID, delegate, _, _, _, _ := fakeFactory.GetArgsForCall(0) Ω(sourceName).Should(Equal(exec.SourceName("some input"))) Ω(workerID).Should(Equal(worker.Identifier{ BuildID: 84, Type: worker.ContainerTypeGet, Name: "some input", })) Ω(delegate).Should(Equal(fakeGetDelegate)) _, _, location := fakeDelegate.InputDelegateArgsForCall(0) Ω(location).ShouldNot(BeNil())
build, err = execEngine.CreateBuild(buildModel, atc.Plan{ Compose: &atc.ComposePlan{ A: atc.Plan{ Aggregate: &atc.AggregatePlan{ atc.Plan{ Get: inputPlan, }, }, }, B: atc.Plan{ Conditional: &atc.ConditionalPlan{ Conditions: atc.Conditions{atc.ConditionSuccess}, Plan: atc.Plan{ Compose: &atc.ComposePlan{ A: atc.Plan{ Task: &atc.TaskPlan{ Name: "some-task", Privileged: privileged, Config: taskConfig, ConfigPath: taskConfigPath, }, }, B: atc.Plan{ Aggregate: &atc.AggregatePlan{ atc.Plan{ Conditional: outputPlan, }, }, }, }, }, }, }, }, })
Aggregate: &atc.AggregatePlan{ atc.Plan{ Location: &atc.Location{}, Conditional: outputPlan, }, }, }, }, }, }, }, }, } var err error build, err = execEngine.CreateBuild(buildModel, input) Ω(err).ShouldNot(HaveOccurred()) build.Resume(logger) }) Describe("with a putget in an aggregate", func() { BeforeEach(func() { outputPlan = &atc.ConditionalPlan{ Conditions: atc.Conditions{atc.ConditionSuccess}, Plan: atc.Plan{ Location: &atc.Location{}, Aggregate: &atc.AggregatePlan{ atc.Plan{ Location: &atc.Location{}, Conditional: &atc.ConditionalPlan{
outputPlan = planFactory.NewPlan(atc.AggregatePlan{ planFactory.NewPlan(atc.OnSuccessPlan{ Step: putPlan, Next: dependentGetPlan, }), planFactory.NewPlan(atc.OnSuccessPlan{ Step: otherPutPlan, Next: otherDependentGetPlan, }), }) }) Context("constructing outputs", func() { It("constructs the put correctly", func() { var err error build, err = execEngine.CreateBuild(logger, buildModel, outputPlan) Expect(err).NotTo(HaveOccurred()) build.Resume(logger) Expect(fakeFactory.PutCallCount()).To(Equal(2)) logger, metadata, workerID, workerMetadata, delegate, resourceConfig, tags, params, _ := fakeFactory.PutArgsForCall(0) Expect(logger).NotTo(BeNil()) Expect(metadata).To(Equal(expectedMetadata)) Expect(workerMetadata).To(Equal(worker.Metadata{ ResourceName: "", Type: db.ContainerTypePut, StepName: "some-put", PipelineName: "some-pipeline", })) Expect(workerID).To(Equal(worker.Identifier{