2017-02-06 13:40:28 -05:00
|
|
|
#!/bin/bash
|
2017-06-19 17:30:06 -04:00
|
|
|
set -eu -o pipefail
|
2017-02-06 13:40:28 -05:00
|
|
|
|
|
|
|
logFile=/var/log/aio/verify-setup.log
|
2018-08-15 08:47:45 -04:00
|
|
|
previewServerLogFile=/var/log/aio/preview-server-verify-setup.log
|
2017-02-06 13:40:28 -05:00
|
|
|
|
|
|
|
exec 3>&1
|
|
|
|
exec >> $logFile
|
|
|
|
exec 2>&1
|
|
|
|
|
|
|
|
echo "[`date`] - Starting verification..."
|
|
|
|
|
|
|
|
# Helpers
|
|
|
|
function countdown {
|
|
|
|
message=$1
|
|
|
|
secs=$2
|
|
|
|
while [ $secs -gt 0 ]; do
|
|
|
|
echo -ne "$message in $secs...\033[0K\r"
|
|
|
|
sleep 1
|
|
|
|
: $((secs--))
|
|
|
|
done
|
|
|
|
echo -ne "\033[0K\r"
|
|
|
|
}
|
|
|
|
|
|
|
|
function onExit {
|
2018-05-10 08:42:58 -04:00
|
|
|
echo -e "Stopping Test Server"
|
2018-08-15 08:47:45 -04:00
|
|
|
aio-preview-server-test stop
|
2017-02-06 13:40:28 -05:00
|
|
|
echo -e "Full logs in '$logFile'.\n" > /dev/fd/3
|
|
|
|
}
|
|
|
|
|
|
|
|
# Setup EXIT trap
|
|
|
|
trap 'onExit' EXIT
|
|
|
|
|
2018-08-15 08:47:45 -04:00
|
|
|
# Start an preview-server instance for testing
|
2018-05-10 08:42:58 -04:00
|
|
|
echo -e "Starting Test Server"
|
2018-08-15 08:47:45 -04:00
|
|
|
aio-preview-server-test start --log $previewServerLogFile
|
2017-02-06 13:40:28 -05:00
|
|
|
|
2018-08-15 08:47:45 -04:00
|
|
|
# Give the preview-server some time to start :(
|
2017-02-06 13:40:28 -05:00
|
|
|
countdown "Starting" 5 > /dev/fd/3
|
|
|
|
|
|
|
|
# Run the tests
|
2018-05-10 08:42:58 -04:00
|
|
|
echo Running the tests
|
|
|
|
source aio-test-env
|
2017-02-06 13:40:28 -05:00
|
|
|
node $AIO_SCRIPTS_JS_DIR/dist/lib/verify-setup | tee /dev/fd/3
|