X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Fhs-test%2Fhttp_test.go;h=22f82c191a58fe23a6dc2a8b5b4e502c5abf13b5;hb=b41b0af609fce6fbe62b476f826a90bded9052ad;hp=310dc8331eede87e0583f37ec20c4e641c12555e;hpb=7c11156752abc32d3c1e7be4517a06aa7716d8d1;p=vpp.git 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 }