X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/caf81587353b5e490e01f7f45aef78aef0ef18c0..8da39e55beb95fa6f2408c86803e5a003bcd8ae5:/build/run-tests.sh diff --git a/build/run-tests.sh b/build/run-tests.sh index 113069a33e..0c7909c6ae 100755 --- a/build/run-tests.sh +++ b/build/run-tests.sh @@ -654,7 +654,7 @@ install_env() { . "$VENVDIR/bin/activate" # Needed for run_test_server.py which is used by certain (non-Python) tests. - pip install --no-cache-dir PyYAML \ + pip install --no-cache-dir PyYAML future \ || fatal "pip install PyYAML failed" # Preinstall libcloud if using a fork; otherwise nodemanager "pip @@ -739,6 +739,7 @@ do_test() { ;; *) if ! start_services; then + checkexit 1 "$1 tests" title "test $1 -- failed to start services" return 1 fi @@ -819,11 +820,14 @@ do_test_once() { } check_arvados_config() { + if [[ "$1" = "env" ]] ; then + return + fi if [[ -z "$ARVADOS_CONFIG" ]] ; then # Create config file. The run_test_server script requires PyYAML, # so virtualenv needs to be active. Downstream steps like # workbench install which require a valid config.yml. - if [[ (! -s "$VENVDIR/bin/activate") && "$1" != "env" ]] ; then + if [[ ! -s "$VENVDIR/bin/activate" ]] ; then install_env fi . "$VENVDIR/bin/activate" @@ -971,11 +975,15 @@ install_services/api() { && git --git-dir internal.git init \ || return 1 - cd "$WORKSPACE/services/api" \ - && RAILS_ENV=test bundle exec rails db:environment:set \ - && RAILS_ENV=test bundle exec rake db:drop \ - && RAILS_ENV=test bundle exec rake db:setup \ - && RAILS_ENV=test bundle exec rake db:fixtures:load + + (cd "$WORKSPACE/services/api" + export RAILS_ENV=test + if bundle exec rails db:environment:set ; then + bundle exec rake db:drop + fi + bundle exec rake db:setup \ + && bundle exec rake db:fixtures:load + ) } declare -a pythonstuff @@ -1044,7 +1052,7 @@ test_govendor() { test_services/api() { rm -f "$WORKSPACE/services/api/git-commit.version" cd "$WORKSPACE/services/api" \ - && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test TESTOPTS='-v -d' ${testargs[services/api]} + && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test TESTOPTS=\'-v -d\' ${testargs[services/api]} } test_sdk/ruby() { @@ -1081,47 +1089,32 @@ test_services/nodemanager_integration() { test_apps/workbench_units() { local TASK="test:units" - if [[ -n "${testargs[apps/workbench]}" ]] || [[ -n "${testargs[apps/workbench_units]}" ]]; then - TASK="test" - fi cd "$WORKSPACE/apps/workbench" \ - && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake ${TASK} TESTOPTS='-v -d' ${testargs[apps/workbench]} ${testargs[apps/workbench_units]} + && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake ${TASK} TESTOPTS=\'-v -d\' ${testargs[apps/workbench]} ${testargs[apps/workbench_units]} } test_apps/workbench_functionals() { local TASK="test:functionals" - if [[ -n "${testargs[apps/workbench]}" ]] || [[ -n "${testargs[apps/workbench_functionals]}" ]]; then - TASK="test" - fi cd "$WORKSPACE/apps/workbench" \ - && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake ${TASK} TESTOPTS='-v -d' ${testargs[apps/workbench]} ${testargs[apps/workbench_functionals]} + && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake ${TASK} TESTOPTS=\'-v -d\' ${testargs[apps/workbench]} ${testargs[apps/workbench_functionals]} } test_apps/workbench_integration() { local TASK="test:integration" - if [[ -n "${testargs[apps/workbench]}" ]] || [[ -n "${testargs[apps/workbench_integration]}" ]]; then - TASK="test" - fi cd "$WORKSPACE/apps/workbench" \ - && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake ${TASK} TESTOPTS='-v -d' ${testargs[apps/workbench]} ${testargs[apps/workbench_integration]} + && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake ${TASK} TESTOPTS=\'-v -d\' ${testargs[apps/workbench]} ${testargs[apps/workbench_integration]} } test_apps/workbench_benchmark() { local TASK="test:benchmark" - if [[ -n "${testargs[apps/workbench]}" ]] || [[ -n "${testargs[apps/workbench_benchmark]}" ]]; then - TASK="test" - fi cd "$WORKSPACE/apps/workbench" \ - && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake ${TASK} ${testargs[apps/workbench_benchmark]} + && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake ${TASK} ${testargs[apps/workbench_benchmark]} } test_apps/workbench_profile() { local TASK="test:profile" - if [[ -n "${testargs[apps/workbench]}" ]] || [[ -n "${testargs[apps/workbench_profile]}" ]]; then - TASK="test" - fi cd "$WORKSPACE/apps/workbench" \ - && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake ${TASK} ${testargs[apps/workbench_profile]} + && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake ${TASK} ${testargs[apps/workbench_profile]} } install_deps() {