load test: Fix argument processing

This commit is contained in:
Richard Hansen 2022-03-22 20:05:08 -04:00
parent e4ed4a0d42
commit 4c6d547e10
1 changed files with 5 additions and 2 deletions

View File

@ -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"