示例#1
0
			It("starts the build in the database", func() {
				Ω(fakeBuildDB.StartBuildCallCount()).Should(Equal(1))

				buildID, engine, metadata := fakeBuildDB.StartBuildArgsForCall(0)
				Ω(buildID).Should(Equal(128))
				Ω(engine).Should(Equal("fake-engine-a"))
				Ω(metadata).Should(Equal("some-metadata"))
			})

			Context("when the build fails to transition to started", func() {
				BeforeEach(func() {
					fakeBuildDB.StartBuildReturns(false, nil)
				})

				It("aborts the build", func() {
					Ω(fakeBuild.AbortCallCount()).Should(Equal(1))
				})
			})
		})

		Context("when creating the build fails", func() {
			disaster := errors.New("failed")

			BeforeEach(func() {
				fakeEngineA.CreateBuildReturns(nil, disaster)
			})

			It("returns the error", func() {
				Ω(buildErr).Should(Equal(disaster))
			})
示例#2
0
文件: builds_test.go 项目: ACPK/atc
					buildsDB.GetBuildReturns(db.Build{
						ID:     128,
						Status: db.StatusStarted,
					}, true, nil)
				})

				Context("when the engine returns a build", func() {
					var fakeBuild *enginefakes.FakeBuild

					BeforeEach(func() {
						fakeBuild = new(enginefakes.FakeBuild)
						fakeEngine.LookupBuildReturns(fakeBuild, nil)
					})

					It("aborts the build", func() {
						Expect(fakeBuild.AbortCallCount()).To(Equal(1))
					})

					Context("when aborting succeeds", func() {
						BeforeEach(func() {
							fakeBuild.AbortReturns(nil)
						})

						It("returns 204", func() {
							Expect(response.StatusCode).To(Equal(http.StatusNoContent))
						})
					})

					Context("when aborting fails", func() {
						BeforeEach(func() {
							fakeBuild.AbortReturns(errors.New("oh no!"))
示例#3
0
			It("starts the build in the database", func() {
				Expect(fakeBuildDB.StartBuildCallCount()).To(Equal(1))

				buildID, engine, metadata := fakeBuildDB.StartBuildArgsForCall(0)
				Expect(buildID).To(Equal(128))
				Expect(engine).To(Equal("fake-engine-a"))
				Expect(metadata).To(Equal("some-metadata"))
			})

			Context("when the build fails to transition to started", func() {
				BeforeEach(func() {
					fakeBuildDB.StartBuildReturns(false, nil)
				})

				It("aborts the build", func() {
					Expect(fakeBuild.AbortCallCount()).To(Equal(1))
				})
			})
		})

		Context("when creating the build fails", func() {
			disaster := errors.New("failed")

			BeforeEach(func() {
				fakeEngineA.CreateBuildReturns(nil, disaster)
			})

			It("returns the error", func() {
				Expect(buildErr).To(Equal(disaster))
			})
示例#4
0
文件: builds_test.go 项目: savaki/atc
		Context("when authenticated", func() {
			BeforeEach(func() {
				authValidator.IsAuthenticatedReturns(true)
			})

			Context("and the engine returns a build", func() {
				var fakeBuild *enginefakes.FakeBuild

				BeforeEach(func() {
					fakeBuild = new(enginefakes.FakeBuild)
					fakeEngine.LookupBuildReturns(fakeBuild, nil)
				})

				It("aborts the build", func() {
					Ω(fakeBuild.AbortCallCount()).Should(Equal(1))
				})

				Context("and aborting succeeds", func() {
					BeforeEach(func() {
						fakeBuild.AbortReturns(nil)
					})

					It("returns 204", func() {
						Ω(response.StatusCode).Should(Equal(http.StatusNoContent))
					})
				})

				Context("and aborting fails", func() {
					BeforeEach(func() {
						fakeBuild.AbortReturns(errors.New("oh no!"))