diff options
author | Roman Podoliaka <rpodolyaka@mirantis.com> | 2016-11-14 13:28:57 +0200 |
---|---|---|
committer | Roman Podoliaka <rpodolyaka@mirantis.com> | 2016-11-15 13:17:38 +0200 |
commit | dd800458937a4ccb0b12b0f760eb515d64e0be88 (patch) | |
tree | 96f6ff7db9459270ac061e5da4f9e32e7cfc7491 /oslo_db | |
parent | 4ecb9bd19cb4259ace677a9878653f52144370d2 (diff) | |
download | oslo-db-dd800458937a4ccb0b12b0f760eb515d64e0be88.tar.gz |
Restore provisioning of DBs in legacy test base
Apparentely I0163e637ffef6d45d2573ebe29b5438911d01fce breaks Nova
tests, as we no longer provision a new DB in DatabaseResource by
default. While the recommended way is to use the new fixtures, we
should make sure the original behavior is preserved for the legacy
test cases.
Change-Id: I3e238b6a97769cf0a352f11e718d5d73eebcfa8a
Diffstat (limited to 'oslo_db')
-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) |