hs-test: refactor test cases from ns suite
This converts more tests to configure VPP from test context.
Type: test
Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech>
Change-Id: Idf26b0c16f87e87c97b198412af39b99d947ced6
diff --git a/extras/hs-test/ldp_test.go b/extras/hs-test/ldp_test.go
index cbba227..17f78ca 100644
--- a/extras/hs-test/ldp_test.go
+++ b/extras/hs-test/ldp_test.go
@@ -3,17 +3,16 @@
import (
"fmt"
"os"
- "time"
)
func (s *VethsSuite) TestLDPreloadIperfVpp() {
var clnVclConf, srvVclConf Stanza
serverContainer := s.getContainerByName("server-vpp")
- srvVcl := serverContainer.GetHostWorkDir() + "/vcl_srv.conf"
+ serverVclFileName := serverContainer.GetHostWorkDir() + "/vcl_srv.conf"
clientContainer := s.getContainerByName("client-vpp")
- clnVcl := clientContainer.GetHostWorkDir() + "/vcl_cln.conf"
+ clientVclFileName := clientContainer.GetHostWorkDir() + "/vcl_cln.conf"
ldpreload := os.Getenv("HST_LDPRELOAD")
s.assertNotEqual("", ldpreload)
@@ -26,15 +25,9 @@
s.log("starting VPPs")
- _, err := serverContainer.execAction("Configure2Veths srv")
- s.assertNil(err)
-
- _, err = clientContainer.execAction("Configure2Veths cln")
- s.assertNil(err)
-
clientAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/2",
clientContainer.GetContainerWorkDir())
- err = clnVclConf.
+ err := clnVclConf.
NewStanza("vcl").
Append("rx-fifo-size 4000000").
Append("tx-fifo-size 4000000").
@@ -42,7 +35,7 @@
Append("app-scope-global").
Append("use-mq-eventfd").
Append(clientAppSocketApi).Close().
- SaveToFile(clnVcl)
+ SaveToFile(clientVclFileName)
s.assertNil(err)
serverAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/1",
@@ -55,15 +48,12 @@
Append("app-scope-global").
Append("use-mq-eventfd").
Append(serverAppSocketApi).Close().
- SaveToFile(srvVcl)
+ SaveToFile(serverVclFileName)
s.assertNil(err)
s.log("attaching server to vpp")
- // FIXME
- time.Sleep(5 * time.Second)
-
- srvEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+srvVcl)
+ srvEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+serverVclFileName)
go StartServerApp(srvCh, stopServerCh, srvEnv)
err = <-srvCh
@@ -71,8 +61,9 @@
s.log("attaching client to vpp")
var clnRes = make(chan string, 1)
- clnEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+clnVcl)
- go StartClientApp(clnEnv, clnCh, clnRes)
+ clnEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+clientVclFileName)
+ serverVethAddress := s.netInterfaces[serverInterfaceName].Ip4AddressString()
+ go StartClientApp(serverVethAddress, clnEnv, clnCh, clnRes)
s.log(<-clnRes)
// wait for client's result