From 4c6d547e10240e33c3130899d78308ff1e089dc4 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 22 Mar 2022 20:05:08 -0400 Subject: [PATCH] load test: Fix argument processing --- src/tests/frontend/travis/runnerLoadTest.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tests/frontend/travis/runnerLoadTest.sh b/src/tests/frontend/travis/runnerLoadTest.sh index d28d20e66..db186ce55 100755 --- a/src/tests/frontend/travis/runnerLoadTest.sh +++ b/src/tests/frontend/travis/runnerLoadTest.sh @@ -8,6 +8,9 @@ error() { log "ERROR: $@" >&2; } fatal() { error "$@"; exit 1; } try() { "$@" || fatal "'$@' failed"; } +[ -n "$1" ] && [ "$1" -gt 0 ] || fatal "no duration specified" +[ -n "$2" ] && [ "$2" -gt 0 ] || fatal "no authors specified" + # Move to the Etherpad base directory. MY_DIR=$(try cd "${0%/*}" && try pwd -P) || exit 1 try cd "${MY_DIR}/../../../.." @@ -19,7 +22,7 @@ s!"points":[^,]*!"points": 1000! ' settings.json.template >settings.json log "Assuming src/bin/installDeps.sh has already been run" -node src/node/server.js "${@}" >/dev/null & +node src/node/server.js >/dev/null & ep_pid=$! log "Waiting for Etherpad to accept connections (http://localhost:9001)..." @@ -46,7 +49,7 @@ sleep 10 log "Running the load tests..." # -d is duration of test, -a is number of authors to test with # by specifying the number of authors we set the overall rate of messages -etherpad-loadtest -d $1 -a $2 +etherpad-loadtest -d "$1" -a "$2" exit_code=$? kill "$ep_pid" && wait "$ep_pid"