本文整理汇总了Golang中code/cloudfoundry/org/clock/fakeclock.FakeClock.WaitForWatcherAndIncrement方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeClock.WaitForWatcherAndIncrement方法的具体用法?Golang FakeClock.WaitForWatcherAndIncrement怎么用?Golang FakeClock.WaitForWatcherAndIncrement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类code/cloudfoundry/org/clock/fakeclock.FakeClock
的用法示例。
在下文中一共展示了FakeClock.WaitForWatcherAndIncrement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
AfterEach(func() {
ginkgomon.Kill(registrationProcess)
})
JustBeforeEach(func() {
registrationProcess = ifrit.Invoke(registrationRunner)
})
It("should become ready", func() {
Eventually(registrationProcess.Ready()).Should(BeClosed())
})
It("updates the health status after TTL/2", func() {
Eventually(agent.PassTTLCallCount).Should(Equal(1))
clock.WaitForWatcherAndIncrement(5 * time.Second)
Eventually(agent.PassTTLCallCount).Should(Equal(2))
})
It("when the passTTL fails we should try and reregister", func() {
Eventually(agent.ServiceRegisterCallCount()).Should(Equal(1))
Eventually(agent.PassTTLCallCount).Should(Equal(1))
agent.PassTTLReturns(fmt.Errorf("Invalid status: failed"))
clock.WaitForWatcherAndIncrement(5 * time.Second)
Eventually(agent.PassTTLCallCount).Should(Equal(2))
Eventually(agent.ServiceRegisterCallCount()).Should(Equal(2))
})
Context("deregistering the service", func() {
It("deregisters the service after being signalled", func() {
Expect(agent.ServiceDeregisterCallCount()).Should(Equal(0))
示例2:
convergeRepeatInterval,
kickTaskDuration,
expirePendingTaskDuration,
expireCompletedTaskDuration,
),
)
})
AfterEach(func() {
ginkgomon.Interrupt(process)
Eventually(process.Wait()).Should(Receive())
})
Describe("converging over time", func() {
It("converges tasks, LRPs, and auctions when the lock is periodically reestablished", func() {
fakeClock.WaitForWatcherAndIncrement(convergeRepeatInterval + aBit)
Eventually(fakeTaskController.ConvergeTasksCallCount).Should(Equal(1))
Eventually(fakeLrpConvergenceController.ConvergeLRPsCallCount).Should(Equal(1))
_, actualKickTaskDuration, actualExpirePendingTaskDuration, actualExpireCompletedTaskDuration := fakeTaskController.ConvergeTasksArgsForCall(0)
Expect(actualKickTaskDuration).To(Equal(kickTaskDuration))
Expect(actualExpirePendingTaskDuration).To(Equal(expirePendingTaskDuration))
Expect(actualExpireCompletedTaskDuration).To(Equal(expireCompletedTaskDuration))
fakeClock.WaitForWatcherAndIncrement(convergeRepeatInterval + aBit)
Eventually(fakeTaskController.ConvergeTasksCallCount).Should(Equal(2))
Eventually(fakeLrpConvergenceController.ConvergeLRPsCallCount).Should(Equal(2))
_, actualKickTaskDuration, actualExpirePendingTaskDuration, actualExpireCompletedTaskDuration = fakeTaskController.ConvergeTasksArgsForCall(1)
示例3:
consulRunner.Stop()
})
AfterEach(func() {
consulRunner.Start()
consulRunner.WaitUntilReady()
})
It("continues to retry acquiring the lock", func() {
lockProcess = ifrit.Background(lockRunner)
Consistently(lockProcess.Ready()).ShouldNot(BeClosed())
Consistently(lockProcess.Wait()).ShouldNot(Receive())
Eventually(logger).Should(Say("acquire-lock-failed"))
clock.WaitForWatcherAndIncrement(retryInterval)
Eventually(logger).Should(Say("retrying-acquiring-lock"))
clock.WaitForWatcherAndIncrement(retryInterval)
Eventually(logger).Should(Say("retrying-acquiring-lock"))
})
Context("when consul starts up", func() {
It("acquires the lock", func() {
lockProcess = ifrit.Background(lockRunner)
Eventually(logger).Should(Say("acquire-lock-failed"))
clock.Increment(retryInterval)
Eventually(logger).Should(Say("retrying-acquiring-lock"))
Consistently(lockProcess.Ready()).ShouldNot(BeClosed())
Consistently(lockProcess.Wait()).ShouldNot(Receive())
示例4:
})
Describe("Run", func() {
var schedDone chan struct{}
BeforeEach(func() {
schedDone = make(chan struct{})
})
JustBeforeEach(func() {
go func(sched *scheduler.Scheduler, c chan struct{}) {
defer GinkgoRecover()
Expect(sched.Run).NotTo(Panic())
close(c)
}(sched, schedDone)
clk.WaitForWatcherAndIncrement(csSleep)
})
AfterEach(func() {
Expect(sched.Stop()).To(Succeed())
clk.Increment(csSleep)
Eventually(schedDone).Should(BeClosed())
})
Context("when there are no tasks", func() {
It("should not call the task selector", func() {
Expect(taskSelector.SelectTaskCallCount()).To(Equal(0))
})
})
Context("when there are tasks", func() {