コード例 #1
0
				clock.Increment(time.Duration(conf.ActualFreshnessTTL()) * time.Second)
				advertise()
			})

			It("does bump the freshness", func() {
				Eventually(store.BumpActualFreshnessCallCount).Should(Equal(2))
			})
		})
	})

	Context("When there are heartbeats", func() {
		receivedHeartbeats := func() {
			Eventually(func() bool {
				count := metricsAccountant.TrackReceivedHeartbeatsCallCount()
				if count > 0 {
					return metricsAccountant.TrackReceivedHeartbeatsArgsForCall(count-1) == 1
				}
				return false
			}).Should(BeTrue())
		}

		JustBeforeEach(func() {
			beat()
			clock.Increment(conf.ListenerHeartbeatSyncInterval())
		})

		Context("and the SyncHeartbeats completes before the next interval", func() {
			BeforeEach(func() {
				clock := clock
				interval := conf.ListenerHeartbeatSyncInterval()
				store.SyncHeartbeatsStub = func(_ ...Heartbeat) error {