aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/ldp_test.go
diff options
context:
space:
mode:
authorAdrian Villin <avillin@cisco.com>2024-08-15 12:53:53 +0200
committerFlorin Coras <florin.coras@gmail.com>2024-08-27 19:05:36 +0000
commitd01a63abd41dfd2359e18ca559a0309cfe8c0018 (patch)
treeef20ad4da2b6645a1f82bc8cf092c59dc63d3527 /extras/hs-test/ldp_test.go
parenta647a83496f81a83c02fe9317955a781b7f95d8c (diff)
hs-test: added a redis-benchmark test
- basically a copy of LdpIperf test - small update of LdpIperf test - new LDP suite Type: test Change-Id: I3f8653288c6fc6dfd6a061315e983c000974d3ff 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.go104
1 files changed, 50 insertions, 54 deletions
diff --git a/extras/hs-test/ldp_test.go b/extras/hs-test/ldp_test.go
index e9e8bba9274..03636b11191 100644
--- a/extras/hs-test/ldp_test.go
+++ b/extras/hs-test/ldp_test.go
@@ -2,86 +2,42 @@ package main
import (
"fmt"
- "os"
. "fd.io/hs-test/infra"
. "github.com/onsi/ginkgo/v2"
)
func init() {
- RegisterVethTests(LDPreloadIperfVppTest, LDPreloadIperfVppInterruptModeTest)
+ RegisterLdpTests(LDPreloadIperfVppTest, LDPreloadIperfVppInterruptModeTest, RedisBenchmarkTest)
}
-func LDPreloadIperfVppInterruptModeTest(s *VethsSuite) {
+func LDPreloadIperfVppInterruptModeTest(s *LdpSuite) {
LDPreloadIperfVppTest(s)
}
-func LDPreloadIperfVppTest(s *VethsSuite) {
- var clnVclConf, srvVclConf Stanza
- var ldpreload string
-
- serverContainer := s.GetContainerByName("server-vpp")
- serverVclFileName := serverContainer.GetHostWorkDir() + "/vcl_srv.conf"
-
+func LDPreloadIperfVppTest(s *LdpSuite) {
clientContainer := s.GetContainerByName("client-vpp")
- clientVclFileName := clientContainer.GetHostWorkDir() + "/vcl_cln.conf"
-
- if *IsDebugBuild {
- ldpreload = "LD_PRELOAD=../../build-root/build-vpp_debug-native/vpp/lib/x86_64-linux-gnu/libvcl_ldpreload.so"
- } else {
- ldpreload = "LD_PRELOAD=../../build-root/build-vpp-native/vpp/lib/x86_64-linux-gnu/libvcl_ldpreload.so"
- }
+ serverContainer := s.GetContainerByName("server-vpp")
stopServerCh := make(chan struct{}, 1)
srvCh := make(chan error, 1)
clnCh := make(chan error)
+ clnRes := make(chan string, 1)
- s.Log("starting VPPs")
-
- clientAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/default",
- 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))
-
- serverAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/default",
- 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")
-
- srvEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+serverVclFileName)
go func() {
defer GinkgoRecover()
- s.StartServerApp(srvCh, stopServerCh, srvEnv)
+ cmd := "iperf3 -4 -s -p " + s.GetPortFromPpid()
+ s.StartServerApp(serverContainer, "iperf3", cmd, srvCh, stopServerCh)
}()
- err = <-srvCh
+ err := <-srvCh
s.AssertNil(err, fmt.Sprint(err))
- 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()
go func() {
defer GinkgoRecover()
- s.StartClientApp(serverVethAddress, clnEnv, clnCh, clnRes)
+ cmd := "iperf3 -c " + serverVethAddress + " -u -l 1460 -b 10g -p " + s.GetPortFromPpid()
+ s.StartClientApp(clientContainer, cmd, clnCh, clnRes)
}()
s.Log(<-clnRes)
@@ -92,3 +48,43 @@ func LDPreloadIperfVppTest(s *VethsSuite) {
// stop server
stopServerCh <- struct{}{}
}
+
+func RedisBenchmarkTest(s *LdpSuite) {
+ s.SkipIfMultiWorker()
+
+ serverContainer := s.GetContainerByName("server-vpp")
+ clientContainer := s.GetContainerByName("client-vpp")
+
+ serverVethAddress := s.GetInterfaceByName(ServerInterfaceName).Ip4AddressString()
+ runningSrv := make(chan error)
+ doneSrv := make(chan struct{})
+ clnCh := make(chan error)
+ clnRes := make(chan string, 1)
+
+ go func() {
+ defer GinkgoRecover()
+ cmd := "redis-server --daemonize yes --protected-mode no --bind " + serverVethAddress
+ s.StartServerApp(serverContainer, "redis-server", cmd, runningSrv, doneSrv)
+ }()
+
+ err := <-runningSrv
+ s.AssertNil(err)
+
+ go func() {
+ defer GinkgoRecover()
+ var cmd string
+ if *NConfiguredCpus == 1 {
+ cmd = "redis-benchmark --threads 1 -h " + serverVethAddress
+ } else {
+ cmd = "redis-benchmark --threads " + fmt.Sprint(*NConfiguredCpus) + "-h " + serverVethAddress
+ }
+ s.StartClientApp(clientContainer, cmd, clnCh, clnRes)
+ }()
+
+ s.Log(<-clnRes)
+ // wait for client's result
+ err = <-clnCh
+ s.AssertNil(err, fmt.Sprint(err))
+ // stop server
+ doneSrv <- struct{}{}
+}