514098ee82
- fixed timed out/panicked tests not copying logs to CI archives - fixed log formatting - renamed SuiteTimeout to TestTimeout - fixed ginkgo node leak on test timeout -> added AssertChannelClosed - updated docs Type: test Change-Id: Ia71d765bd61576230a4cfd26d4b14fd1be1692c7 Signed-off-by: Adrian Villin <avillin@cisco.com>
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
. "fd.io/hs-test/infra"
|
|
. "github.com/onsi/ginkgo/v2"
|
|
)
|
|
|
|
func init() {
|
|
RegisterIperfTests(IperfLinuxTest)
|
|
}
|
|
|
|
func IperfLinuxTest(s *IperfSuite) {
|
|
serverContainer := s.GetContainerByName(ServerIperfContainerName)
|
|
serverIpAddress := s.GetInterfaceByName(ServerIperfInterfaceName).Ip4AddressString()
|
|
clientContainer := s.GetContainerByName(ClientIperfContainerName)
|
|
clientIpAddress := s.GetInterfaceByName(ClientIperfInterfaceName).Ip4AddressString()
|
|
|
|
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()
|
|
cmd := "iperf3 -4 -s -B " + serverIpAddress + " -p " + s.GetPortFromPpid()
|
|
s.StartServerApp(serverContainer, "iperf3", cmd, srvCh, stopServerCh)
|
|
}()
|
|
err := <-srvCh
|
|
s.AssertNil(err, fmt.Sprint(err))
|
|
s.Log("server running")
|
|
|
|
go func() {
|
|
defer GinkgoRecover()
|
|
cmd := "iperf3 -c " + serverIpAddress + " -B " + clientIpAddress +
|
|
" -u -l 1460 -b 10g -p " + s.GetPortFromPpid()
|
|
s.StartClientApp(clientContainer, cmd, clnCh, clnRes)
|
|
}()
|
|
s.AssertChannelClosed(time.Minute*3, clnCh)
|
|
s.Log(<-clnRes)
|
|
}
|