hs-test: revert "hs-test: run iperf server as daemon" 66/43766/2
authorAdrian Villin <[email protected]>
Wed, 8 Oct 2025 15:13:45 +0000 (11:13 -0400)
committerDave Wallace <[email protected]>
Wed, 8 Oct 2025 18:07:26 +0000 (18:07 +0000)
LdpIperfUdpReorderTest times out.
This reverts commit 9eabaece3d6a709ed55c695ad04623c4e1c8bf80.

Type: test

Change-Id: I9ae95357f91f2cbf8ce96fb42388c6da5bd3d8b9
Signed-off-by: Adrian Villin <[email protected]>
test-c/hs-test/iperf_linux_test.go
test-c/hs-test/ldp_test.go
test-c/hs-test/proxy_test.go

index be2ee64..0505f64 100644 (file)
@@ -2,8 +2,10 @@ package main
 
 import (
        "fmt"
+       "time"
 
        . "fd.io/hs-test/infra"
+       . "github.com/onsi/ginkgo/v2"
 )
 
 func init() {
@@ -14,18 +16,33 @@ func IperfUdpLinuxTest(s *IperfSuite) {
        serverIpAddress := s.Interfaces.Server.Ip4AddressString()
        clientIpAddress := s.Interfaces.Client.Ip4AddressString()
 
-       cmd := fmt.Sprintf("iperf3 -4 -s -1 -D -B %s -p %s --logfile %s",
-               serverIpAddress, s.Ports.Port1, s.IperfLogFileName(s.Containers.Server))
-       o, err := s.Containers.Server.Exec(false, cmd)
-       s.AssertNil(err, o)
-       s.Log("server running")
+       clnCh := make(chan error)
+       stopServerCh := make(chan struct{})
+       srvCh := make(chan error, 1)
+       clnRes := make(chan []byte, 1)
+
+       defer func() {
+               stopServerCh <- struct{}{}
+       }()
 
-       cmd = "iperf3 -c " + serverIpAddress + " -B " + clientIpAddress +
-               " -u -l 1460 -b 10g -J -p " + s.Ports.Port1
-       o, err = s.Containers.Client.Exec(false, cmd)
+       go func() {
+               defer GinkgoRecover()
+               cmd := "iperf3 -4 -s -B " + serverIpAddress + " -p " + s.Ports.Port1
+               s.StartServerApp(s.Containers.Server, "iperf3", cmd, srvCh, stopServerCh)
+       }()
+       err := <-srvCh
+       s.AssertNil(err, fmt.Sprint(err))
+       s.Log("server running")
 
-       s.AssertNil(err, o)
-       result := s.ParseJsonIperfOutput([]byte(o))
+       go func() {
+               defer GinkgoRecover()
+               cmd := "iperf3 -c " + serverIpAddress + " -B " + clientIpAddress +
+                       " -u -l 1460 -b 10g -J -p " + s.Ports.Port1
+               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, 400)
 }
index 737e9b5..94abafc 100644 (file)
@@ -90,17 +90,33 @@ func LdpIperfUdpTest(s *LdpSuite) {
 
 func ldPreloadIperf(s *LdpSuite, extraClientArgs string) IPerfResult {
        serverVethAddress := s.Interfaces.Server.Ip4AddressString()
+       stopServerCh := make(chan struct{}, 1)
+       srvCh := make(chan error, 1)
+       clnCh := make(chan error)
+       clnRes := make(chan []byte, 1)
 
-       cmd := fmt.Sprintf("sh -c \"iperf3 -4 -s -1 -D -B %s -p %s --logfile %s\"",
-               serverVethAddress, s.Ports.Port1, s.IperfLogFileName(s.Containers.ServerApp))
-       o, err := s.Containers.ServerApp.Exec(true, cmd)
-       s.AssertNil(err, o)
+       defer func() {
+               stopServerCh <- struct{}{}
+       }()
 
-       cmd = fmt.Sprintf("iperf3 -c %s -B %s -l 1460 -b 10g -J -p %s %s", serverVethAddress, s.Interfaces.Client.Ip4AddressString(), s.Ports.Port1, extraClientArgs)
-       o, err = s.Containers.ClientApp.Exec(true, cmd)
+       go func() {
+               defer GinkgoRecover()
+               cmd := fmt.Sprintf("sh -c \"iperf3 -4 -s -B %s -p %s > %s 2>&1\"", serverVethAddress, s.Ports.Port1, s.IperfLogFileName(s.Containers.ServerApp))
+               s.StartServerApp(s.Containers.ServerApp, "iperf3", cmd, srvCh, stopServerCh)
+       }()
+
+       err := <-srvCh
+       s.AssertNil(err, fmt.Sprint(err))
+
+       go func() {
+               defer GinkgoRecover()
+               cmd := fmt.Sprintf("iperf3 -c %s -B %s -l 1460 -b 10g -J -p %s %s", serverVethAddress, s.Interfaces.Client.Ip4AddressString(), s.Ports.Port1, extraClientArgs)
+               s.StartClientApp(s.Containers.ClientApp, cmd, clnCh, clnRes)
+       }()
 
-       s.AssertNil(err, o)
-       result := s.ParseJsonIperfOutput([]byte(o))
+       s.AssertChannelClosed(time.Minute*4, clnCh)
+       output := <-clnRes
+       result := s.ParseJsonIperfOutput(output)
        s.LogJsonIperfOutput(result)
 
        return result
index 53d2ae4..5d9fc38 100644 (file)
@@ -70,19 +70,32 @@ func vppProxyIperfMWTest(s *VppProxySuite, proto string) {
                proto = ""
        }
 
-       cmd := fmt.Sprintf("iperf3 -4 -s -1 -D -B %s -p %s --logfile %s",
-               s.ServerAddr(), fmt.Sprint(s.Ports.Server), s.IperfLogFileName(s.Containers.IperfS))
-       o, err := s.Containers.IperfS.Exec(true, cmd)
+       stopServerCh := make(chan struct{}, 1)
+       srvCh := make(chan error, 1)
+       clnCh := make(chan error)
+       clnRes := make(chan []byte, 1)
 
-       s.AssertNil(err, o)
+       defer func() {
+               stopServerCh <- struct{}{}
+       }()
+
+       go func() {
+               defer GinkgoRecover()
+               cmd := fmt.Sprintf("iperf3 -4 -s -B %s -p %s --logfile %s", s.ServerAddr(), fmt.Sprint(s.Ports.Server), s.IperfLogFileName(s.Containers.IperfS))
+               s.StartServerApp(s.Containers.IperfS, "iperf3", cmd, srvCh, stopServerCh)
+       }()
 
-       cmd = fmt.Sprintf("iperf3 -c %s -P 4 -l 1460 -b 10g -J -p %d -B %s %s",
-               s.VppProxyAddr(), s.Ports.Proxy, s.ClientAddr(), proto)
+       err := <-srvCh
+       s.AssertNil(err, fmt.Sprint(err))
 
-       o, err = s.Containers.IperfC.Exec(true, cmd)
+       go func() {
+               defer GinkgoRecover()
+               cmd := fmt.Sprintf("iperf3 -c %s -P 4 -l 1460 -b 10g -J -p %d -B %s %s", s.VppProxyAddr(), s.Ports.Proxy, s.ClientAddr(), proto)
+               s.StartClientApp(s.Containers.IperfC, cmd, clnCh, clnRes)
+       }()
 
-       s.AssertNil(err, o)
-       result := s.ParseJsonIperfOutput([]byte(o))
+       s.AssertChannelClosed(time.Minute*4, clnCh)
+       result := s.ParseJsonIperfOutput(<-clnRes)
        s.LogJsonIperfOutput(result)
        s.AssertIperfMinTransfer(result, 200)
 }
@@ -790,10 +803,21 @@ func VppConnectProxyIperfTcpTest(s *MasqueSuite) {
        s.ProxyClientConnect("tcp", s.Ports.Nginx)
        clientVpp := s.Containers.VppClient.VppInstance
 
-       c := fmt.Sprintf("iperf3 -s -1 -D -B %s -p %s --logfile %s",
-               s.NginxAddr(), s.Ports.Nginx, s.IperfLogFileName(s.Containers.IperfServer))
-       o, err := s.Containers.IperfServer.Exec(true, c)
-       s.AssertNil(err, o)
+       stopServerCh := make(chan struct{})
+       srvCh := make(chan error, 1)
+
+       defer func() {
+               stopServerCh <- struct{}{}
+       }()
+
+       go func() {
+               defer GinkgoRecover()
+               c := "iperf3 -s -B " + s.NginxAddr() + " -p " + s.Ports.Nginx
+               s.StartServerApp(s.Containers.IperfServer, "iperf3", c, srvCh, stopServerCh)
+       }()
+       err := <-srvCh
+       s.AssertNil(err, fmt.Sprint(err))
+       s.Log("server running")
 
        finished := make(chan error, 1)
        go func() {
@@ -810,13 +834,24 @@ func VppConnectProxyIperfUdpTest(s *MasqueSuite) {
        // test listen all, we are running solo anyway
        s.ProxyClientConnect("udp", "0")
        clientVpp := s.Containers.VppClient.VppInstance
-       cmd := "http connect proxy client listener add listener tcp://0.0.0.0:0"
+       cmd := fmt.Sprintf("http connect proxy client listener add listener tcp://0.0.0.0:0")
        s.Log(clientVpp.Vppctl(cmd))
 
-       c := fmt.Sprintf("iperf3 -s -1 -D -B %s -p %s --logfile %s",
-               s.NginxAddr(), s.Ports.Nginx, s.IperfLogFileName(s.Containers.IperfServer))
-       o, err := s.Containers.IperfServer.Exec(true, c)
-       s.AssertNil(err, o)
+       stopServerCh := make(chan struct{})
+       srvCh := make(chan error, 1)
+
+       defer func() {
+               stopServerCh <- struct{}{}
+       }()
+
+       go func() {
+               defer GinkgoRecover()
+               c := "iperf3 -s -B " + s.NginxAddr() + " -p " + s.Ports.Nginx
+               s.StartServerApp(s.Containers.IperfServer, "iperf3", c, srvCh, stopServerCh)
+       }()
+       err := <-srvCh
+       s.AssertNil(err, fmt.Sprint(err))
+       s.Log("server running")
 
        finished := make(chan error, 1)
        go func() {
@@ -843,7 +878,7 @@ func VppConnectProxyIperfUdpMWTest(s *MasqueSuite) {
        VppConnectProxyIperfUdpTest(s)
        clientVpp := s.Containers.VppClient.VppInstance
        closed := false
-       for range 60 {
+       for nTries := 0; nTries < 60; nTries++ {
                o := clientVpp.Vppctl("show http connect proxy client sessions")
                if !strings.Contains(o, "] tcp ") {
                        closed = true