X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Fhs-test%2Fproxy_test.go;h=9e7230317fb1ba3ee722807d05848b7ff6d625a4;hb=4b3598e39a5b522a55b4b86fa06a323416108a6b;hp=4c183517c37e15a70d75673a8bdb85816505b064;hpb=2908f8cf07c21f385f80d83fdad826a0eea98977;p=vpp.git diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go index 4c183517c37..9e7230317fb 100644 --- a/extras/hs-test/proxy_test.go +++ b/extras/hs-test/proxy_test.go @@ -20,7 +20,7 @@ func testProxyHttpTcp(s *NsSuite) error { s.log("test file created...") - go startHttpServer(serverRunning, stopServer, ":666", "server") + go s.startHttpServer(serverRunning, stopServer, ":666", "server") // TODO better error handling and recovery <-serverRunning @@ -35,7 +35,7 @@ func testProxyHttpTcp(s *NsSuite) error { " --retry-on-http-error=503 --tries=10"+ " -O %s %s:555/%s", outputFile, - clientVeth.Ip4AddressString(), + clientVeth.ip4AddressString(), srcFile, ) s.log(c) @@ -49,35 +49,45 @@ func testProxyHttpTcp(s *NsSuite) error { return nil } -func configureVppProxy(s *NsSuite) error { - serverVeth := s.netInterfaces[serverInterface].(*NetworkInterfaceVeth) +func configureVppProxy(s *NsSuite) { + serverVeth := s.netInterfaces[serverInterface] clientVeth := s.netInterfaces[clientInterface] testVppProxy := s.getContainerByName("vpp").vppInstance output := testVppProxy.vppctl( "test proxy server server-uri tcp://%s/555 client-uri tcp://%s/666", - clientVeth.Ip4AddressString(), - serverVeth.PeerIp4AddressString(), + clientVeth.ip4AddressString(), + serverVeth.peer.ip4AddressString(), ) s.log("proxy configured...", output) - return nil } func (s *NsSuite) TestVppProxyHttpTcp() { - err := configureVppProxy(s) - s.assertNil(err) - err = testProxyHttpTcp(s) + configureVppProxy(s) + err := testProxyHttpTcp(s) s.assertNil(err) } -func configureEnvoyProxy(s *NsSuite) error { +func configureEnvoyProxy(s *NsSuite) { envoyContainer := s.getContainerByName("envoy") - return envoyContainer.run() + envoyContainer.create() + + serverVeth := s.netInterfaces[serverInterface] + address := struct { + Server string + }{ + Server: serverVeth.peer.ip4AddressString(), + } + envoyContainer.createConfig( + "/etc/envoy/envoy.yaml", + "resources/envoy/proxy.yaml", + address, + ) + s.assertNil(envoyContainer.start()) } func (s *NsSuite) TestEnvoyProxyHttpTcp() { - err := configureEnvoyProxy(s) - s.assertNil(err) - err = testProxyHttpTcp(s) + configureEnvoyProxy(s) + err := testProxyHttpTcp(s) s.assertNil(err) }