2015-11-14 03:59:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2016-06-23 19:57:51 +00:00
|
|
|
export DEBUG=superagent-sync,e2e:*,imap-probe
|
2015-11-14 03:59:43 +00:00
|
|
|
export DEBUG_COLORS=true
|
|
|
|
|
2015-11-19 16:55:21 +00:00
|
|
|
test_pids=()
|
2015-11-14 03:59:43 +00:00
|
|
|
|
2016-04-02 04:11:58 +00:00
|
|
|
# before
|
2016-09-28 18:20:58 +00:00
|
|
|
rm -rf logs && mkdir logs
|
2016-04-02 04:11:58 +00:00
|
|
|
echo "Before"
|
|
|
|
if ! ./node_modules/.bin/mocha --bail test/before.js > "logs/before.log" 2>&1; then
|
|
|
|
echo "Before script failed"
|
2016-01-14 21:47:35 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2015-11-14 03:59:43 +00:00
|
|
|
|
|
|
|
# run tests
|
2016-10-17 11:32:41 +00:00
|
|
|
# readonly tests=(app-flow-test app-update-test alt-domain-test cloudron-button-test cloudron-user-test new-user-test cloudron-backup-test cloudron-migrate-test cloudron-autoupdate-sfo1-test cloudron-update-ams3-test selfhost-ec2-test selfhost-digitalocean-filesystem-test)
|
2017-02-02 16:11:55 +00:00
|
|
|
readonly tests=(app-flow-test app-update-test alt-domain-test cloudron-button-test cloudron-user-test new-user-test cloudron-backup-test cloudron-migrate-test cloudron-autoupdate-sfo1-test cloudron-update-ams3-test selfhost-digitalocean-filesystem-test)
|
2015-11-14 03:59:43 +00:00
|
|
|
for t in "${tests[@]}"; do
|
2016-09-21 17:39:09 +00:00
|
|
|
EXEC_LOG_FILE="logs/${t}-cloudron-cli.log" ./node_modules/.bin/mocha --bail "test/${t}.js" > "logs/${t}.log" 2>&1 &
|
2015-11-19 16:55:21 +00:00
|
|
|
test_pids+=("$!")
|
2016-01-26 21:38:41 +00:00
|
|
|
echo "Starting test ${t} with pid ${test_pids[-1]}"
|
2015-11-14 03:59:43 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# wait for tests to finish
|
|
|
|
fail=0
|
|
|
|
echo "Waiting for jobs to finish"
|
2015-11-19 16:55:21 +00:00
|
|
|
for pid in "${test_pids[@]}"; do
|
2016-01-26 21:38:41 +00:00
|
|
|
if ! wait $pid; then
|
|
|
|
let "fail+=1"
|
|
|
|
echo "$pid failed"
|
|
|
|
fi
|
2015-11-14 03:59:43 +00:00
|
|
|
done
|
|
|
|
|
2016-04-02 04:11:58 +00:00
|
|
|
# after
|
|
|
|
echo "After"
|
2016-09-21 20:31:33 +00:00
|
|
|
if ! ./node_modules/.bin/mocha --bail test/after.js > "logs/after.log" 2>&1; then
|
2016-04-02 04:11:58 +00:00
|
|
|
echo "After script failed"
|
|
|
|
fi
|
|
|
|
|
2015-11-14 03:59:43 +00:00
|
|
|
if [ "$fail" == "0" ]; then
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo "Fail count: ${fail}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|