예제 #1
0
파일: scheduler_test.go 프로젝트: utako/atc
					Ω(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"))
				})

				It("creates a build with the found inputs", func() {
					err := scheduler.BuildLatestInputs(logger, job, resources)
					Ω(err).ShouldNot(HaveOccurred())

					Ω(fakePipelineDB.CreateJobBuildForCandidateInputsCallCount()).Should(Equal(1))
					buildJob := fakePipelineDB.CreateJobBuildForCandidateInputsArgsForCall(0)
					Ω(buildJob).Should(Equal("some-job"))
				})

				Context("when creating the build succeeds", func() {
					BeforeEach(func() {
						fakePipelineDB.CreateJobBuildForCandidateInputsReturns(
							db.Build{
								ID:   128,
								Name: "42",
							},
							true,
							nil,
						)

						fakePipelineDB.GetNextPendingBuildReturns(