diff options
author | Maros Ondrejicka <mondreji@cisco.com> | 2023-02-28 12:49:43 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2023-02-28 22:13:21 +0000 |
commit | 85396a5488264690c7da2684742e4a5f38d192a7 (patch) | |
tree | d9afdf5bb8a7fd965adb2c3d4aa4111b7abb02d7 /extras/hs-test/proxy_test.go | |
parent | 729b9c94f8222346a61c21d21a674bcb9b5974f8 (diff) |
hs-test: fill configuration files at runtime
Treat certain configuration files, which contain runtime-dependent
information, as templates. The information is filled at runtime and the
files are copied into containers.
This allows to avoid hard-coding IP addresses into configuration files.
Type: test
Signed-off-by: Maros Ondrejicka <mondreji@cisco.com>
Change-Id: I1dae8f15f4f76c0bf1779d7c68b7f3859bf5a861
Diffstat (limited to 'extras/hs-test/proxy_test.go')
-rw-r--r-- | extras/hs-test/proxy_test.go | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go index f1218662374..ce0e7ad854d 100644 --- a/extras/hs-test/proxy_test.go +++ b/extras/hs-test/proxy_test.go @@ -49,7 +49,7 @@ func testProxyHttpTcp(s *NsSuite) error { return nil } -func configureVppProxy(s *NsSuite) error { +func configureVppProxy(s *NsSuite) { serverVeth := s.netInterfaces[serverInterface] clientVeth := s.netInterfaces[clientInterface] @@ -60,24 +60,35 @@ func configureVppProxy(s *NsSuite) error { 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, + ) + + envoyContainer.start() } func (s *NsSuite) TestEnvoyProxyHttpTcp() { - err := configureEnvoyProxy(s) - s.assertNil(err) - err = testProxyHttpTcp(s) + configureEnvoyProxy(s) + err := testProxyHttpTcp(s) s.assertNil(err) } |