Exemple #1
0
			err := routingApiClient.UpsertTcpRouteMappings([]db.TcpRouteMapping{tcpRouteMapping})
			Expect(err).ToNot(HaveOccurred())

			tcpRouteMappings, err := routingApiClient.TcpRouteMappings()
			Expect(err).NotTo(HaveOccurred())
			Expect(tcpRouteMappings).To(ContainElement(tcpRouteMapping))

			allOutput := logger.Buffer()
			runner := testrunner.New(routerConfigurerPath, routerConfigurerArgs)
			session, err = gexec.Start(runner.Command, allOutput, allOutput)
			Expect(err).ToNot(HaveOccurred())
		})

		AfterEach(func() {
			logger.Info("shutting-down")
			session.Signal(os.Interrupt)
			Eventually(session.Exited, 5*time.Second).Should(BeClosed())
			server.Signal(os.Interrupt)
			Eventually(server.Wait(), 5*time.Second).Should(Receive())
			oauthServer.Close()
		})

		It("syncs with routing api", func() {
			Eventually(session.Out, 5*time.Second).Should(gbytes.Say("applied-fetched-routes-to-routing-table"))
			expectedConfigEntry := "\nlisten listen_cfg_5222\n  mode tcp\n  bind :5222\n"
			serverConfigEntry := "server server_some-ip-1_61000 some-ip-1:61000"
			verifyHaProxyConfigContent(haproxyConfigFile, expectedConfigEntry)
			verifyHaProxyConfigContent(haproxyConfigFile, serverConfigEntry)
		})

		It("starts an SSE connection to the server", func() {