hs-test: add tests repeat option
[vpp.git] / extras / hs-test / linux_iperf_test.go
1 package main
2
3 import (
4         "fmt"
5
6         . "github.com/onsi/ginkgo/v2"
7 )
8
9 func init() {
10         registerTapTests(LinuxIperfTest)
11 }
12
13 func LinuxIperfTest(s *TapSuite) {
14         clnCh := make(chan error)
15         stopServerCh := make(chan struct{})
16         srvCh := make(chan error, 1)
17         clnRes := make(chan string, 1)
18         defer func() {
19                 stopServerCh <- struct{}{}
20         }()
21
22         go func() {
23                 defer GinkgoRecover()
24                 s.startServerApp(srvCh, stopServerCh, nil)
25         }()
26         err := <-srvCh
27         s.assertNil(err, fmt.Sprint(err))
28         s.log("server running")
29
30         ipAddress := s.getInterfaceByName(tapInterfaceName).ip4AddressString()
31         go func() {
32                 defer GinkgoRecover()
33                 s.startClientApp(ipAddress, nil, clnCh, clnRes)
34         }()
35         s.log("client running")
36         s.log(<-clnRes)
37         err = <-clnCh
38         s.assertNil(err, "err: '%s', ip: '%s'", err, ipAddress)
39         s.log("Test completed")
40 }