hs-test: check for missing output in nginx tests 83/38283/3
authorMaros Ondrejicka <mondreji@cisco.com>
Wed, 15 Feb 2023 16:44:46 +0000 (17:44 +0100)
committerFlorin Coras <florin.coras@gmail.com>
Thu, 16 Feb 2023 16:26:42 +0000 (16:26 +0000)
Type: test
Signed-off-by: Maros Ondrejicka <mondreji@cisco.com>
Change-Id: I08cd492fff4b9d50a1761a29c2b231cc8544313b

extras/hs-test/Makefile
extras/hs-test/hst_suite.go
extras/hs-test/http_test.go
extras/hs-test/script/build.sh

index 2bb6db9..f9c111e 100644 (file)
@@ -1,5 +1,8 @@
 all: build docker
 
+install-dep:
+       apt update -y && apt install -y apache2-utils wrk
+
 build:
        go build ./tools/http_server
 
index 286536d..9cd9aea 100644 (file)
@@ -105,6 +105,12 @@ func (s *HstSuite) assertNotContains(testString, contains interface{}, msgAndArg
        }
 }
 
+func (s *HstSuite) assertNotEmpty(object interface{}, msgAndArgs ...interface{}) {
+       if !assert.NotEmpty(s.T(), object, msgAndArgs...) {
+               s.hstFail()
+       }
+}
+
 func (s *HstSuite) log(args ...any) {
        if IsVerbose() {
                s.T().Log(args...)
index 5e88fe0..df4b012 100644 (file)
@@ -93,6 +93,7 @@ func runNginxPerf(s *NoTopoSuite, mode, ab_or_wrk string) error {
        s.log(cmd)
        o, _ := cmd.CombinedOutput()
        s.log(string(o))
+       s.assertNotEmpty(o)
        return nil
 }
 
index f52025c..0fc49bb 100755 (executable)
@@ -5,6 +5,18 @@ if [ $(lsb_release -is) != Ubuntu ]; then
        exit 1
 fi
 
+if [ -z $(which ab) ]; then
+       echo "Host stack test framework requires apache2-utils to be installed"
+       echo "It is recommended to run 'sudo make install-dep'"
+       exit 1
+fi
+
+if [ -z $(which wrk) ]; then
+       echo "Host stack test framework requires wrk to be installed"
+       echo "It is recommended to run 'sudo make install-dep'"
+       exit 1
+fi
+
 source vars
 
 bin=vpp-data/bin