X-Git-Url: https://git.arvados.org/arvados-dev.git/blobdiff_plain/be33b03fe8aef6e9e23f82ee7653bc46fabef161..6c6ca86bfa400d880d051fd87c7c1fb9b8905114:/jenkins/run-tests.sh diff --git a/jenkins/run-tests.sh b/jenkins/run-tests.sh index 03928ce..713ffda 100755 --- a/jenkins/run-tests.sh +++ b/jenkins/run-tests.sh @@ -126,6 +126,16 @@ report_outcomes() { 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 @@ -165,7 +175,6 @@ sanity_checks() { echo >&2 exit 1 fi - } rotate_logfile() { @@ -221,6 +230,29 @@ do 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" @@ -531,21 +563,6 @@ install_workbench() { } 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 -} - test_doclinkchecker() { ( set -e @@ -566,6 +583,13 @@ test_apiserver() { } do_test services/api apiserver +# Shortcut for when we're only running apiserver tests. This saves a bit of time, +# 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" + exit_cleanly +fi + start_api test_ruby_sdk() { @@ -609,12 +633,4 @@ test_workbench_profile() { } 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" - -report_outcomes -clear_temp - -exit ${#failures} +exit_cleanly