tests: Remove use of 'oslo_db.sqlalchemy.test_base'

The various test cases and mixins in 'oslo_db.sqlalchemy.test_base' have
been deprecated since oslo.db 4.34.0 (March 2018). Remove use of these.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I67eff8c9733500813435cde2dbda28a3c4a3ccf3
This commit is contained in:
Stephen Finucane 2021-07-28 18:07:56 +01:00
parent a3f0b7eb18
commit 46f47a3f95

View File

@ -20,9 +20,11 @@ Tests for database migrations.
from unittest import mock
from alembic import script
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import enginefacade
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import test_migrations
from oslo_log import log
from oslotest import base as test_base
from sqlalchemy.sql import text
from manila.db.migrations.alembic import migration
@ -36,6 +38,10 @@ class ManilaMigrationsCheckers(test_migrations.WalkVersionsMixin,
migrations_data_checks.DbMigrationsData):
"""Test alembic migrations."""
def setUp(self):
super().setUp()
self.engine = enginefacade.writer.get_engine()
@property
def snake_walk(self):
return True
@ -168,9 +174,13 @@ class ManilaMigrationsCheckers(test_migrations.WalkVersionsMixin,
"Db migrations should have only one branch.")
class TestManilaMigrationsMySQL(ManilaMigrationsCheckers,
test_base.MySQLOpportunisticTestCase):
class TestManilaMigrationsMySQL(
ManilaMigrationsCheckers,
test_fixtures.OpportunisticDBTestMixin,
test_base.BaseTestCase,
):
"""Run migration tests on MySQL backend."""
FIXTURE = test_fixtures.MySQLOpportunisticFixture
@test_utils.set_timeout(300)
def test_mysql_innodb(self):
@ -204,5 +214,9 @@ class TestManilaMigrationsMySQL(ManilaMigrationsCheckers,
class TestManilaMigrationsPostgreSQL(
ManilaMigrationsCheckers, test_base.PostgreSQLOpportunisticTestCase):
ManilaMigrationsCheckers,
test_fixtures.OpportunisticDBTestMixin,
test_base.BaseTestCase,
):
"""Run migration tests on PostgreSQL backend."""
FIXTURE = test_fixtures.PostgresqlOpportunisticFixture