Exemple #1
0
			fakeBuildDB.StartBuildReturns(true, nil)
		})

		JustBeforeEach(func() {
			createdBuild, buildErr = dbEngine.CreateBuild(build, plan)
		})

		Context("when creating the build succeeds", func() {
			var fakeBuild *fakes.FakeBuild

			BeforeEach(func() {
				fakeBuild = new(fakes.FakeBuild)
				fakeBuild.MetadataReturns("some-metadata")

				fakeEngineA.CreateBuildReturns(fakeBuild, nil)
			})

			It("succeeds", func() {
				Ω(buildErr).ShouldNot(HaveOccurred())
			})

			It("returns a build", func() {
				Ω(createdBuild).ShouldNot(BeNil())
			})

			It("starts the build in the database", func() {
				Ω(fakeBuildDB.StartBuildCallCount()).Should(Equal(1))

				buildID, engine, metadata := fakeBuildDB.StartBuildArgsForCall(0)
				Ω(buildID).Should(Equal(128))
Exemple #2
0
							},
							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

							BeforeEach(func() {
								createdBuild = new(enginefakes.FakeBuild)
								fakeEngine.CreateBuildReturns(createdBuild, nil)
							})

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

								Ω(fakePipelineDB.ScheduleBuildCallCount()).Should(Equal(1))
								scheduledBuildID, jobConfig := fakePipelineDB.ScheduleBuildArgsForCall(0)
								Ω(scheduledBuildID).Should(Equal(128))
								Ω(jobConfig).Should(Equal(job))

								Ω(factory.CreateCallCount()).Should(Equal(1))
								createJob, createResources, createInputs := factory.CreateArgsForCall(0)
								Ω(createJob).Should(Equal(job))
								Ω(createResources).Should(Equal(resources))
Exemple #3
0
									Expect(logger).To(gbytes.Say("failed-to-mark-build-as-errored"))
								})
							})
						})

						Context("when the plan is created", func() {
							var plan atc.Plan
							var fakeEngineBuild *enginefakes.FakeBuild

							BeforeEach(func() {
								plan = atc.Plan{}
								factory.CreateReturns(plan, nil)

								fakeEngineBuild = new(enginefakes.FakeBuild)

								fakeEngine.CreateBuildReturns(fakeEngineBuild, nil)
							})

							It("tells the engine to create the build", func() {
								Expect(fakeEngine.CreateBuildCallCount()).To(Equal(1))

								_, passedBuild, passedPlan := fakeEngine.CreateBuildArgsForCall(0)
								Expect(passedBuild).To(Equal(build))
								Expect(passedPlan).To(Equal(plan))
							})

							It("returns back created build", func() {
								Expect(engineBuild).To(Equal(fakeEngineBuild))
							})

							It("calls Resume() on the created build", func() {