fi
}
+exit_cleanly() {
+ trap - INT
+ rotate_logfile "$WORKSPACE/apps/workbench/log/" "test.log"
+ stop_api
+ rotate_logfile "$WORKSPACE/services/api/log/" "test.log"
+ report_outcomes
+ clear_temp
+ exit ${#failures}
+}
+
sanity_checks() {
# Make sure WORKSPACE is set
if ! [[ -n "$WORKSPACE" ]]; then
echo >&2
exit 1
fi
-
}
rotate_logfile() {
esac
done
+start_api() {
+ echo 'Starting API server...'
+ cd "$WORKSPACE" \
+ && eval $(python sdk/python/tests/run_test_server.py start --auth admin) \
+ && export ARVADOS_TEST_API_HOST="$ARVADOS_API_HOST" \
+ && export ARVADOS_TEST_API_INSTALLED="$$" \
+ && (env | egrep ^ARVADOS)
+}
+
+stop_api() {
+ if [[ -n "$ARVADOS_TEST_API_HOST" ]]; then
+ unset ARVADOS_TEST_API_HOST
+ cd "$WORKSPACE" \
+ && python sdk/python/tests/run_test_server.py stop
+ fi
+}
+
+interrupt() {
+ failures+=("($(basename $0) interrupted)")
+ exit_cleanly
+}
+trap interrupt INT
+
sanity_checks
echo "WORKSPACE=$WORKSPACE"
}
do_install apps/workbench workbench
-start_api() {
- echo 'Starting API server...'
- cd "$WORKSPACE" \
- && eval $(python sdk/python/tests/run_test_server.py start --auth admin) \
- && export ARVADOS_TEST_API_HOST="$ARVADOS_API_HOST" \
- && export ARVADOS_TEST_API_INSTALLED="$$" \
- && (env | egrep ^ARVADOS)
-}
-
-stop_api() {
- unset ARVADOS_TEST_API_HOST
- cd "$WORKSPACE" \
- && python sdk/python/tests/run_test_server.py stop
-}
-
-clean_up() {
- report_outcomes
- clear_temp
-
- exit ${#failures}
-}
-
test_doclinkchecker() {
(
set -e
# because we don't need to start up the api server for subsequent tests.
if [ ! -z "$only" ] && [ "$only" == "services/api" ]; then
rotate_logfile "$WORKSPACE/services/api/log/" "test.log"
-
- clean_up
+ exit_cleanly
fi
start_api
}
do_test apps/workbench_profile workbench_profile
-rotate_logfile "$WORKSPACE/apps/workbench/log/" "test.log"
-
-stop_api
-
-rotate_logfile "$WORKSPACE/services/api/log/" "test.log"
-clean_up
+exit_cleanly