当前位置: 首页>>代码示例>>Golang>>正文


Golang FakeEngine.CreateBuildReturns方法代码示例

本文整理汇总了Golang中github.com/concourse/atc/engine/fakes.FakeEngine.CreateBuildReturns方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeEngine.CreateBuildReturns方法的具体用法?Golang FakeEngine.CreateBuildReturns怎么用?Golang FakeEngine.CreateBuildReturns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/concourse/atc/engine/fakes.FakeEngine的用法示例。


在下文中一共展示了FakeEngine.CreateBuildReturns方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

			fakeBuildDB.StartBuildReturns(true, nil)
		})

		JustBeforeEach(func() {
			createdBuild, buildErr = dbEngine.CreateBuild(build, plan)
		})

		Context("when creating the build succeeds", func() {
			var fakeBuild *fakes.FakeBuild

			BeforeEach(func() {
				fakeBuild = new(fakes.FakeBuild)
				fakeBuild.MetadataReturns("some-metadata")

				fakeEngineA.CreateBuildReturns(fakeBuild, nil)
			})

			It("succeeds", func() {
				Ω(buildErr).ShouldNot(HaveOccurred())
			})

			It("returns a build", func() {
				Ω(createdBuild).ShouldNot(BeNil())
			})

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

				buildID, engine, metadata := fakeBuildDB.StartBuildArgsForCall(0)
				Ω(buildID).Should(Equal(128))
开发者ID:utako,项目名称:atc,代码行数:30,代码来源:db_engine_test.go

示例2:

							},
							nil,
						)
					})

					Context("and it can be scheduled", func() {
						BeforeEach(func() {
							fakePipelineDB.ScheduleBuildReturns(true, nil)
						})

						Context("and creating the engine build succeeds", func() {
							var createdBuild *enginefakes.FakeBuild

							BeforeEach(func() {
								createdBuild = new(enginefakes.FakeBuild)
								fakeEngine.CreateBuildReturns(createdBuild, nil)
							})

							It("triggers a build of the job with the found inputs", func() {
								err := scheduler.BuildLatestInputs(logger, job, resources)
								Ω(err).ShouldNot(HaveOccurred())

								Ω(fakePipelineDB.ScheduleBuildCallCount()).Should(Equal(1))
								scheduledBuildID, jobConfig := fakePipelineDB.ScheduleBuildArgsForCall(0)
								Ω(scheduledBuildID).Should(Equal(128))
								Ω(jobConfig).Should(Equal(job))

								Ω(factory.CreateCallCount()).Should(Equal(1))
								createJob, createResources, createInputs := factory.CreateArgsForCall(0)
								Ω(createJob).Should(Equal(job))
								Ω(createResources).Should(Equal(resources))
开发者ID:utako,项目名称:atc,代码行数:31,代码来源:scheduler_test.go

示例3:

									Expect(logger).To(gbytes.Say("failed-to-mark-build-as-errored"))
								})
							})
						})

						Context("when the plan is created", func() {
							var plan atc.Plan
							var fakeEngineBuild *enginefakes.FakeBuild

							BeforeEach(func() {
								plan = atc.Plan{}
								factory.CreateReturns(plan, nil)

								fakeEngineBuild = new(enginefakes.FakeBuild)

								fakeEngine.CreateBuildReturns(fakeEngineBuild, nil)
							})

							It("tells the engine to create the build", func() {
								Expect(fakeEngine.CreateBuildCallCount()).To(Equal(1))

								_, passedBuild, passedPlan := fakeEngine.CreateBuildArgsForCall(0)
								Expect(passedBuild).To(Equal(build))
								Expect(passedPlan).To(Equal(plan))
							})

							It("returns back created build", func() {
								Expect(engineBuild).To(Equal(fakeEngineBuild))
							})

							It("calls Resume() on the created build", func() {
开发者ID:pcfdev-forks,项目名称:atc,代码行数:31,代码来源:scheduler_test.go


注:本文中的github.com/concourse/atc/engine/fakes.FakeEngine.CreateBuildReturns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。