本文整理汇总了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))
示例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))
})
示例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")
示例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))
})
示例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() {
示例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))