本文整理汇总了Golang中github.com/cloudfoundry/hm9000/models.InstanceHeartbeat.StoreKey方法的典型用法代码示例。如果您正苦于以下问题:Golang InstanceHeartbeat.StoreKey方法的具体用法?Golang InstanceHeartbeat.StoreKey怎么用?Golang InstanceHeartbeat.StoreKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/hm9000/models.InstanceHeartbeat
的用法示例。
在下文中一共展示了InstanceHeartbeat.StoreKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
})
Context("when an associated DEA heartbeat has expired", func() {
BeforeEach(func() {
storeAdapter.Delete("/hm/v1/dea-presence/A")
})
It("should not return any expired instance heartbeats", func() {
results, err := store.GetInstanceHeartbeatsForApp(app.AppGuid, app.AppVersion)
Ω(err).ShouldNot(HaveOccurred())
Ω(results).Should(HaveLen(1))
Ω(results).Should(ContainElement(heartbeatB))
})
It("should remove expired instance heartbeats from the store", func() {
_, err := storeAdapter.Get("/hm/v1/apps/actual/" + store.AppKey(app.AppGuid, app.AppVersion) + "/" + heartbeatA.StoreKey())
Ω(err).ShouldNot(HaveOccurred())
_, err = store.GetInstanceHeartbeatsForApp(app.AppGuid, app.AppVersion)
Ω(err).ShouldNot(HaveOccurred())
_, err = storeAdapter.Get("/hm/v1/apps/actual/" + store.AppKey(app.AppGuid, app.AppVersion) + "/" + heartbeatA.StoreKey())
Ω(err).Should(Equal(storeadapter.ErrorKeyNotFound))
})
Context("if it fails to remove them", func() {
It("should soldier on", func() {
resultChan := make(chan []models.InstanceHeartbeat, 2)
errChan := make(chan error, 2)
go func() {
results, err := store.GetInstanceHeartbeatsForApp(app.AppGuid, app.AppVersion)