aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Tehlar <filip.tehlar@gmail.com>2023-04-15 20:41:18 +0200
committerFlorin Coras <florin.coras@gmail.com>2023-04-18 18:34:40 +0000
commit5811356a40e9637a761fd633cc6e38141a91716b (patch)
tree7e29439d0e6b91bfae79fa5e65ffbb076e7f80ef
parent206592bb731e6668d2b8f2e01479998cc1ec60d5 (diff)
hs-test: filter relevant data from perf tests output
Type: test Change-Id: I90faed91639ce1792646531cfc0cac649d737f16 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
-rw-r--r--extras/hs-test/http_test.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/extras/hs-test/http_test.go b/extras/hs-test/http_test.go
index 22f82c191a5..42eb0f055ea 100644
--- a/extras/hs-test/http_test.go
+++ b/extras/hs-test/http_test.go
@@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
+ "strings"
)
func (s *NsSuite) TestHttpTps() {
@@ -56,6 +57,16 @@ func (s *NoTopoSuite) TestNginxAsServer() {
s.assertNil(<-finished)
}
+func parseString(s, pattern string) string {
+ temp := strings.Split(s, "\n")
+ for _, item := range temp {
+ if strings.Contains(item, pattern) {
+ return item
+ }
+ }
+ return ""
+}
+
func runNginxPerf(s *NoTopoSuite, mode, ab_or_wrk string) error {
nRequests := 1000000
nClients := 2000
@@ -79,7 +90,8 @@ func runNginxPerf(s *NoTopoSuite, mode, ab_or_wrk string) error {
args += " http://" + serverAddress + ":80/64B.json"
abCont.extraRunningArgs = args
o, err := abCont.combinedOutput()
- s.log(o, err)
+ rps := parseString(o, "Requests per second:")
+ s.log(rps, err)
s.assertNil(err)
} else {
wrkCont := s.getContainerByName("wrk")
@@ -87,7 +99,8 @@ func runNginxPerf(s *NoTopoSuite, mode, ab_or_wrk string) error {
serverAddress)
wrkCont.extraRunningArgs = args
o, err := wrkCont.combinedOutput()
- s.log(o)
+ rps := parseString(o, "requests")
+ s.log(rps, err)
s.assertNil(err)
}
return nil