Add some robustness in the postgresql department.
authorWard Vandewege <ward@curoverse.com>
Wed, 17 Sep 2014 01:42:47 +0000 (21:42 -0400)
committerWard Vandewege <ward@curoverse.com>
Wed, 17 Sep 2014 01:43:08 +0000 (21:43 -0400)
no issue #

jenkins/run-tests.sh

index 79a7c62f65f353263c6d2e078ba1320fffad4887..af2b3e2db8fd99e435b7e18cee9c5dfb9e02a15a 100755 (executable)
@@ -268,6 +268,10 @@ 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
+
     cd "$WORKSPACE/services/api" \
         && bundle exec rake db:drop \
         && bundle exec rake db:create \