BeforeEach(func() { bbsClient = new(fake_bbs.FakeClient) natsClient = diegonats.NewFakeClient() clock = fakeclock.NewFakeClock(time.Now()) clockStep = 1 * time.Second syncInterval = 10 * time.Second startMessages := make(chan *nats.Msg) routerStartMessages = startMessages natsClient.WhenSubscribing("router.start", func(callback nats.MsgHandler) error { go func() { for msg := range startMessages { callback(msg) } }() return nil }) //what follows is fake data to distinguish between //the "sync" and "emit" codepaths dummyEndpoint := routing_table.Endpoint{InstanceGuid: "instance-guid-1", Host: "1.1.1.1", Port: 11, ContainerPort: 1111} dummyMessage := routing_table.RegistryMessageFor(dummyEndpoint, routing_table.Routes{Hostnames: []string{"foo.com", "bar.com"}, LogGuid: logGuid}) syncMessages = routing_table.MessagesToEmit{ RegistrationMessages: []routing_table.RegistryMessage{dummyMessage}, } dummyEndpoint = routing_table.Endpoint{InstanceGuid: "instance-guid-2", Host: "2.2.2.2", Port: 22, ContainerPort: 2222} dummyMessage = routing_table.RegistryMessageFor(dummyEndpoint, routing_table.Routes{Hostnames: []string{"baz.com"}, LogGuid: logGuid})