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
diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go
index f121866..ce0e7ad 100644
--- a/extras/hs-test/proxy_test.go
+++ b/extras/hs-test/proxy_test.go
@@ -49,7 +49,7 @@
return nil
}
-func configureVppProxy(s *NsSuite) error {
+func configureVppProxy(s *NsSuite) {
serverVeth := s.netInterfaces[serverInterface]
clientVeth := s.netInterfaces[clientInterface]
@@ -60,24 +60,35 @@
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)
}