Describe("Saving stop messages", func() { BeforeEach(func() { err := store.SavePendingStopMessages( message1, message2, ) Ω(err).ShouldNot(HaveOccurred()) }) It("stores the passed in stop messages", func() { node, err := storeAdapter.ListRecursively("/hm/v1/stop") Ω(err).ShouldNot(HaveOccurred()) Ω(node.ChildNodes).Should(HaveLen(2)) Ω(node.ChildNodes).Should(ContainElement(storenodematchers.MatchStoreNode(storeadapter.StoreNode{ Key: "/hm/v1/stop/" + message1.StoreKey(), Value: message1.ToJSON(), TTL: 0, }))) Ω(node.ChildNodes).Should(ContainElement(storenodematchers.MatchStoreNode(storeadapter.StoreNode{ Key: "/hm/v1/stop/" + message2.StoreKey(), Value: message2.ToJSON(), TTL: 0, }))) }) }) Describe("Fetching stop message", func() { Context("When the stop message is present", func() { BeforeEach(func() { err := store.SavePendingStopMessages( message1,
storeAdapter.Disconnect() }) Describe("Saving crash state", func() { BeforeEach(func() { err := store.SaveCrashCounts(crashCount1, crashCount2) Ω(err).ShouldNot(HaveOccurred()) }) It("stores the passed in crash state", func() { expectedTTL := uint64(conf.MaximumBackoffDelay().Seconds()) * 2 node, err := storeAdapter.Get("/hm/v1/apps/crashes/" + crashCount1.AppGuid + "," + crashCount1.AppVersion + "/1") Ω(err).ShouldNot(HaveOccurred()) Ω(node).Should(storenodematchers.MatchStoreNode(storeadapter.StoreNode{ Key: "/hm/v1/apps/crashes/" + crashCount1.AppGuid + "," + crashCount1.AppVersion + "/1", Value: crashCount1.ToJSON(), TTL: expectedTTL, })) node, err = storeAdapter.Get("/hm/v1/apps/crashes/" + crashCount2.AppGuid + "," + crashCount2.AppVersion + "/4") Ω(err).ShouldNot(HaveOccurred()) Ω(node).Should(storenodematchers.MatchStoreNode(storeadapter.StoreNode{ Key: "/hm/v1/apps/crashes/" + crashCount2.AppGuid + "," + crashCount2.AppVersion + "/4", Value: crashCount2.ToJSON(), TTL: expectedTTL, })) }) }) })