コード例 #1
0
ファイル: scheduler_test.go プロジェクト: utako/atc
			It("does not start a build", func() {
				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)
				})
コード例 #2
0
ファイル: scheduler_test.go プロジェクト: pcfdev-forks/atc
				Inputs: map[string]db.BuildPreparationStatus{},
			}

			fakeBuildsDB.GetBuildPreparationReturns(buildPrep, true, nil)
			fakePipelineDB.CreateJobBuildReturns(dbBuild, nil)
			fakePipelineDB.GetNextPendingBuildBySerialGroupReturns(dbBuild, true, nil)
			fakePipelineDB.UpdateBuildToScheduledReturns(true, nil)
		})

		It("creates a build without any specific inputs", func() {
			_, wg, err := scheduler.TriggerImmediately(logger, job, resources, resourceTypes)
			Expect(err).NotTo(HaveOccurred())

			wg.Wait()

			Expect(fakePipelineDB.CreateJobBuildCallCount()).To(Equal(1))

			jobName := fakePipelineDB.CreateJobBuildArgsForCall(0)
			Expect(jobName).To(Equal("some-job"))

			Expect(fakePipelineDB.LoadVersionsDBCallCount()).To(Equal(1))
		})

		Context("when creating the build fails", func() {
			disaster := errors.New("oh no!")

			BeforeEach(func() {
				fakePipelineDB.CreateJobBuildReturns(db.Build{}, disaster)
			})

			It("returns the error", func() {