It("doesn't send an event", func() { go func() { finder.Next() close(done) }() Consistently(done).ShouldNot(BeClosed()) }) }) Context("when a node's TTL is updated without a value change", func() { var done chan struct{} BeforeEach(func() { metaNode = makeMetaNode("z1/doppler_z1/0", []string{"udp://1.2.3.4:567"}) metaNode.TTL = 30 }) JustBeforeEach(func() { // Ignore the startup event _ = finder.Next() // Pretend it's been 20 seconds updateNode := metaNode metaNode.TTL = 10 metaEvents <- storeadapter.WatchEvent{ Type: storeadapter.UpdateEvent, Node: &updateNode, PrevNode: &metaNode, }
}) It("returns the updated endpoints", func() { event := finder.Next() Expect(event.TLSDopplers).To(Equal([]string{"1.2.3.4:555"})) Expect(event.UDPDopplers).To(BeEmpty()) Expect(event.TCPDopplers).To(BeEmpty()) }) }) Context("when a node's TTL is updated without a value change", func() { var done chan struct{} BeforeEach(func() { metaNode = makeMetaNode("z1/doppler_z1/0", []string{"udp://1.2.3.4:567"}) metaNode.TTL = 30 }) JustBeforeEach(func() { // Ignore the startup event _ = finder.Next() // Pretend it's been 20 seconds updateNode := metaNode metaNode.TTL = 10 metaEvents <- storeadapter.WatchEvent{ Type: storeadapter.UpdateEvent, Node: &updateNode, PrevNode: &metaNode, }