コード例 #1
0
				Ω(isFresh).Should(BeFalse())
			})
		})
	})

	Context("When it receives a simple heartbeat over the message bus", func() {
		BeforeEach(func() {
			messageBus.Subscriptions["dea.heartbeat"][0].Callback(&yagnats.Message{
				Payload: app.Heartbeat(1).ToJSON(),
			})

			forceHeartbeatSync()
		})

		It("puts it in the store", func() {
			foundApp, err := store.GetApp(app.AppGuid, app.AppVersion)
			Ω(err).ShouldNot(HaveOccurred())
			Ω(foundApp.InstanceHeartbeats).Should(ContainElement(app.InstanceAtIndex(0).Heartbeat()))
		})

		It("bumps the freshness", func() {
			isFresh, _ := store.IsActualStateFresh(freshByTime)
			Ω(isFresh).Should(BeTrue())
		})
	})

	Context("When it receives a complex heartbeat with multiple apps and instances", func() {
		var heartbeat Heartbeat

		BeforeEach(func() {
			heartbeat = Heartbeat{