}, ) verifyRoutingTableEntry(models.RoutingKey{externalPort2}, expectedRoutingTableEntry2) }) Context("when events are received", func() { var ( syncChannel chan struct{} ) BeforeEach(func() { syncChannel = make(chan struct{}) tmpSyncChannel := syncChannel fakeRoutingApiClient.TcpRouteMappingsStub = func() ([]db.TcpRouteMapping, error) { select { case <-tmpSyncChannel: return tcpMappings, nil } } }) It("caches events and then applies the events after it completes syncing", func() { go invokeSync(doneChannel) Eventually(updater.Syncing).Should(BeTrue()) tcpEvent = routing_api.TcpEvent{ TcpRouteMapping: db.TcpRouteMapping{ TcpRoute: db.TcpRoute{ RouterGroupGuid: routerGroupGuid, ExternalPort: externalPort1, }, HostPort: 61001, HostIP: "some-ip-2",