2015-11-14 03:59:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
export DEBUG=superagent-sync,e2e:*
|
|
|
|
export DEBUG_COLORS=true
|
|
|
|
|
2015-11-19 18:20:50 +00:00
|
|
|
readonly tests=(app-flow-test cloudron-user-test new-user-test cloudron-backup-test)
|
2015-11-19 16:55:21 +00:00
|
|
|
test_pids=()
|
|
|
|
test_logs=()
|
2015-11-14 03:59:43 +00:00
|
|
|
|
|
|
|
# cleanup
|
|
|
|
rm -f logs/*
|
|
|
|
echo "Cleaning up"
|
|
|
|
./node_modules/.bin/mocha test/000-cleanup.js > "logs/000-cleanup.log" 2>&1
|
|
|
|
|
|
|
|
# run tests
|
|
|
|
for t in "${tests[@]}"; do
|
|
|
|
echo "Starting test ${t}"
|
|
|
|
./node_modules/.bin/mocha "test/${t}.js" > "logs/${t}.log" 2>&1 &
|
2015-11-19 16:55:21 +00:00
|
|
|
test_pids+=("$!")
|
|
|
|
test_logs+=("logs/${t}.log")
|
2015-11-14 03:59:43 +00:00
|
|
|
done
|
|
|
|
|
2015-11-14 04:32:02 +00:00
|
|
|
# update test modifies release file, so run it separately
|
|
|
|
sleep 20 # wait for the other tests to have created the cloudron
|
|
|
|
./node_modules/.bin/mocha "test/cloudron-update-test.js" > "logs/cloudron-update-test.log" 2>&1 &
|
2015-11-19 16:55:21 +00:00
|
|
|
test_pids+=("$!")
|
|
|
|
test_logs+=("logs/cloudron-update-test.log")
|
|
|
|
|
2015-11-19 21:49:13 +00:00
|
|
|
# stream all the logs (to stderr so that it's not in email but in deploy logs)
|
|
|
|
tail -f ${test_logs[*]} >&2 &
|
2015-11-14 04:32:02 +00:00
|
|
|
|
2015-11-14 03:59:43 +00:00
|
|
|
# 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
|
|
|
|
wait $pid || let "fail+=1"
|
2015-11-14 03:59:43 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
for t in "${tests[@]}"; do
|
|
|
|
echo "=========== ${t} =============="
|
2015-11-14 04:51:19 +00:00
|
|
|
cat "logs/${t}.log"
|
2015-11-14 03:59:43 +00:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$fail" == "0" ]; then
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo "Fail count: ${fail}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|