示例#1
0
					fakePipelineDB.CreateJobBuildForCandidateInputsReturns(pendingBuild, true, nil)
					fakePipelineDB.GetNextPendingBuildReturns(pendingBuild, true, nil)
					fakePipelineDB.GetNextPendingBuildBySerialGroupReturns(pendingBuild, true, nil)
					fakePipelineDB.UpdateBuildToScheduledReturns(true, nil)
				})

				It("does not happen", func() {
					Expect(fakePipelineDB.LoadVersionsDBCallCount()).To(Equal(0))
				})
			})

			It("checks if they are already used for a build", func() {
				Expect(err).NotTo(HaveOccurred())

				Expect(fakePipelineDB.GetLatestInputVersionsCallCount()).To(Equal(1))
				versions, jobName, inputs := fakePipelineDB.GetLatestInputVersionsArgsForCall(0)
				Expect(versions).To(Equal(someVersions))
				Expect(jobName).To(Equal(job.Name))
				Expect(inputs).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",
						Trigger:  true,
						Params:   atc.Params{"some": "other-params"},
					},
示例#2
0
					VersionedResource: db.VersionedResource{
						Resource: "some-other-resource", Version: db.Version{"version": "2"},
					},
				},
			}

			BeforeEach(func() {
				fakePipelineDB.GetLatestInputVersionsReturns(newInputs, nil)
			})

			It("checks if they are already used for a build", func() {
				err := scheduler.BuildLatestInputs(logger, job, resources)
				Ω(err).ShouldNot(HaveOccurred())

				Ω(fakePipelineDB.GetLatestInputVersionsCallCount()).Should(Equal(1))
				jobName, inputs := fakePipelineDB.GetLatestInputVersionsArgsForCall(0)
				Ω(jobName).Should(Equal(job.Name))
				Ω(inputs).Should(Equal([]atc.JobInput{
					{
						Name:     "some-input",
						Resource: "some-resource",
						Trigger:  true,
					},
					{
						Name:     "some-other-input",
						Resource: "some-other-resource",
						Trigger:  true,
					},
				}))

				Ω(fakePipelineDB.GetJobBuildForInputsCallCount()).Should(Equal(1))
示例#3
0
					VersionedResource: db.VersionedResource{
						Resource: "some-other-resource", Version: db.Version{"version": "2"},
					},
				},
			}

			BeforeEach(func() {
				fakePipelineDB.GetLatestInputVersionsReturns(newInputs, nil)
			})

			It("checks if they are already used for a build", func() {
				err := scheduler.BuildLatestInputs(logger, job, resources)
				Ω(err).ShouldNot(HaveOccurred())

				Ω(fakePipelineDB.GetLatestInputVersionsCallCount()).Should(Equal(1))
				Ω(fakePipelineDB.GetLatestInputVersionsArgsForCall(0)).Should(Equal([]atc.JobInput{
					{
						Name:     "some-input",
						Resource: "some-resource",
						Trigger:  true,
					},
					{
						Name:     "some-other-input",
						Resource: "some-other-resource",
						Trigger:  true,
					},
				}))

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

				checkedJob, checkedInputs := fakePipelineDB.GetJobBuildForInputsArgsForCall(0)