From: Tom Clegg Date: Fri, 3 Apr 2015 00:15:58 +0000 (-0400) Subject: 5416: Terminate connections on the configured test database (not necessarily arvados_... X-Git-Tag: 1.1.0~1059^2~6^2~180^2~13 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/5b7e2250d5802b20b73242ae4d0641b32f72cce7?ds=sidebyside 5416: Terminate connections on the configured test database (not necessarily arvados_test). --- diff --git a/jenkins/run-tests.sh b/jenkins/run-tests.sh index f835f95291..6700712cce 100755 --- a/jenkins/run-tests.sh +++ b/jenkins/run-tests.sh @@ -548,9 +548,11 @@ install_apiserver() { && git add tmp \ && git commit -m 'initial commit' - # Clear out any lingering postgresql connections to arvados_test, so that we can drop it - # This assumes the current user is a postgresql superuser - psql arvados_test -c "SELECT pg_terminate_backend (pg_stat_activity.procpid::int) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'arvados_test';" 2>/dev/null + # Clear out any lingering postgresql connections to the test + # database, so that we can drop it. This assumes the current user + # is a postgresql superuser. + test_database=$(python -c "import yaml; print yaml.load(file('config/database.yml'))['test']['database']") + psql "$test_database" -c "SELECT pg_terminate_backend (pg_stat_activity.procpid::int) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$test_database';" 2>/dev/null cd "$WORKSPACE/services/api" \ && RAILS_ENV=test bundle exec rake db:drop \