예제 #1
0
파일: db_engine_test.go 프로젝트: utako/atc
						fakeBuildDB.GetBuildReturns(model, nil)
					})

					It("does not look up the build in the engine", func() {
						Ω(fakeEngineB.LookupBuildCallCount()).Should(BeZero())
					})

					It("releases the lock", func() {
						Ω(fakeLock.ReleaseCallCount()).Should(Equal(1))
					})
				})

				Context("when the build has already finished", func() {
					BeforeEach(func() {
						model.Engine = "fake-engine-b"
						model.Status = db.StatusSucceeded
						fakeBuildDB.GetBuildReturns(model, nil)
					})

					It("does not look up the build in the engine", func() {
						Ω(fakeEngineB.LookupBuildCallCount()).Should(BeZero())
					})

					It("releases the lock", func() {
						Ω(fakeLock.ReleaseCallCount()).Should(Equal(1))
					})
				})
			})

			Context("when acquiring the lock fails", func() {
				BeforeEach(func() {
예제 #2
0
				Context("when the job is not paused", func() {
					JustBeforeEach(func() {
						dbSavedJob.Paused = false
					})

					It("marks the build prep paused job to not blocking", func() {
						Expect(err).NotTo(HaveOccurred())

						Expect(fakeDB.UpdateBuildPreparationCallCount()).To(BeNumerically(">=", 2))
						buildPrep = fakeDB.UpdateBuildPreparationArgsForCall(1)
						Expect(buildPrep.PausedJob).To(Equal(db.BuildPreparationStatusNotBlocking))
					})

					Context("when the build status is NOT pending", func() {
						BeforeEach(func() {
							dbBuild.Status = db.StatusStarted
						})

						It("returns false", func() {
							Expect(err).NotTo(HaveOccurred())
							Expect(reason).To(Equal("build-not-pending"))
							Expect(canBuildBeScheduled).To(BeFalse())
						})
					})

					Context("when the build status is pending", func() {
						BeforeEach(func() {
							dbBuild.Status = db.StatusPending
						})

						Context("when passed a versions db", func() {