本文整理汇总了Golang中github.com/concourse/atc/exec/fakes.FakeStepFactory.UsingReturns方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeStepFactory.UsingReturns方法的具体用法?Golang FakeStepFactory.UsingReturns怎么用?Golang FakeStepFactory.UsingReturns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/concourse/atc/exec/fakes.FakeStepFactory
的用法示例。
在下文中一共展示了FakeStepFactory.UsingReturns方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
attempt1Step *fakes.FakeStep
attempt2Factory *fakes.FakeStepFactory
attempt2Step *fakes.FakeStep
attempt3Factory *fakes.FakeStepFactory
attempt3Step *fakes.FakeStep
stepFactory StepFactory
step Step
)
BeforeEach(func() {
attempt1Factory = new(fakes.FakeStepFactory)
attempt1Step = new(fakes.FakeStep)
attempt1Factory.UsingReturns(attempt1Step)
attempt2Factory = new(fakes.FakeStepFactory)
attempt2Step = new(fakes.FakeStep)
attempt2Factory.UsingReturns(attempt2Step)
attempt3Factory = new(fakes.FakeStepFactory)
attempt3Step = new(fakes.FakeStep)
attempt3Factory.UsingReturns(attempt3Step)
stepFactory = Retry{attempt1Factory, attempt2Factory, attempt3Factory}
step = stepFactory.Using(nil, nil)
})
Context("when attempt 1 succeeds", func() {
BeforeEach(func() {
示例2:
inputStepFactory *execfakes.FakeStepFactory
inputStep *execfakes.FakeStep
outputStepFactory *execfakes.FakeStepFactory
outputStep *execfakes.FakeStep
dependentStepFactory *execfakes.FakeStepFactory
dependentStep *execfakes.FakeStep
)
BeforeEach(func() {
taskStepFactory = new(execfakes.FakeStepFactory)
taskStep = new(execfakes.FakeStep)
taskStep.ResultStub = successResult(true)
taskStepFactory.UsingReturns(taskStep)
fakeFactory.TaskReturns(taskStepFactory)
inputStepFactory = new(execfakes.FakeStepFactory)
inputStep = new(execfakes.FakeStep)
inputStep.ResultStub = successResult(true)
inputStepFactory.UsingReturns(inputStep)
fakeFactory.GetReturns(inputStepFactory)
outputStepFactory = new(execfakes.FakeStepFactory)
outputStep = new(execfakes.FakeStep)
outputStep.ResultStub = successResult(true)
outputStepFactory.UsingReturns(outputStep)
fakeFactory.PutReturns(outputStepFactory)
dependentStepFactory = new(execfakes.FakeStepFactory)
示例3:
repo *exec.SourceRepository
ensureFactory exec.StepFactory
ensureStep exec.Step
)
BeforeEach(func() {
stepFactory = &fakes.FakeStepFactory{}
hookFactory = &fakes.FakeStepFactory{}
step = &fakes.FakeStep{}
hook = &fakes.FakeStep{}
previousStep = &fakes.FakeStep{}
stepFactory.UsingReturns(step)
hookFactory.UsingReturns(hook)
repo = exec.NewSourceRepository()
ensureFactory = exec.Ensure(stepFactory, hookFactory)
ensureStep = ensureFactory.Using(previousStep, repo)
})
It("runs the ensure hook if the step succeeds", func() {
step.ResultStub = successResult(true)
process := ifrit.Background(ensureStep)
Eventually(step.RunCallCount).Should(Equal(1))
Eventually(hook.RunCallCount).Should(Equal(1))
示例4:
Context("get with nil location", func() {
var (
getStepFactory *execfakes.FakeStepFactory
getStep *execfakes.FakeStep
fakeDelegate *fakes.FakeBuildDelegate
fakeGetDelegate *execfakes.FakeGetDelegate
plan atc.Plan
)
BeforeEach(func() {
getStepFactory = new(execfakes.FakeStepFactory)
getStep = new(execfakes.FakeStep)
getStep.ResultStub = successResult(true)
getStepFactory.UsingReturns(getStep)
fakeFactory.GetReturns(getStepFactory)
fakeDelegate = new(fakes.FakeBuildDelegate)
fakeDelegateFactory.DelegateReturns(fakeDelegate)
fakeGetDelegate = new(execfakes.FakeGetDelegate)
fakeDelegate.InputDelegateReturns(fakeGetDelegate)
plan = atc.Plan{
Location: nil,
Get: &atc.GetPlan{
Name: "some input",
},
}
})
示例5:
repo *exec.SourceRepository
onSuccessFactory exec.StepFactory
onSuccessStep exec.Step
)
BeforeEach(func() {
stepFactory = &fakes.FakeStepFactory{}
successFactory = &fakes.FakeStepFactory{}
step = &fakes.FakeStep{}
hook = &fakes.FakeStep{}
previousStep = &fakes.FakeStep{}
stepFactory.UsingReturns(step)
successFactory.UsingReturns(hook)
repo = exec.NewSourceRepository()
onSuccessFactory = exec.OnSuccess(stepFactory, successFactory)
onSuccessStep = onSuccessFactory.Using(previousStep, repo)
})
It("runs the success hook if the step succeeds", func() {
step.ResultStub = successResult(true)
process := ifrit.Background(onSuccessStep)
Eventually(step.RunCallCount).Should(Equal(1))
Eventually(hook.RunCallCount).Should(Equal(1))
示例6:
repo *exec.SourceRepository
onFailureFactory exec.StepFactory
onFailureStep exec.Step
)
BeforeEach(func() {
stepFactory = &fakes.FakeStepFactory{}
failureFactory = &fakes.FakeStepFactory{}
step = &fakes.FakeStep{}
hook = &fakes.FakeStep{}
previousStep = &fakes.FakeStep{}
stepFactory.UsingReturns(step)
failureFactory.UsingReturns(hook)
repo = exec.NewSourceRepository()
onFailureFactory = exec.OnFailure(stepFactory, failureFactory)
onFailureStep = onFailureFactory.Using(previousStep, repo)
})
It("runs the failure hook if step fails", func() {
step.ResultStub = successResult(false)
process := ifrit.Background(onFailureStep)
Eventually(step.RunCallCount).Should(Equal(1))
Eventually(hook.RunCallCount).Should(Equal(1))
示例7:
outStep *fakes.FakeStep
step Step
process ifrit.Process
)
BeforeEach(func() {
inStep = new(fakes.FakeStep)
repo = NewSourceRepository()
fakeStepFactory = new(fakes.FakeStepFactory)
outStep = new(fakes.FakeStep)
outStep.ResultStub = successResult(true)
fakeStepFactory.UsingReturns(outStep)
conditional = Conditional{
StepFactory: fakeStepFactory,
}
})
JustBeforeEach(func() {
step = conditional.Using(inStep, repo)
process = ifrit.Invoke(step)
})
itDoesNothing := func() {
It("succeeds", func() {
Eventually(process.Wait()).Should(Receive(BeNil()))
})
示例8:
runStep *fakes.FakeStep
timeout StepFactory
step Step
startStep chan error
process ifrit.Process
timeoutDuration atc.Duration
)
BeforeEach(func() {
startStep = make(chan error, 1)
fakeStepFactoryStep = new(fakes.FakeStepFactory)
runStep = new(fakes.FakeStep)
fakeStepFactoryStep.UsingReturns(runStep)
})
JustBeforeEach(func() {
timeout = Timeout(fakeStepFactoryStep, timeoutDuration)
step = timeout.Using(nil, nil)
process = ifrit.Background(step)
})
Context("when the process goes beyond the duration", func() {
BeforeEach(func() {
runStep.ResultStub = successResult(true)
timeoutDuration = atc.Duration(1 * time.Second)
runStep.RunStub = func(signals <-chan os.Signal, ready chan<- struct{}) error {
示例9:
)
BeforeEach(func() {
fakeStepA = new(fakes.FakeStepFactory)
fakeStepB = new(fakes.FakeStepFactory)
aggregate = Aggregate{
fakeStepA,
fakeStepB,
}
inStep = new(fakes.FakeStep)
repo = NewSourceRepository()
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))
示例10:
})
Context("running timeout steps", func() {
var (
taskStepFactory *execfakes.FakeStepFactory
taskStep *execfakes.FakeStep
inputStepFactory *execfakes.FakeStepFactory
inputStep *execfakes.FakeStep
)
BeforeEach(func() {
taskStepFactory = new(execfakes.FakeStepFactory)
taskStep = new(execfakes.FakeStep)
taskStep.ResultStub = successResult(true)
taskStepFactory.UsingReturns(taskStep)
fakeFactory.TaskReturns(taskStepFactory)
inputStepFactory = new(execfakes.FakeStepFactory)
inputStep = new(execfakes.FakeStep)
inputStep.ResultStub = successResult(true)
inputStepFactory.UsingReturns(inputStep)
fakeFactory.GetReturns(inputStepFactory)
})
Context("constructing steps", func() {
var (
fakeDelegate *fakes.FakeBuildDelegate
fakeInputDelegate *execfakes.FakeGetDelegate
timeout string
)
示例11:
startNextStep chan error
finishNextStep chan error
step Step
process ifrit.Process
)
BeforeEach(func() {
fakeStepFactoryStep = new(fakes.FakeStepFactory)
fakeStepFactoryNextStep = new(fakes.FakeStepFactory)
inStep = new(fakes.FakeStep)
repo = NewSourceRepository()
outStep = new(fakes.FakeStep)
fakeStepFactoryStep.UsingReturns(outStep)
nextStep = new(fakes.FakeStep)
fakeStepFactoryNextStep.UsingReturns(nextStep)
startStep = make(chan error, 1)
finishStep = make(chan error, 1)
startNextStep = make(chan error, 1)
finishNextStep = make(chan error, 1)
outStep.ResultStub = successResult(true)
outStep.RunStub = func(signals <-chan os.Signal, ready chan<- struct{}) error {
select {
case err := <-startStep:
if err != nil {
示例12:
step Step
process ifrit.Process
)
BeforeEach(func() {
fakeStepFactoryA = new(fakes.FakeStepFactory)
fakeStepFactoryB = new(fakes.FakeStepFactory)
compose = Compose(fakeStepFactoryA, fakeStepFactoryB)
inStep = new(fakes.FakeStep)
repo = NewSourceRepository()
outStepA = new(fakes.FakeStep)
fakeStepFactoryA.UsingReturns(outStepA)
outStepB = new(fakes.FakeStep)
fakeStepFactoryB.UsingReturns(outStepB)
startA = make(chan error, 1)
finishA = make(chan error, 1)
startB = make(chan error, 1)
finishB = make(chan error, 1)
outStepA.RunStub = func(signals <-chan os.Signal, ready chan<- struct{}) error {
select {
case err := <-startA:
if err != nil {
return err