本文整理汇总了Golang中github.com/concourse/atc/worker/fakes.FakeWorker.SatisfyingArgsForCall方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeWorker.SatisfyingArgsForCall方法的具体用法?Golang FakeWorker.SatisfyingArgsForCall怎么用?Golang FakeWorker.SatisfyingArgsForCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/concourse/atc/worker/fakes.FakeWorker
的用法示例。
在下文中一共展示了FakeWorker.SatisfyingArgsForCall方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
workerC = new(fakes.FakeWorker)
workerA.SatisfyingReturns(workerA, nil)
workerB.SatisfyingReturns(workerB, nil)
workerC.SatisfyingReturns(nil, errors.New("nope"))
fakeProvider.WorkersReturns([]Worker{workerA, workerB, workerC}, nil)
})
It("succeeds", func() {
Expect(satisfyingErr).NotTo(HaveOccurred())
})
It("checks that the workers satisfy the given spec", func() {
Expect(workerA.SatisfyingCallCount()).To(Equal(1))
actualSpec, actualResourceTypes := workerA.SatisfyingArgsForCall(0)
Expect(actualSpec).To(Equal(spec))
Expect(actualResourceTypes).To(Equal(resourceTypes))
Expect(workerB.SatisfyingCallCount()).To(Equal(1))
actualSpec, actualResourceTypes = workerB.SatisfyingArgsForCall(0)
Expect(actualSpec).To(Equal(spec))
Expect(actualResourceTypes).To(Equal(resourceTypes))
Expect(workerC.SatisfyingCallCount()).To(Equal(1))
actualSpec, actualResourceTypes = workerC.SatisfyingArgsForCall(0)
Expect(actualSpec).To(Equal(spec))
Expect(actualResourceTypes).To(Equal(resourceTypes))
})
It("returns a random worker satisfying the spec", func() {
示例2:
workerC = new(fakes.FakeWorker)
workerA.SatisfyingReturns(workerA, nil)
workerB.SatisfyingReturns(workerB, nil)
workerC.SatisfyingReturns(nil, errors.New("nope"))
fakeProvider.WorkersReturns([]Worker{workerA, workerB, workerC}, nil)
})
It("succeeds", func() {
Expect(satisfyingErr).NotTo(HaveOccurred())
})
It("checks that the workers satisfy the given spec", func() {
Expect(workerA.SatisfyingCallCount()).To(Equal(1))
Expect(workerA.SatisfyingArgsForCall(0)).To(Equal(spec))
Expect(workerB.SatisfyingCallCount()).To(Equal(1))
Expect(workerB.SatisfyingArgsForCall(0)).To(Equal(spec))
Expect(workerC.SatisfyingCallCount()).To(Equal(1))
Expect(workerC.SatisfyingArgsForCall(0)).To(Equal(spec))
})
It("returns a random worker satisfying the spec", func() {
chosenCount := map[Worker]int{workerA: 0, workerB: 0, workerC: 0}
for i := 0; i < 100; i++ {
satisfyingWorker, satisfyingErr = pool.Satisfying(spec)
Expect(satisfyingErr).NotTo(HaveOccurred())
chosenCount[satisfyingWorker]++
}