Example #1
0
					HostIP:   "some-ip-3",
				},
				db.TcpRouteMapping{
					TcpRoute: db.TcpRoute{
						RouterGroupGuid: routerGroupGuid,
						ExternalPort:    externalPort2,
					},
					HostPort: 60000,
					HostIP:   "some-ip-4",
				},
			}
		})

		Context("when routing api returns tcp route mappings", func() {
			BeforeEach(func() {
				fakeRoutingApiClient.TcpRouteMappingsReturns(tcpMappings, nil)
			})

			It("updates the routing table with that data", func() {
				go invokeSync(doneChannel)
				Eventually(doneChannel).Should(BeClosed())

				Expect(fakeTokenFetcher.FetchTokenCallCount()).To(Equal(1))
				Expect(fakeRoutingApiClient.TcpRouteMappingsCallCount()).To(Equal(1))
				Expect(routingTable.Size()).To(Equal(2))
				expectedRoutingTableEntry1 := models.NewRoutingTableEntry(
					models.BackendServerInfos{
						models.BackendServerInfo{"some-ip-1", 61000},
						models.BackendServerInfo{"some-ip-2", 61001},
					},
				)