本文整理汇总了Golang中github.com/cloudfoundry-incubator/garden/fakes.FakeContainer.SetGraceTimeCallCount方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeContainer.SetGraceTimeCallCount方法的具体用法?Golang FakeContainer.SetGraceTimeCallCount怎么用?Golang FakeContainer.SetGraceTimeCallCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/garden/fakes.FakeContainer
的用法示例。
在下文中一共展示了FakeContainer.SetGraceTimeCallCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
Describe("the created container", func() {
It("can be destroyed", func() {
err := createdContainer.Destroy()
Expect(err).NotTo(HaveOccurred())
By("destroying via garden")
Expect(fakeGardenClient.DestroyCallCount()).To(Equal(1))
Expect(fakeGardenClient.DestroyArgsForCall(0)).To(Equal("some-handle"))
By("no longer heartbeating")
fakeClock.Increment(30 * time.Second)
Consistently(fakeContainer.SetGraceTimeCallCount).Should(Equal(1))
})
It("performs an initial heartbeat synchronously", func() {
Expect(fakeContainer.SetGraceTimeCallCount()).To(Equal(1))
Expect(fakeGardenWorkerDB.UpdateExpiresAtOnContainerCallCount()).To(Equal(1))
})
Describe("every 30 seconds", func() {
It("heartbeats to the database and the container", func() {
fakeClock.Increment(30 * time.Second)
Eventually(fakeContainer.SetGraceTimeCallCount).Should(Equal(2))
Expect(fakeContainer.SetGraceTimeArgsForCall(1)).To(Equal(5 * time.Minute))
Eventually(fakeGardenWorkerDB.UpdateExpiresAtOnContainerCallCount).Should(Equal(2))
handle, interval := fakeGardenWorkerDB.UpdateExpiresAtOnContainerArgsForCall(1)
Expect(handle).To(Equal("some-handle"))
Expect(interval).To(Equal(5 * time.Minute))