本文整理汇总了Golang中github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers.Spammer.Spam方法的典型用法代码示例。如果您正苦于以下问题:Golang Spammer.Spam方法的具体用法?Golang Spammer.Spam怎么用?Golang Spammer.Spam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers.Spammer
的用法示例。
在下文中一共展示了Spammer.Spam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
var _ = Describe("Spammer", func() {
var (
kv *fakeKV
spammer *helpers.Spammer
prefix string
)
Context("Check", func() {
BeforeEach(func() {
prefix = fmt.Sprintf("some-prefix-%v", rand.Int())
kv = newFakeKV()
kv.AddressCall.Returns.Address = "http://some-address/consul"
spammer = helpers.NewSpammer(kv, time.Duration(0), prefix)
spammer.Spam()
Eventually(func() int {
return kv.SetCall.CallCount.Value()
}).Should(BeNumerically(">", 1))
spammer.Stop()
})
It("gets all the sets", func() {
Expect(spammer.Check()).To(Succeed())
Expect(kv.GetCall.CallCount).Should(Equal(kv.SetCall.CallCount.Value()))
})
It("returns an error when a key doesn't exist", func() {
kv.GetCall.Returns.Error = fmt.Errorf("could not find key: %s-some-key-0", prefix)