2020-11-21 00:19:39 +00:00
|
|
|
#!/bin/sh
|
2012-11-01 22:17:31 +00:00
|
|
|
|
2020-11-21 00:19:39 +00:00
|
|
|
pecho() { printf %s\\n "$*"; }
|
|
|
|
log() { pecho "$@"; }
|
|
|
|
error() { log "ERROR: $@" >&2; }
|
|
|
|
fatal() { error "$@"; exit 1; }
|
|
|
|
try() { "$@" || fatal "'$@' failed"; }
|
2012-11-01 22:17:31 +00:00
|
|
|
|
2020-11-21 00:19:39 +00:00
|
|
|
[ -n "${SAUCE_USERNAME}" ] || fatal "SAUCE_USERNAME is unset - exiting"
|
|
|
|
[ -n "${SAUCE_ACCESS_KEY}" ] || fatal "SAUCE_ACCESS_KEY is unset - exiting"
|
|
|
|
|
|
|
|
MY_DIR=$(try cd "${0%/*}" && try pwd) || exit 1
|
2012-11-01 22:17:31 +00:00
|
|
|
|
tests: future proof travis/runner.sh and make it more robust
This change only slightly modifies the bahaviour of travis/runner.sh, but:
1. speeds up the tests, because it does not install dependencies before running
them. Dependencies are already installed by .travis.yml in its "install"
section;
2. if for some reason Etherpad does not start, there is a sudden failure,
instead of launching the front end tests anyway, and then having to wait 10
minutes for them to time out;
3. it is compatible with a different way of installing etherpad dependencies
("npm ci" instead of "npm install"), whereas the previous one broke. This
will probably be introduced in a while, so this change future-proofs for it
(see #3778).
4. it is more robust, because it detects more reliably the paths, and changes
between them correctly;
Please note that the script now requires bash instead of a generic posix shell.
This may break on platforms which default to a different shell (FreeBSD, MacOS?)
2020-03-29 20:32:54 +00:00
|
|
|
# reliably move to the etherpad base folder before running it
|
2020-11-21 00:19:39 +00:00
|
|
|
try cd "${MY_DIR}/../../../"
|
tests: future proof travis/runner.sh and make it more robust
This change only slightly modifies the bahaviour of travis/runner.sh, but:
1. speeds up the tests, because it does not install dependencies before running
them. Dependencies are already installed by .travis.yml in its "install"
section;
2. if for some reason Etherpad does not start, there is a sudden failure,
instead of launching the front end tests anyway, and then having to wait 10
minutes for them to time out;
3. it is compatible with a different way of installing etherpad dependencies
("npm ci" instead of "npm install"), whereas the previous one broke. This
will probably be introduced in a while, so this change future-proofs for it
(see #3778).
4. it is more robust, because it detects more reliably the paths, and changes
between them correctly;
Please note that the script now requires bash instead of a generic posix shell.
This may break on platforms which default to a different shell (FreeBSD, MacOS?)
2020-03-29 20:32:54 +00:00
|
|
|
|
2020-11-21 00:19:39 +00:00
|
|
|
log "Assuming bin/installDeps.sh has already been run"
|
2020-10-06 13:21:09 +00:00
|
|
|
node node_modules/ep_etherpad-lite/node/server.js --experimental-worker "${@}" &
|
2020-11-10 05:59:50 +00:00
|
|
|
ep_pid=$!
|
tests: future proof travis/runner.sh and make it more robust
This change only slightly modifies the bahaviour of travis/runner.sh, but:
1. speeds up the tests, because it does not install dependencies before running
them. Dependencies are already installed by .travis.yml in its "install"
section;
2. if for some reason Etherpad does not start, there is a sudden failure,
instead of launching the front end tests anyway, and then having to wait 10
minutes for them to time out;
3. it is compatible with a different way of installing etherpad dependencies
("npm ci" instead of "npm install"), whereas the previous one broke. This
will probably be introduced in a while, so this change future-proofs for it
(see #3778).
4. it is more robust, because it detects more reliably the paths, and changes
between them correctly;
Please note that the script now requires bash instead of a generic posix shell.
This may break on platforms which default to a different shell (FreeBSD, MacOS?)
2020-03-29 20:32:54 +00:00
|
|
|
|
2020-11-21 00:19:39 +00:00
|
|
|
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"
|
tests: future proof travis/runner.sh and make it more robust
This change only slightly modifies the bahaviour of travis/runner.sh, but:
1. speeds up the tests, because it does not install dependencies before running
them. Dependencies are already installed by .travis.yml in its "install"
section;
2. if for some reason Etherpad does not start, there is a sudden failure,
instead of launching the front end tests anyway, and then having to wait 10
minutes for them to time out;
3. it is compatible with a different way of installing etherpad dependencies
("npm ci" instead of "npm install"), whereas the previous one broke. This
will probably be introduced in a while, so this change future-proofs for it
(see #3778).
4. it is more robust, because it detects more reliably the paths, and changes
between them correctly;
Please note that the script now requires bash instead of a generic posix shell.
This may break on platforms which default to a different shell (FreeBSD, MacOS?)
2020-03-29 20:32:54 +00:00
|
|
|
|
|
|
|
# start the remote runner
|
2020-11-21 00:19:39 +00:00
|
|
|
try cd "${MY_DIR}"
|
|
|
|
log "Starting the remote runner..."
|
2012-11-01 22:17:31 +00:00
|
|
|
node remote_runner.js
|
2012-11-01 23:21:10 +00:00
|
|
|
exit_code=$?
|
2012-11-01 22:17:31 +00:00
|
|
|
|
2020-11-21 00:19:39 +00:00
|
|
|
kill "$(cat /tmp/sauce.pid)"
|
2020-11-21 02:11:21 +00:00
|
|
|
kill "$ep_pid" && wait "$ep_pid"
|
2020-11-21 00:19:39 +00:00
|
|
|
log "Done."
|
|
|
|
exit "$exit_code"
|