Files
vpp/extras/hs-test/linux_iperf_test.go
Adrian Villin 4677d920c0 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>
2024-06-14 18:10:26 +00:00

41 lines
821 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.StartServerApp(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.StartClientApp(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")
}