Beispiel #1
0
							fakeJobService.CanBuildBeScheduledReturns(nil, false, "failed-to-scan", problemz)
						})

						It("logs and returns nil", func() {
							Expect(engineBuild).To(BeNil())
							Expect(logger).To(gbytes.Say("failed-to-schedule-build"))

							Expect(fakeBuildsDB.ErrorBuildCallCount()).To(Equal(1))
							buildID, scanningError := fakeBuildsDB.ErrorBuildArgsForCall(0)
							Expect(buildID).To(Equal(build.ID))
							Expect(scanningError).To(Equal(problemz))
						})

						Context("when ErrorBuild errors", func() {
							BeforeEach(func() {
								fakeBuildsDB.ErrorBuildReturns(errors.New("freak out!?"))
							})

							It("logs and returns nil", func() {
								Expect(engineBuild).To(BeNil())
								Expect(logger).To(gbytes.Say("failed-to-schedule-build"))
								Expect(logger).To(gbytes.Say("failed-to-mark-build-as-errored"))
							})
						})
					})
				})
			})

			Context("when build prep cannot be acquired", func() {
				BeforeEach(func() {
					fakeBuildsDB.GetBuildPreparationReturns(db.BuildPreparation{}, false, nil)