p = r.Lookup("bar") Ω(p).Should(BeNil()) }) It("disables pruning when NATS is unavailable", func() { r.Register("foo", fooEndpoint) r.Register("fooo", fooEndpoint) r.Register("bar", barEndpoint) r.Register("baar", barEndpoint) Ω(r.NumUris()).To(Equal(4)) Ω(r.NumEndpoints()).To(Equal(2)) messageBus.OnPing(func() bool { return false }) r.StartPruningCycle() time.Sleep(configObj.PruneStaleDropletsInterval + 10*time.Millisecond) Ω(r.NumUris()).To(Equal(4)) Ω(r.NumEndpoints()).To(Equal(2)) }) It("does not block when pruning", func() { // when pruning stale droplets, // and the stale check takes a while, // and a read request comes in (i.e. from Lookup), // the read request completes before the stale check r.Register("foo", fooEndpoint) r.Register("fooo", fooEndpoint)