예제 #1
0
파일: scheduler_test.go 프로젝트: utako/atc
				scheduler.TryNextPendingBuild(logger, job, resources)
				Ω(fakeEngine.CreateBuildCallCount()).Should(Equal(0))
			})
		})
	})

	Describe("TriggerImmediately", func() {
		It("creates a build without any specific inputs", func() {
			_, err := scheduler.TriggerImmediately(logger, job, resources)
			Ω(err).ShouldNot(HaveOccurred())

			Ω(fakePipelineDB.GetLatestInputVersionsCallCount()).Should(Equal(0))

			Ω(fakePipelineDB.CreateJobBuildCallCount()).Should(Equal(1))

			jobName := fakePipelineDB.CreateJobBuildArgsForCall(0)
			Ω(jobName).Should(Equal("some-job"))
		})

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

			Context("and it can be scheduled", func() {
				BeforeEach(func() {
					fakePipelineDB.ScheduleBuildReturns(true, nil)
				})

				Context("and creating the engine build succeeds", func() {
					var createdBuild *enginefakes.FakeBuild