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
|
|
|
|
|
|
|
# Set up env variables for testing
|
|
|
|
export AIO_BUILDS_DIR=$TEST_AIO_BUILDS_DIR
|
2017-03-01 17:04:03 -05:00
|
|
|
export AIO_DOMAIN_NAME=$TEST_AIO_DOMAIN_NAME
|
2017-02-28 14:10:46 -05:00
|
|
|
export AIO_GITHUB_ORGANIZATION=$TEST_AIO_GITHUB_ORGANIZATION
|
|
|
|
export AIO_GITHUB_TEAM_SLUGS=$TEST_AIO_GITHUB_TEAM_SLUGS
|
2017-02-06 13:40:28 -05:00
|
|
|
export AIO_REPO_SLUG=$TEST_AIO_REPO_SLUG
|
2017-06-18 18:15:07 -04:00
|
|
|
export AIO_TRUSTED_PR_LABEL=$TEST_AIO_TRUSTED_PR_LABEL
|
2017-02-06 13:40:28 -05:00
|
|
|
export AIO_UPLOAD_HOSTNAME=$TEST_AIO_UPLOAD_HOSTNAME
|
|
|
|
export AIO_UPLOAD_PORT=$TEST_AIO_UPLOAD_PORT
|
|
|
|
|
2017-03-05 09:42:04 -05:00
|
|
|
export AIO_GITHUB_TOKEN=$(head -c -1 /aio-secrets/TEST_GITHUB_TOKEN 2>/dev/null || echo "TEST_GITHUB_TOKEN")
|
|
|
|
export AIO_PREVIEW_DEPLOYMENT_TOKEN=$(head -c -1 /aio-secrets/TEST_PREVIEW_DEPLOYMENT_TOKEN 2>/dev/null || echo "TEST_PREVIEW_DEPLOYMENT_TOKEN")
|
2017-02-28 14:09:44 -05:00
|
|
|
|
2017-02-06 13:40:28 -05:00
|
|
|
# Start the upload-server instance
|
|
|
|
# TODO(gkalpak): Ideally, the upload server should be run as a non-privileged user.
|
|
|
|
# (Currently, there doesn't seem to be a straight forward way.)
|
|
|
|
appName=aio-upload-server-test
|
|
|
|
if [[ "$1" == "stop" ]]; then
|
|
|
|
pm2 delete $appName
|
|
|
|
else
|
2017-06-27 11:19:22 -04:00
|
|
|
pm2 start $AIO_SCRIPTS_JS_DIR/dist/lib/verify-setup/start-test-upload-server.js \
|
2017-02-06 13:40:28 -05:00
|
|
|
--log /var/log/aio/upload-server-test.log \
|
|
|
|
--name $appName \
|
|
|
|
--no-autorestart \
|
|
|
|
${@:2}
|
|
|
|
fi
|