57 lines
1.2 KiB
Bash
Executable File
57 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
export DEBUG=superagent-sync,e2e:*
|
|
export DEBUG_COLORS=true
|
|
|
|
readonly tests=(app-flow-test cloudron-user-test new-user-test cloudron-backup-test)
|
|
test_pids=()
|
|
test_logs=()
|
|
|
|
# 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 &
|
|
test_pids+=("$!")
|
|
test_logs+=("logs/${t}.log")
|
|
done
|
|
|
|
# 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 &
|
|
test_pids+=("$!")
|
|
test_logs+=("logs/cloudron-update-test.log")
|
|
|
|
# stream all the logs
|
|
tail -f ${test_logs[*]} &
|
|
|
|
# wait for tests to finish
|
|
fail=0
|
|
echo "Waiting for jobs to finish"
|
|
for pid in "${test_pids[@]}"; do
|
|
wait $pid || let "fail+=1"
|
|
done
|
|
|
|
echo
|
|
echo
|
|
for t in "${tests[@]}"; do
|
|
echo "=========== ${t} =============="
|
|
cat "logs/${t}.log"
|
|
echo
|
|
echo
|
|
done
|
|
|
|
if [ "$fail" == "0" ]; then
|
|
exit 0
|
|
else
|
|
echo "Fail count: ${fail}"
|
|
exit 1
|
|
fi
|
|
|