Files
vpp/extras/hs-test/iperf_linux_test.go
Adrian Villin af5fcbfa71 hs-test: replaced container/interface getter func
- replaced s.GetContainerByName("xyz") with s.Containers.Xyz in tests
  and suites
- same thing for interfaces
- each suite has its own structs with containers/interfaces
- structs are initialized in SetupSuite

Type: test

Change-Id: I5bd99605b40921b7b8c844e8650f6fb0915e9e99
Signed-off-by: Adrian Villin <avillin@cisco.com>
2024-12-11 17:47:04 +00:00

49 lines
1.1 KiB
Go

package main
import (
"fmt"
"time"
. "fd.io/hs-test/infra"
. "github.com/onsi/ginkgo/v2"
)
func init() {
RegisterIperfTests(IperfUdpLinuxTest)
}
func IperfUdpLinuxTest(s *IperfSuite) {
serverIpAddress := s.Interfaces.Server.Ip4AddressString()
clientIpAddress := s.Interfaces.Client.Ip4AddressString()
clnCh := make(chan error)
stopServerCh := make(chan struct{})
srvCh := make(chan error, 1)
clnRes := make(chan []byte, 1)
defer func() {
stopServerCh <- struct{}{}
}()
go func() {
defer GinkgoRecover()
cmd := "iperf3 -4 -s -B " + serverIpAddress + " -p " + s.GetPortFromPpid()
s.StartServerApp(s.Containers.Server, "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 -J -p " + s.GetPortFromPpid()
s.StartClientApp(s.Containers.Client, cmd, clnCh, clnRes)
}()
s.AssertChannelClosed(time.Minute*3, clnCh)
output := <-clnRes
result := s.ParseJsonIperfOutput(output)
s.LogJsonIperfOutput(result)
s.AssertIperfMinTransfer(result, 800)
}