hs-test: iperf improvements 94/43394/4
authorAdrian Villin <[email protected]>
Fri, 15 Aug 2025 12:52:53 +0000 (14:52 +0200)
committerFlorin Coras <[email protected]>
Mon, 18 Aug 2025 19:08:29 +0000 (19:08 +0000)
- added AssertIperfMinTransfer to KindIperfVclTest
- fixed 'make cleanup-perf'

Type: test

Change-Id: I50f7d837b1d4d842cb7464a5ee08cbecdea7adcd
Signed-off-by: Adrian Villin <[email protected]>
extras/hs-test/Makefile
extras/hs-test/infra/common/utils_common.go
extras/hs-test/kind_test.go
extras/hs-test/ldp_test.go

index bc52c22..902f3d9 100644 (file)
@@ -376,10 +376,10 @@ cleanup-perf:
        fi
        @echo "****************************"
        @echo "Removing kubernetes pods:"
-       @kubectl delete pods --all --grace-period=0 -n namespace$$(cat .last_hst_ppid)
+       @kubectl delete pods --all --grace-period=0 -n hs-test$$(cat .last_hst_ppid)
        @echo "****************************"
        @echo "Removing kubernetes namespace:"
-       @kubectl delete namespace namespace$$(cat .last_hst_ppid)
+       @kubectl delete namespace hs-test$$(cat .last_hst_ppid)
        @echo "****************************"
        @echo "Done."
        @echo "****************************"
index 5b3d718..15db60b 100644 (file)
@@ -66,6 +66,27 @@ type IPerfResult struct {
 
 func (s *HstCommon) ParseJsonIperfOutput(jsonResult []byte) IPerfResult {
        var result IPerfResult
+
+       // VCL/LDP debugging can pollute output so find the first occurrence of a curly brace to locate the start of JSON data
+       jsonStart := -1
+       jsonEnd := len(jsonResult)
+       braceCount := 0
+       for i := 0; i < len(jsonResult); i++ {
+               if jsonResult[i] == '{' {
+                       if jsonStart == -1 {
+                               jsonStart = i
+                       }
+                       braceCount++
+               } else if jsonResult[i] == '}' {
+                       braceCount--
+                       if braceCount == 0 {
+                               jsonEnd = i + 1
+                               break
+                       }
+               }
+       }
+       jsonResult = jsonResult[jsonStart:jsonEnd]
+
        // remove iperf warning line if present
        if strings.Contains(string(jsonResult), "warning") {
                index := strings.Index(string(jsonResult), "\n")
index 8039e6b..aaac1b5 100644 (file)
@@ -30,12 +30,15 @@ func KindIperfVclTest(s *KindSuite) {
        s.FixVersionNumber(s.Pods.ClientGeneric, s.Pods.ServerGeneric)
 
        o, err := s.Pods.ServerGeneric.Exec(ctx, []string{"/bin/bash", "-c",
-               vcl + " " + ldp + " iperf3 -s -D -4"})
+               vcl + " " + ldp + " iperf3 -s -D -4 -B " + s.Pods.ServerGeneric.IpAddress})
        s.AssertNil(err, o)
        o, err = s.Pods.ClientGeneric.Exec(ctx, []string{"/bin/bash", "-c",
-               vcl + " " + ldp + " iperf3 -l 1460 -b 10g -c " + s.Pods.ServerGeneric.IpAddress})
-       s.Log(o)
+               vcl + " " + ldp + " iperf3 -J -l 1460 -b 10g -c " + s.Pods.ServerGeneric.IpAddress})
+
        s.AssertNil(err)
+       result := s.ParseJsonIperfOutput([]byte(o))
+       s.LogJsonIperfOutput(result)
+       s.AssertIperfMinTransfer(result, 2000)
 }
 
 func NginxRpsTest(s *KindSuite) {
index 1c057b0..b0c6276 100644 (file)
@@ -117,25 +117,7 @@ func ldPreloadIperf(s *LdpSuite, extraClientArgs string) IPerfResult {
 
        s.AssertChannelClosed(time.Minute*4, clnCh)
        output := <-clnRes
-       // VCL/LDP debugging can pollute output so find the first occurrence of a curly brace to locate the start of JSON data
-       jsonStart := -1
-       jsonEnd := len(output)
-       braceCount := 0
-       for i := 0; i < len(output); i++ {
-               if output[i] == '{' {
-                       if jsonStart == -1 {
-                               jsonStart = i
-                       }
-                       braceCount++
-               } else if output[i] == '}' {
-                       braceCount--
-                       if braceCount == 0 {
-                               jsonEnd = i + 1
-                               break
-                       }
-               }
-       }
-       result := s.ParseJsonIperfOutput(output[jsonStart:jsonEnd])
+       result := s.ParseJsonIperfOutput(output)
        s.LogJsonIperfOutput(result)
 
        return result