diff options
-rw-r--r-- | oslo_db/sqlalchemy/test_base.py | 3 | ||||
-rw-r--r-- | oslo_db/tests/sqlalchemy/test_fixtures.py | 16 |
2 files changed, 18 insertions, 1 deletions
diff --git a/oslo_db/sqlalchemy/test_base.py b/oslo_db/sqlalchemy/test_base.py index a28259e..bda0d91 100644 --- a/oslo_db/sqlalchemy/test_base.py +++ b/oslo_db/sqlalchemy/test_base.py @@ -126,7 +126,8 @@ class DbTestCase(test_base.BaseTestCase): if driver not in self._database_resources: try: self._database_resources[driver] = \ - provision.DatabaseResource(driver) + provision.DatabaseResource(driver, + provision_new_database=True) except exception.BackendNotAvailable as bne: self._database_resources[driver] = None self._db_not_available[driver] = str(bne) diff --git a/oslo_db/tests/sqlalchemy/test_fixtures.py b/oslo_db/tests/sqlalchemy/test_fixtures.py index 08723b4..44fed1e 100644 --- a/oslo_db/tests/sqlalchemy/test_fixtures.py +++ b/oslo_db/tests/sqlalchemy/test_fixtures.py @@ -196,3 +196,19 @@ class EnginefacadeIntegrationTest(oslo_test_base.BaseTestCase): fixture.cleanUp() fixture._clear_cleanups() # so the real cleanUp works self.assertFalse(normal_mgr._factory._started) + + +class LegacyBaseClassTest(oslo_test_base.BaseTestCase): + def test_new_db_is_provisioned_by_default(self): + classes = [ + legacy_test_base.MySQLOpportunisticTestCase, + legacy_test_base.PostgreSQLOpportunisticTestCase + ] + for base_cls in classes: + class SomeTest(base_cls): + def runTest(self): + pass + st = SomeTest() + + db_resource = dict(st.resources)['db'] + self.assertTrue(db_resource.provision_new_database) |