summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/http_test.go
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2023-03-20 12:39:20 +0100
committerFlorin Coras <florin.coras@gmail.com>2023-03-29 04:43:40 +0000
commitb41b0af609fce6fbe62b476f826a90bded9052ad (patch)
treea67b24867b9651df3d4c6ed71115f1322a294ec5 /extras/hs-test/http_test.go
parent7c11156752abc32d3c1e7be4517a06aa7716d8d1 (diff)
hs-test: containerize ab and wrk
Type: test Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I66af84257fa0692d9be3445d49b52fb7ca810d27
Diffstat (limited to 'extras/hs-test/http_test.go')
-rw-r--r--extras/hs-test/http_test.go45
1 files changed, 21 insertions, 24 deletions
diff --git a/extras/hs-test/http_test.go b/extras/hs-test/http_test.go
index 310dc8331ee..22f82c191a5 100644
--- a/extras/hs-test/http_test.go
+++ b/extras/hs-test/http_test.go
@@ -3,7 +3,6 @@ package main
import (
"fmt"
"os"
- "os/exec"
)
func (s *NsSuite) TestHttpTps() {
@@ -60,39 +59,37 @@ func (s *NoTopoSuite) TestNginxAsServer() {
func runNginxPerf(s *NoTopoSuite, mode, ab_or_wrk string) error {
nRequests := 1000000
nClients := 2000
- var args []string
- var exeName string
serverAddress := s.netInterfaces[tapInterfaceName].peer.ip4AddressString()
+ vpp := s.getContainerByName("vpp").vppInstance
+
+ nginxCont := s.getContainerByName("nginx")
+ s.assertNil(nginxCont.run())
+ vpp.waitForApp("nginx-", 5)
+
if ab_or_wrk == "ab" {
- args = []string{"-n", fmt.Sprintf("%d", nRequests), "-c",
- fmt.Sprintf("%d", nClients)}
+ abCont := s.getContainerByName("ab")
+ args := fmt.Sprintf("-n %d -c %d", nRequests, nClients)
if mode == "rps" {
- args = append(args, "-k")
+ args += " -k"
} else if mode != "cps" {
return fmt.Errorf("invalid mode %s; expected cps/rps", mode)
}
- args = append(args, "http://"+serverAddress+":80/64B.json")
- exeName = "ab"
+ args += " http://" + serverAddress + ":80/64B.json"
+ abCont.extraRunningArgs = args
+ o, err := abCont.combinedOutput()
+ s.log(o, err)
+ s.assertNil(err)
} else {
- args = []string{"-c", fmt.Sprintf("%d", nClients), "-t", "2", "-d", "30",
- "http://" + serverAddress + ":80/64B.json"}
- exeName = "wrk"
+ wrkCont := s.getContainerByName("wrk")
+ args := fmt.Sprintf("-c %d -t 2 -d 30 http://%s:80/64B.json", nClients,
+ serverAddress)
+ wrkCont.extraRunningArgs = args
+ o, err := wrkCont.combinedOutput()
+ s.log(o)
+ s.assertNil(err)
}
-
- vpp := s.getContainerByName("vpp").vppInstance
-
- nginxCont := s.getContainerByName("nginx")
- s.assertNil(nginxCont.run())
- vpp.waitForApp("nginx-", 5)
-
- cmd := exec.Command(exeName, args...)
- s.log(cmd)
- o, err := cmd.CombinedOutput()
- s.log(string(o))
- s.assertNil(err)
- s.assertNotEmpty(o)
return nil
}