Esempio n. 1
0
				})

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

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

					It("immediately resumes the build", func() {
						Eventually(createdBuild.ResumeCallCount).Should(Equal(1))
					})

					It("scans for new versions for each input, and queries for the latest job inputs", func() {
						Ω(fakeScanner.ScanCallCount()).Should(Equal(2))

						_, resourceName := fakeScanner.ScanArgsForCall(0)
						Ω(resourceName).Should(Equal("some-resource"))

						_, resourceName = fakeScanner.ScanArgsForCall(1)
						Ω(resourceName).Should(Equal("some-other-resource"))

						Ω(fakePipelineDB.GetLatestInputVersionsCallCount()).Should(Equal(1))
						jobName, inputConfigs := fakePipelineDB.GetLatestInputVersionsArgsForCall(0)
						Ω(jobName).Should(Equal(job.Name))
						Ω(inputConfigs).Should(Equal([]atc.JobInput{
							{
								Name:     "some-input",
								Resource: "some-resource",
								Trigger:  true,
Esempio n. 2
0
						fakeEngine.CreateBuildReturns(createdBuild, nil)
					})

					It("immediately resumes the build", func() {
						Eventually(createdBuild.ResumeCallCount).Should(Equal(1))
					})

					It("breaks the scheduling lease", func() {
						leasedBuildID, interval := fakeBuildsDB.LeaseBuildSchedulingArgsForCall(0)
						Expect(leasedBuildID).To(Equal(128))
						Expect(interval).To(Equal(10 * time.Second))
						Expect(lease.BreakCallCount()).To(Equal(1))
					})

					It("does not scan for new versions, and queries for the latest job inputs using the given versions dataset", func() {
						Expect(fakeScanner.ScanCallCount()).To(Equal(0))

						Expect(fakePipelineDB.GetLatestInputVersionsCallCount()).To(Equal(1))
						versions, jobName, inputConfigs := fakePipelineDB.GetLatestInputVersionsArgsForCall(0)
						Expect(versions).To(Equal(someVersions))
						Expect(jobName).To(Equal(job.Name))
						Expect(inputConfigs).To(Equal([]config.JobInput{
							{
								Name:     "some-input",
								Resource: "some-resource",
								Trigger:  true,
								Params:   atc.Params{"some": "params"},
							},
							{
								Name:     "some-other-input",
								Resource: "some-other-resource",