From decff518125e54dc044170fb4e31a5b86d566bb5 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Thu, 2 Apr 2015 20:15:58 -0400 Subject: [PATCH] 5416: Terminate connections on the configured test database (not necessarily arvados_test). --- jenkins/run-tests.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jenkins/run-tests.sh b/jenkins/run-tests.sh index f835f95..6700712 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 \ -- 2.30.2