func (a *appAnalyzer) appendStartMessageIfNotDuplicate(message models.PendingStartMessage, loggingMessage string, additionalDetails map[string]string) (didAppend bool) { existingMessage, alreadyQueued := a.existingPendingStartMessages[message.StoreKey()] if !alreadyQueued { a.logger.Info(fmt.Sprintf("Enqueuing Start Message: %s", loggingMessage), message.LogDescription(), additionalDetails) a.startMessages[message.StoreKey()] = message return true } else { a.logger.Info(fmt.Sprintf("Skipping Already Enqueued Start Message: %s", loggingMessage), existingMessage.LogDescription(), additionalDetails) return false } }
Describe("Saving start messages", func() { BeforeEach(func() { err := store.SavePendingStartMessages( message1, message2, ) Ω(err).ShouldNot(HaveOccurred()) }) It("stores the passed in start messages", func() { node, err := storeAdapter.ListRecursively("/hm/v1/start") Ω(err).ShouldNot(HaveOccurred()) Ω(node.ChildNodes).Should(HaveLen(2)) Ω(node.ChildNodes).Should(ContainElement(storenodematchers.MatchStoreNode(storeadapter.StoreNode{ Key: "/hm/v1/start/" + message1.StoreKey(), Value: message1.ToJSON(), TTL: 0, }))) Ω(node.ChildNodes).Should(ContainElement(storenodematchers.MatchStoreNode(storeadapter.StoreNode{ Key: "/hm/v1/start/" + message2.StoreKey(), Value: message2.ToJSON(), TTL: 0, }))) }) }) Describe("Fetching start message", func() { Context("When the start message is present", func() { BeforeEach(func() { err := store.SavePendingStartMessages(