summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/ldp_test.go
diff options
context:
space:
mode:
authorMaros Ondrejicka <maros.ondrejicka@pantheon.tech>2022-12-14 16:30:04 +0100
committerFlorin Coras <florin.coras@gmail.com>2022-12-19 17:11:52 +0000
commitdb823ed6e9543741f6969ff160314093002e037e (patch)
treebf046f85d1052058da38192687874e361c684e4c /extras/hs-test/ldp_test.go
parentaff4d320f0fe9ce68fcb83ee9ab0abc2d8612644 (diff)
hs-test: abstract away topology from test cases
Definition of shared volumes and containers has been moved to yaml files to be together with network topology. Containers are automatically run at the beginning of each test case and stopped afterward. Type: test Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech> Change-Id: I264cbb4f1355f8bd7aade221e9609fb5b9bd693e
Diffstat (limited to 'extras/hs-test/ldp_test.go')
-rwxr-xr-xextras/hs-test/ldp_test.go40
1 files changed, 20 insertions, 20 deletions
diff --git a/extras/hs-test/ldp_test.go b/extras/hs-test/ldp_test.go
index 683c6a37525..9a8b8121e8a 100755
--- a/extras/hs-test/ldp_test.go
+++ b/extras/hs-test/ldp_test.go
@@ -4,22 +4,18 @@ import (
"fmt"
"os"
"time"
-
- "github.com/edwarnicke/exechelper"
)
func (s *VethsSuite) TestLDPreloadIperfVpp() {
var clnVclConf, srvVclConf Stanza
- srvInstance := "vpp-ldp-srv"
- clnInstance := "vpp-ldp-cln"
- srvPath := "/tmp/" + srvInstance
- clnPath := "/tmp/" + clnInstance
- srvVcl := srvPath + "/vcl_srv.conf"
- clnVcl := clnPath + "/vcl_cln.conf"
+ serverContainer := s.getContainerByName("server-vpp")
+ serverVolume := serverContainer.getVolumeByHostDir("/tmp/server")
+ srvVcl := serverVolume.containerDir + "/vcl_srv.conf"
- exechelper.Run("mkdir " + srvPath)
- exechelper.Run("mkdir " + clnPath)
+ clientContainer := s.getContainerByName("client-vpp")
+ clientVolume := clientContainer.getVolumeByHostDir("/tmp/client")
+ clnVcl := clientVolume.containerDir + "/vcl_cln.conf"
ldpreload := os.Getenv("HST_LDPRELOAD")
s.assertNotEqual("", ldpreload)
@@ -32,18 +28,20 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() {
fmt.Println("starting VPPs")
- s.assertNil(dockerRun(srvInstance, fmt.Sprintf("-v /tmp/%s:/tmp", srvInstance)), "failed to start docker (srv)")
- defer func() { exechelper.Run("docker stop " + srvInstance) }()
-
- s.assertNil(dockerRun(clnInstance, fmt.Sprintf("-v /tmp/%s:/tmp", clnInstance)), "failed to start docker (cln)")
- defer func() { exechelper.Run("docker stop " + clnInstance) }()
-
- _, err := hstExec("Configure2Veths srv", srvInstance)
+ originalWorkDir := serverContainer.workDir
+ serverContainer.workDir = serverVolume.containerDir
+ _, err := serverContainer.execAction("Configure2Veths srv")
s.assertNil(err)
+ serverContainer.workDir = originalWorkDir
- _, err = hstExec("Configure2Veths cln", clnInstance)
+ originalWorkDir = clientContainer.workDir
+ clientContainer.workDir = clientVolume.containerDir
+ _, err = clientContainer.execAction("Configure2Veths cln")
s.assertNil(err)
+ clientContainer.workDir = originalWorkDir
+ clientAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/2",
+ clientVolume.containerDir)
err = clnVclConf.
NewStanza("vcl").
Append("rx-fifo-size 4000000").
@@ -51,10 +49,12 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() {
Append("app-scope-local").
Append("app-scope-global").
Append("use-mq-eventfd").
- Append(fmt.Sprintf("app-socket-api /tmp/%s/Configure2Veths/var/run/app_ns_sockets/2", clnInstance)).Close().
+ Append(clientAppSocketApi).Close().
SaveToFile(clnVcl)
s.assertNil(err)
+ serverAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/1",
+ serverVolume.containerDir)
err = srvVclConf.
NewStanza("vcl").
Append("rx-fifo-size 4000000").
@@ -62,7 +62,7 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() {
Append("app-scope-local").
Append("app-scope-global").
Append("use-mq-eventfd").
- Append(fmt.Sprintf("app-socket-api /tmp/%s/Configure2Veths/var/run/app_ns_sockets/1", srvInstance)).Close().
+ Append(serverAppSocketApi).Close().
SaveToFile(srvVcl)
s.assertNil(err)