job.InputConfigs[i] = noChecking } }) It("does not check for builds for the inputs", func() { err := scheduler.BuildLatestInputs(logger, job, resources) Ω(err).ShouldNot(HaveOccurred()) Ω(fakePipelineDB.GetJobBuildForInputsCallCount()).Should(Equal(0)) }) It("does not create a build", func() { err := scheduler.BuildLatestInputs(logger, job, resources) Ω(err).ShouldNot(HaveOccurred()) Ω(fakePipelineDB.CreateJobBuildForCandidateInputsCallCount()).Should(Equal(0)) }) It("does not trigger a build", func() { err := scheduler.BuildLatestInputs(logger, job, resources) Ω(err).ShouldNot(HaveOccurred()) Ω(fakeEngine.CreateBuildCallCount()).Should(Equal(0)) }) }) Context("and they are not used for a build", func() { BeforeEach(func() { fakePipelineDB.GetJobBuildForInputsReturns(db.Build{}, errors.New("no build")) })
for i, c := range job.Plan { noTrigger := c noTrigger.Trigger = false job.Plan[i] = noTrigger } }) It("does not check for builds for the inputs", func() { Expect(err).NotTo(HaveOccurred()) Expect(fakePipelineDB.GetJobBuildForInputsCallCount()).To(Equal(0)) }) It("does not create a build", func() { Expect(err).NotTo(HaveOccurred()) Expect(fakePipelineDB.CreateJobBuildForCandidateInputsCallCount()).To(Equal(0)) }) It("does not trigger a build", func() { Expect(err).NotTo(HaveOccurred()) Expect(fakeEngine.CreateBuildCallCount()).To(Equal(0)) }) }) Context("when latest inputs are not already used for a build", func() { BeforeEach(func() { fakePipelineDB.GetJobBuildForInputsReturns(db.Build{}, false, nil) }) It("creates a build with the found inputs", func() { Expect(err).NotTo(HaveOccurred())