當前位置: 首頁>>代碼示例>>Golang>>正文


Golang FakeStepFactory.UsingArgsForCall方法代碼示例

本文整理匯總了Golang中github.com/concourse/atc/exec/fakes.FakeStepFactory.UsingArgsForCall方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeStepFactory.UsingArgsForCall方法的具體用法?Golang FakeStepFactory.UsingArgsForCall怎麽用?Golang FakeStepFactory.UsingArgsForCall使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/concourse/atc/exec/fakes.FakeStepFactory的用法示例。


在下文中一共展示了FakeStepFactory.UsingArgsForCall方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1:

		process := ifrit.Background(ensureStep)

		Eventually(step.RunCallCount).Should(Equal(1))
		Eventually(hook.RunCallCount).Should(Equal(1))

		Eventually(process.Wait()).Should(Receive(noError()))
	})

	It("provides the step as the previous step to the hook", func() {
		process := ifrit.Background(ensureStep)

		Eventually(step.RunCallCount).Should(Equal(1))
		Eventually(hookFactory.UsingCallCount).Should(Equal(1))

		argsPrev, argsRepo := hookFactory.UsingArgsForCall(0)
		Expect(argsPrev).To(Equal(step))
		Expect(argsRepo).To(Equal(repo))

		Eventually(process.Wait()).Should(Receive(noError()))
	})

	It("runs the ensured hook even if the step errors", func() {
		step.RunReturns(errors.New("disaster"))

		process := ifrit.Background(ensureStep)

		Eventually(step.RunCallCount).Should(Equal(1))
		Eventually(process.Wait()).Should(Receive(errorMatching(ContainSubstring("disaster"))))

		Expect(hook.RunCallCount()).To(Equal(1))
開發者ID:ACPK,項目名稱:atc,代碼行數:30,代碼來源:ensure_test.go

示例2:

		Eventually(step.RunCallCount).Should(Equal(1))
		Eventually(hook.RunCallCount).Should(Equal(1))

		Eventually(process.Wait()).Should(Receive(noError()))
	})

	It("provides the step as the previous step to the hook", func() {
		step.ResultStub = successResult(true)

		process := ifrit.Background(onSuccessStep)

		Eventually(step.RunCallCount).Should(Equal(1))
		Eventually(successFactory.UsingCallCount).Should(Equal(1))

		argsPrev, argsRepo := successFactory.UsingArgsForCall(0)
		Ω(argsPrev).Should(Equal(step))
		Ω(argsRepo).Should(Equal(repo))

		Eventually(process.Wait()).Should(Receive(noError()))
	})

	It("does not run the success hook if the step errors", func() {
		step.RunReturns(errors.New("disaster"))

		process := ifrit.Background(onSuccessStep)

		Eventually(step.RunCallCount).Should(Equal(1))
		Eventually(process.Wait()).Should(Receive(errorMatching("disaster")))
		Ω(hook.RunCallCount()).Should(Equal(0))
	})
開發者ID:utako,項目名稱:atc,代碼行數:30,代碼來源:on_success_test.go

示例3:

			It("fails", func() {
				var success Success
				Ω(step.Result(&success)).Should(BeFalse())
			})
		})
	}

	itDoesAThing := func() {
		It("succeeds", func() {
			Eventually(process.Wait()).Should(Receive(BeNil()))
		})

		It("uses the step's artifact source", func() {
			Ω(fakeStepFactory.UsingCallCount()).Should(Equal(1))

			step, repo := fakeStepFactory.UsingArgsForCall(0)
			Ω(step).Should(Equal(inStep))
			Ω(repo).Should(Equal(repo))
		})

		Describe("releasing", func() {
			It("releases the output source", func() {
				err := step.Release()
				Ω(err).ShouldNot(HaveOccurred())

				Ω(outStep.ReleaseCallCount()).Should(Equal(1))
			})

			Context("when releasing the output source fails", func() {
				disaster := errors.New("nope")
開發者ID:savaki,項目名稱:atc,代碼行數:30,代碼來源:conditional_test.go

示例4:

		Eventually(step.RunCallCount).Should(Equal(1))
		Eventually(hook.RunCallCount).Should(Equal(1))

		Eventually(process.Wait()).Should(Receive(noError()))
	})

	It("provides the step as the previous step to the hook", func() {
		step.ResultStub = successResult(false)

		process := ifrit.Background(onFailureStep)

		Eventually(step.RunCallCount).Should(Equal(1))
		Eventually(failureFactory.UsingCallCount).Should(Equal(1))

		argsPrev, argsRepo := failureFactory.UsingArgsForCall(0)
		Expect(argsPrev).To(Equal(step))
		Expect(argsRepo).To(Equal(repo))

		Eventually(process.Wait()).Should(Receive(noError()))
	})

	It("does not run the failure hook if the step errors", func() {
		step.RunReturns(errors.New("disaster"))

		process := ifrit.Background(onFailureStep)

		Eventually(step.RunCallCount).Should(Equal(1))
		Eventually(process.Wait()).Should(Receive(errorMatching("disaster")))
		Expect(hook.RunCallCount()).To(Equal(0))
	})
開發者ID:ACPK,項目名稱:atc,代碼行數:30,代碼來源:on_failure_test.go

示例5:

		outStepA = new(fakes.FakeStep)
		fakeStepA.UsingReturns(outStepA)

		outStepB = new(fakes.FakeStep)
		fakeStepB.UsingReturns(outStepB)
	})

	JustBeforeEach(func() {
		step = aggregate.Using(inStep, repo)
		process = ifrit.Invoke(step)
	})

	It("uses the input source for all steps", func() {
		Ω(fakeStepA.UsingCallCount()).Should(Equal(1))
		step, repo := fakeStepA.UsingArgsForCall(0)
		Ω(step).Should(Equal(inStep))
		Ω(repo).Should(Equal(repo))

		Ω(fakeStepB.UsingCallCount()).Should(Equal(1))
		step, repo = fakeStepB.UsingArgsForCall(0)
		Ω(step).Should(Equal(inStep))
		Ω(repo).Should(Equal(repo))
	})

	It("exits successfully", func() {
		Eventually(process.Wait()).Should(Receive(BeNil()))
	})

	Describe("executing each source", func() {
		BeforeEach(func() {
開發者ID:savaki,項目名稱:atc,代碼行數:30,代碼來源:aggregate_test.go

示例6:

				AfterEach(func() {
					close(startEnsure)
					close(finishEnsure)
				})

				Context("and the first step finishes successfully", func() {
					BeforeEach(func() {
						startStep <- nil
						finishStep <- nil
					})

					It("executes the success step", func() {
						Eventually(fakeStepFactorySuccessStep.UsingCallCount).Should(Equal(1))
						Eventually(successStep.RunCallCount).Should(Equal(1))
						step, repo = fakeStepFactorySuccessStep.UsingArgsForCall(0)
						Ω(step).Should(Equal(outStep))
						Ω(repo).Should(Equal(repo))

						Eventually(ensureStep.RunCallCount).Should(Equal(0))
					})

					Context("and the success step finishes successfully", func() {
						BeforeEach(func() {
							startSuccess <- nil
							finishSuccess <- nil
						})

						It("executes the ensure step", func() {
							Eventually(fakeStepFactoryEnsureStep.UsingCallCount).Should(Equal(1))
							Eventually(ensureStep.RunCallCount).Should(Equal(1))
開發者ID:savaki,項目名稱:atc,代碼行數:30,代碼來源:hooked_compose_step_test.go


注:本文中的github.com/concourse/atc/exec/fakes.FakeStepFactory.UsingArgsForCall方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。