本文整理汇总了Golang中github.com/concourse/atc/exec/fakes.FakeStep.ResultReturns方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeStep.ResultReturns方法的具体用法?Golang FakeStep.ResultReturns怎么用?Golang FakeStep.ResultReturns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/concourse/atc/exec/fakes.FakeStep
的用法示例。
在下文中一共展示了FakeStep.ResultReturns方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
It("returns nil having only run the first attempt", func() {
Expect(<-process.Wait()).ToNot(HaveOccurred())
Expect(attempt1Step.RunCallCount()).To(Equal(1))
Expect(attempt2Step.RunCallCount()).To(Equal(0))
Expect(attempt3Step.RunCallCount()).To(Equal(0))
})
Describe("Result", func() {
It("delegates to attempt 1", func() {
<-process.Wait()
// internal check for success within retry loop
Expect(attempt1Step.ResultCallCount()).To(Equal(1))
attempt1Step.ResultReturns(true)
var foo interface{}
destination := &foo
Expect(step.Result(destination)).To(BeTrue())
Expect(attempt1Step.ResultCallCount()).To(Equal(2))
Expect(attempt1Step.ResultArgsForCall(1)).To(Equal(destination))
})
})
})
})
Context("when attempt 1 fails, and attempt 2 succeeds", func() {
BeforeEach(func() {
attempt1Step.ResultStub = successResult(false)
示例2:
Context("and some branches are not successful", func() {
BeforeEach(func() {
outStepA.ResultStub = successResult(true)
outStepB.ResultStub = successResult(false)
})
It("yields false", func() {
Ω(step.Result(&result)).Should(BeTrue())
Ω(result).Should(Equal(Success(false)))
})
})
Context("when some branches do not indicate success", func() {
BeforeEach(func() {
outStepA.ResultStub = successResult(true)
outStepB.ResultReturns(false)
})
It("only considers the branches that do", func() {
Ω(step.Result(&result)).Should(BeTrue())
Ω(result).Should(Equal(Success(true)))
})
})
Context("when no branches indicate success", func() {
BeforeEach(func() {
outStepA.ResultReturns(false)
outStepB.ResultReturns(false)
})
It("returns false", func() {
示例3:
})
itDoesNothing()
})
Context("when the input source failed", func() {
BeforeEach(func() {
inStep.ResultStub = successResult(false)
})
itDoesNothing()
})
Context("when the input source cannot indicate success", func() {
BeforeEach(func() {
inStep.ResultReturns(false)
})
itDoesNothing()
})
})
Context("with a success condition", func() {
BeforeEach(func() {
conditional.Conditions = atc.Conditions{atc.ConditionSuccess}
})
Context("when the input source is successful", func() {
BeforeEach(func() {
inStep.ResultStub = successResult(true)
})
示例4:
startSuccess <- nil
finishSuccess <- nil
})
It("executes the ensure step", func() {
Eventually(fakeStepFactoryEnsureStep.UsingCallCount).Should(Equal(1))
Eventually(ensureStep.RunCallCount).Should(Equal(1))
step, repo = fakeStepFactoryEnsureStep.UsingArgsForCall(0)
Ω(step).Should(Equal(outStep))
Ω(repo).Should(Equal(repo))
})
Context("and the ensure step cannot respond to success", func() {
BeforeEach(func() {
ensureStep.ResultReturns(false)
startEnsure <- nil
finishEnsure <- nil
})
It("exits", func() {
Eventually(process.Wait()).Should(Receive(BeNil()))
})
It("does not proceed to the next step", func() {
Consistently(fakeStepFactoryNextStep.UsingCallCount).Should(BeZero())
})
})
Context("and the ensure step exits with an error", func() {