summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/ldp_test.go
diff options
context:
space:
mode:
authorAdrian Villin <avillin@cisco.com>2024-06-14 09:32:39 +0200
committerDave Wallace <dwallacelf@gmail.com>2024-06-14 18:10:26 +0000
commit4677d920c0b0ff1f1aae81fb2f0052d939a2e89c (patch)
tree9c1adf90f6c1a977b622c1d0211e0e86d1bef985 /extras/hs-test/ldp_test.go
parent2aa0f0da5dedcf6301c74a39b5e3749359e07e6d (diff)
hs-test: separate infra from tests
- most functions and vars now start with a capital letter: needed to access them outside the package that declares them - updated README.md - very minor changes in MAKEFILE Type: test Change-Id: I4b5a194f08f09d59e372e57da6451fbb5a1de4da Signed-off-by: Adrian Villin <avillin@cisco.com>
Diffstat (limited to 'extras/hs-test/ldp_test.go')
-rw-r--r--extras/hs-test/ldp_test.go71
1 files changed, 36 insertions, 35 deletions
diff --git a/extras/hs-test/ldp_test.go b/extras/hs-test/ldp_test.go
index 24d2de39485..fc195f1572a 100644
--- a/extras/hs-test/ldp_test.go
+++ b/extras/hs-test/ldp_test.go
@@ -4,21 +4,22 @@ import (
"fmt"
"os"
+ . "fd.io/hs-test/infra"
. "github.com/onsi/ginkgo/v2"
)
func init() {
- registerVethTests(LDPreloadIperfVppTest)
+ RegisterVethTests(LDPreloadIperfVppTest)
}
func LDPreloadIperfVppTest(s *VethsSuite) {
var clnVclConf, srvVclConf Stanza
- serverContainer := s.getContainerByName("server-vpp")
- serverVclFileName := serverContainer.getHostWorkDir() + "/vcl_srv.conf"
+ serverContainer := s.GetContainerByName("server-vpp")
+ serverVclFileName := serverContainer.GetHostWorkDir() + "/vcl_srv.conf"
- clientContainer := s.getContainerByName("client-vpp")
- clientVclFileName := clientContainer.getHostWorkDir() + "/vcl_cln.conf"
+ clientContainer := s.GetContainerByName("client-vpp")
+ clientVclFileName := clientContainer.GetHostWorkDir() + "/vcl_cln.conf"
ldpreload := "LD_PRELOAD=../../build-root/build-vpp-native/vpp/lib/x86_64-linux-gnu/libvcl_ldpreload.so"
@@ -26,58 +27,58 @@ func LDPreloadIperfVppTest(s *VethsSuite) {
srvCh := make(chan error, 1)
clnCh := make(chan error)
- s.log("starting VPPs")
+ s.Log("starting VPPs")
clientAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/default",
- clientContainer.getHostWorkDir())
+ clientContainer.GetHostWorkDir())
err := clnVclConf.
- newStanza("vcl").
- append("rx-fifo-size 4000000").
- append("tx-fifo-size 4000000").
- append("app-scope-local").
- append("app-scope-global").
- append("use-mq-eventfd").
- append(clientAppSocketApi).close().
- saveToFile(clientVclFileName)
- s.assertNil(err, fmt.Sprint(err))
+ NewStanza("vcl").
+ Append("rx-fifo-size 4000000").
+ Append("tx-fifo-size 4000000").
+ Append("app-scope-local").
+ Append("app-scope-global").
+ Append("use-mq-eventfd").
+ Append(clientAppSocketApi).Close().
+ SaveToFile(clientVclFileName)
+ s.AssertNil(err, fmt.Sprint(err))
serverAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/default",
- serverContainer.getHostWorkDir())
+ serverContainer.GetHostWorkDir())
err = srvVclConf.
- newStanza("vcl").
- append("rx-fifo-size 4000000").
- append("tx-fifo-size 4000000").
- append("app-scope-local").
- append("app-scope-global").
- append("use-mq-eventfd").
- append(serverAppSocketApi).close().
- saveToFile(serverVclFileName)
- s.assertNil(err, fmt.Sprint(err))
-
- s.log("attaching server to vpp")
+ NewStanza("vcl").
+ Append("rx-fifo-size 4000000").
+ Append("tx-fifo-size 4000000").
+ Append("app-scope-local").
+ Append("app-scope-global").
+ Append("use-mq-eventfd").
+ Append(serverAppSocketApi).Close().
+ SaveToFile(serverVclFileName)
+ s.AssertNil(err, fmt.Sprint(err))
+
+ s.Log("attaching server to vpp")
srvEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+serverVclFileName)
go func() {
defer GinkgoRecover()
- s.startServerApp(srvCh, stopServerCh, srvEnv)
+ s.StartServerApp(srvCh, stopServerCh, srvEnv)
}()
err = <-srvCh
- s.assertNil(err, fmt.Sprint(err))
+ s.AssertNil(err, fmt.Sprint(err))
- s.log("attaching client to vpp")
+ s.Log("attaching client to vpp")
var clnRes = make(chan string, 1)
clnEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+clientVclFileName)
- serverVethAddress := s.getInterfaceByName(serverInterfaceName).ip4AddressString()
+ serverVethAddress := s.GetInterfaceByName(ServerInterfaceName).Ip4AddressString()
go func() {
defer GinkgoRecover()
- s.startClientApp(serverVethAddress, clnEnv, clnCh, clnRes)
+ s.StartClientApp(serverVethAddress, clnEnv, clnCh, clnRes)
}()
- s.log(<-clnRes)
+ s.Log(<-clnRes)
// wait for client's result
err = <-clnCh
- s.assertNil(err, fmt.Sprint(err))
+ s.AssertNil(err, fmt.Sprint(err))
// stop server
stopServerCh <- struct{}{}