mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
tests: Restore runnerBackend.sh
(#4803)
* tests: Restore `runnerBackend.sh`
`runnerBackend.sh` was deleted in commit
7dae5e3db8
but plugins still need it
until their GitHub workflow definitions have been updated.
Co-authored-by: John McLear <john@mclear.co.uk>
This commit is contained in:
parent
7dae5e3db8
commit
8ef0860e8b
2 changed files with 48 additions and 1 deletions
|
@ -46,5 +46,5 @@ jobs:
|
||||||
- name: Run the backend tests
|
- name: Run the backend tests
|
||||||
run: cd src && npm test
|
run: cd src && npm test
|
||||||
|
|
||||||
##ETHERPAD_NPM_V=1
|
##ETHERPAD_NPM_V=2
|
||||||
## NPM configuration automatically created using src/bin/plugins/updateAllPluginsScript.sh
|
## NPM configuration automatically created using src/bin/plugins/updateAllPluginsScript.sh
|
||||||
|
|
47
src/tests/frontend/travis/runnerBackend.sh
Executable file
47
src/tests/frontend/travis/runnerBackend.sh
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
pecho() { printf %s\\n "$*"; }
|
||||||
|
log() { pecho "$@"; }
|
||||||
|
error() { log "ERROR: $@" >&2; }
|
||||||
|
fatal() { error "$@"; exit 1; }
|
||||||
|
try() { "$@" || fatal "'$@' failed"; }
|
||||||
|
|
||||||
|
# Move to the Etherpad base directory.
|
||||||
|
MY_DIR=$(try cd "${0%/*}" && try pwd -P) || exit 1
|
||||||
|
try cd "${MY_DIR}/../../../.."
|
||||||
|
|
||||||
|
try sed -e '
|
||||||
|
s!"soffice":[^,]*!"soffice": "/usr/bin/soffice"!
|
||||||
|
# Reduce rate limit aggressiveness
|
||||||
|
s!"max":[^,]*!"max": 100!
|
||||||
|
s!"points":[^,]*!"points": 1000!
|
||||||
|
' settings.json.template >settings.json
|
||||||
|
|
||||||
|
log "Deprecation notice: runnerBackend.sh - Please use: cd src && npm test"
|
||||||
|
log "Assuming src/bin/installDeps.sh has already been run"
|
||||||
|
node src/node/server.js "${@}" &
|
||||||
|
ep_pid=$!
|
||||||
|
|
||||||
|
log "Waiting for Etherpad to accept connections (http://localhost:9001)..."
|
||||||
|
connected=false
|
||||||
|
can_connect() {
|
||||||
|
curl -sSfo /dev/null http://localhost:9001/ || return 1
|
||||||
|
connected=true
|
||||||
|
}
|
||||||
|
now() { date +%s; }
|
||||||
|
start=$(now)
|
||||||
|
while [ $(($(now) - $start)) -le 15 ] && ! can_connect; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
[ "$connected" = true ] \
|
||||||
|
|| fatal "Timed out waiting for Etherpad to accept connections"
|
||||||
|
log "Successfully connected to Etherpad on http://localhost:9001"
|
||||||
|
|
||||||
|
log "Running the backend tests..."
|
||||||
|
try cd src
|
||||||
|
npm test
|
||||||
|
exit_code=$?
|
||||||
|
|
||||||
|
kill "$ep_pid" && wait "$ep_pid"
|
||||||
|
log "Done."
|
||||||
|
exit "$exit_code"
|
Loading…
Reference in a new issue