} testUpdateFinder := func(updatedAddress map[string]string) func() { return func() { Context("when a service exists", func() { JustBeforeEach(func() { err := storeAdapter.Create(node) Expect(err).NotTo(HaveOccurred()) finder.Start() Eventually(finder.AllServers).ShouldNot(HaveLen(0)) Expect(finder.PreferredServers()).NotTo(HaveLen(0)) }) It("updates the service", func() { err := storeAdapter.Update(updateNode) Expect(err).NotTo(HaveOccurred()) Eventually(finder.AllServers).Should(Equal(updatedAddress)) Expect(getCallbackCount()).To(Equal(2)) Expect(finder.PreferredServers()).To(Equal(updatedAddress)) Expect(getPreferredCount()).To(Equal(2)) }) }) } } testFinder := func(expectedAddress map[string]string) func() { return func() { Context("when a service is created", func() { Context("before dopplerservice begins", func() {