d01a63abd4
- 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>
91 lines
2.2 KiB
Go
91 lines
2.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
. "fd.io/hs-test/infra"
|
|
. "github.com/onsi/ginkgo/v2"
|
|
)
|
|
|
|
func init() {
|
|
RegisterLdpTests(LDPreloadIperfVppTest, LDPreloadIperfVppInterruptModeTest, RedisBenchmarkTest)
|
|
}
|
|
|
|
func LDPreloadIperfVppInterruptModeTest(s *LdpSuite) {
|
|
LDPreloadIperfVppTest(s)
|
|
}
|
|
|
|
func LDPreloadIperfVppTest(s *LdpSuite) {
|
|
clientContainer := s.GetContainerByName("client-vpp")
|
|
serverContainer := s.GetContainerByName("server-vpp")
|
|
|
|
stopServerCh := make(chan struct{}, 1)
|
|
srvCh := make(chan error, 1)
|
|
clnCh := make(chan error)
|
|
clnRes := make(chan string, 1)
|
|
|
|
go func() {
|
|
defer GinkgoRecover()
|
|
cmd := "iperf3 -4 -s -p " + s.GetPortFromPpid()
|
|
s.StartServerApp(serverContainer, "iperf3", cmd, srvCh, stopServerCh)
|
|
}()
|
|
|
|
err := <-srvCh
|
|
s.AssertNil(err, fmt.Sprint(err))
|
|
|
|
serverVethAddress := s.GetInterfaceByName(ServerInterfaceName).Ip4AddressString()
|
|
go func() {
|
|
defer GinkgoRecover()
|
|
cmd := "iperf3 -c " + serverVethAddress + " -u -l 1460 -b 10g -p " + s.GetPortFromPpid()
|
|
s.StartClientApp(clientContainer, cmd, clnCh, clnRes)
|
|
}()
|
|
s.Log(<-clnRes)
|
|
|
|
// wait for client's result
|
|
err = <-clnCh
|
|
s.AssertNil(err, fmt.Sprint(err))
|
|
|
|
// 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{}{}
|
|
}
|