func newFakeClient(proto, addr string) *fakes.FakeClient { c := fakes.FakeClient{} c.SchemeReturns(proto) c.AddressReturns(addr) return &c }
clientFactory = func(_ *steno.Logger, _ string) (loggregatorclient.Client, error) { return nil, errors.New("boom") } }) It("does not include the client", func() { pool.SetLegacy(allLegacy, nil) Expect(pool.Clients()).To(BeEmpty()) Expect(loggertesthelper.TestLoggerSink.LogContents()).To(ContainSubstring("Invalid url")) }) }) }) }) Context("when a server no longer exists", func() { var fakeClient *fakes.FakeClient BeforeEach(func() { fakeClient = newFakeClient("udp", "host:port") clientFactory = func(_ *steno.Logger, _ string) (loggregatorclient.Client, error) { return fakeClient, nil } }) It("the client is stopped", func() { s := map[string]string{ "a": "udp://host:port", } pool.Set(s, nil) Expect(fakeClient.StopCallCount()).To(Equal(0))