log database management actions in tests
Add log messages to show actions taken in tests to try to figure out why some tests are leaving databases behind. Change-Id: Ie742a7b34a8fd0614c27c06ed6f6805058b88336 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
0b50d5752e
commit
ccce5ef454
@ -44,6 +44,7 @@ _DB_CACHE = None
|
||||
|
||||
logging.register_options(CONF)
|
||||
logging.setup(CONF, 'storyboard')
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestCase(testtools.TestCase):
|
||||
@ -143,6 +144,7 @@ class DbTestCase(WorkingDirTestCase):
|
||||
def setup_db(self):
|
||||
self.db_name = "storyboard_test_db_%s" % uuid.uuid4()
|
||||
self.db_name = self.db_name.replace("-", "_")
|
||||
LOG.info('creating database %s', self.db_name)
|
||||
|
||||
# The engine w/o db name
|
||||
engine = sqlalchemy.create_engine(
|
||||
@ -163,7 +165,11 @@ class DbTestCase(WorkingDirTestCase):
|
||||
def _drop_db(self):
|
||||
engine = sqlalchemy.create_engine(
|
||||
self.test_connection)
|
||||
engine.execute("DROP DATABASE %s" % self.db_name)
|
||||
try:
|
||||
engine.execute("DROP DATABASE %s" % self.db_name)
|
||||
except Exception as err:
|
||||
LOG.error('failed to drop database %s: %s',
|
||||
self.db_name, err)
|
||||
db_api_base.cleanup()
|
||||
|
||||
PATH_PREFIX = '/v1'
|
||||
|
Loading…
x
Reference in New Issue
Block a user