summaryrefslogtreecommitdiff
path: root/reap_dbs.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-07-21 14:12:12 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-07-21 21:46:10 -0400
commitd27330855593fe713aa162a2a748697617bde0aa (patch)
treea7fe54b8d1d002a4e095b3759be709d7c2904c51 /reap_dbs.py
parentca053c5dde143f695ba16b14fbe4d40855459f17 (diff)
downloadalembic-d27330855593fe713aa162a2a748697617bde0aa.tar.gz
Use SQLAlchemy's testing framework fully
w/ 1.1 as the minimum version we should be able to remove the majority of the testing suite code Change-Id: I04c4ab45e2ce47f20613d6111895c6230b946f76
Diffstat (limited to 'reap_dbs.py')
-rw-r--r--reap_dbs.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/reap_dbs.py b/reap_dbs.py
new file mode 100644
index 0000000..ae7ff85
--- /dev/null
+++ b/reap_dbs.py
@@ -0,0 +1,25 @@
+"""Drop Oracle, SQL Server databases that are left over from a
+multiprocessing test run.
+
+Currently the cx_Oracle driver seems to sometimes not release a
+TCP connection even if close() is called, which prevents the provisioning
+system from dropping a database in-process.
+
+For SQL Server, databases still remain in use after tests run and
+running a kill of all detected sessions does not seem to release the
+database in process.
+
+"""
+import logging
+import sys
+
+from sqlalchemy.testing import provision
+
+
+logging.basicConfig()
+logging.getLogger(provision.__name__).setLevel(logging.INFO)
+
+if hasattr(provision, "reap_dbs"):
+ provision.reap_dbs(sys.argv[1])
+else:
+ provision.reap_oracle_dbs(sys.argv[1])