Files
vpp/extras/hs-test/linux_iperf_test.go
Adrian Villin d01a63abd4 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>
2024-08-27 19:05:36 +00:00

41 lines
831 B
Go

package main
import (
. "fd.io/hs-test/infra"
"fmt"
. "github.com/onsi/ginkgo/v2"
)
func init() {
RegisterTapTests(LinuxIperfTest)
}
func LinuxIperfTest(s *TapSuite) {
clnCh := make(chan error)
stopServerCh := make(chan struct{})
srvCh := make(chan error, 1)
clnRes := make(chan string, 1)
defer func() {
stopServerCh <- struct{}{}
}()
go func() {
defer GinkgoRecover()
s.StartIperfServerApp(srvCh, stopServerCh, nil)
}()
err := <-srvCh
s.AssertNil(err, fmt.Sprint(err))
s.Log("server running")
ipAddress := s.GetInterfaceByName(TapInterfaceName).Ip4AddressString()
go func() {
defer GinkgoRecover()
s.StartIperfClientApp(ipAddress, nil, clnCh, clnRes)
}()
s.Log("client running")
s.Log(<-clnRes)
err = <-clnCh
s.AssertNil(err, "err: '%s', ip: '%s'", err, ipAddress)
s.Log("Test completed")
}