Esempio n. 1
0
			})

			Context("loading versions db", func() {
				BeforeEach(func() {
					pendingBuild := db.Build{
						Status: db.StatusPending,
					}
					buildPrep := db.BuildPreparation{
						Inputs: map[string]db.BuildPreparationStatus{},
					}

					fakeBuildsDB.GetBuildPreparationReturns(buildPrep, true, nil)
					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{