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.

Change-Id: I6618366e6464d569a86fb027919be2e1825e438c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2021-07-28 16:20:20 +01:00
parent 2fef2e6c4f
commit 815922fbee
12 changed files with 150 additions and 76 deletions

View File

@ -10,10 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_fixtures
import sqlalchemy
from glance.tests.functional.db import test_migrations
import glance.tests.utils as test_utils
def get_indexes(table, engine):
@ -34,15 +35,25 @@ class TestMitaka01Mixin(test_migrations.AlembicMigrationsMixin):
self.assertIn('updated_at_image_idx', indexes)
class TestMitaka01MySQL(TestMitaka01Mixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestMitaka01PostgresSQL(TestMitaka01Mixin,
test_base.PostgreSQLOpportunisticTestCase):
pass
class TestMitaka01Sqlite(TestMitaka01Mixin, test_base.DbTestCase):
class TestMitaka01MySQL(
TestMitaka01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture
class TestMitaka01PostgresSQL(
TestMitaka01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.PostgresqlOpportunisticFixture
class TestMitaka01Sqlite(
TestMitaka01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
pass

View File

@ -12,10 +12,11 @@
import datetime
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import utils as db_utils
from glance.tests.functional.db import test_migrations
import glance.tests.utils as test_utils
class TestMitaka02Mixin(test_migrations.AlembicMigrationsMixin):
@ -51,15 +52,25 @@ class TestMitaka02Mixin(test_migrations.AlembicMigrationsMixin):
self.assertEqual(1, len(result))
class TestMitaka02MySQL(TestMitaka02Mixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestMitaka02PostgresSQL(TestMitaka02Mixin,
test_base.PostgreSQLOpportunisticTestCase):
pass
class TestMitaka02Sqlite(TestMitaka02Mixin, test_base.DbTestCase):
class TestMitaka02MySQL(
TestMitaka02Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture
class TestMitaka02PostgresSQL(
TestMitaka02Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.PostgresqlOpportunisticFixture
class TestMitaka02Sqlite(
TestMitaka02Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
pass

View File

@ -12,11 +12,12 @@
import datetime
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import utils as db_utils
from glance.db.sqlalchemy.alembic_migrations import data_migrations
from glance.tests.functional.db import test_migrations
import glance.tests.utils as test_utils
class TestOcataContract01Mixin(test_migrations.AlembicMigrationsMixin):
@ -62,6 +63,9 @@ class TestOcataContract01Mixin(test_migrations.AlembicMigrationsMixin):
self.assertIn('visibility', images.c)
class TestOcataContract01MySQL(TestOcataContract01Mixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestOcataContract01MySQL(
TestOcataContract01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture

View File

@ -12,10 +12,11 @@
import datetime
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import utils as db_utils
from glance.tests.functional.db import test_migrations
import glance.tests.utils as test_utils
class TestOcataExpand01Mixin(test_migrations.AlembicMigrationsMixin):
@ -169,6 +170,9 @@ class TestOcataExpand01Mixin(test_migrations.AlembicMigrationsMixin):
self.assertEqual('public', rows[1]['visibility'])
class TestOcataExpand01MySQL(TestOcataExpand01Mixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestOcataExpand01MySQL(
TestOcataExpand01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture

View File

@ -12,11 +12,12 @@
import datetime
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import utils as db_utils
from glance.db.sqlalchemy.alembic_migrations import data_migrations
from glance.tests.functional.db import test_migrations
import glance.tests.utils as test_utils
class TestOcataMigrate01Mixin(test_migrations.AlembicMigrationsMixin):
@ -146,9 +147,12 @@ class TestOcataMigrate01Mixin(test_migrations.AlembicMigrationsMixin):
# self.assertEqual('shared', rows[3]['visibility'])
class TestOcataMigrate01MySQL(TestOcataMigrate01Mixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestOcataMigrate01MySQL(
TestOcataMigrate01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture
class TestOcataMigrate01_EmptyDBMixin(test_migrations.AlembicMigrationsMixin):
@ -177,7 +181,10 @@ class TestOcataMigrate01_EmptyDBMixin(test_migrations.AlembicMigrationsMixin):
data_migrations.migrate(engine)
class TestOcataMigrate01_EmptyDBMySQL(TestOcataMigrate01_EmptyDBMixin,
test_base.MySQLOpportunisticTestCase):
class TestOcataMigrate01_EmptyDBMySQL(
TestOcataMigrate01_EmptyDBMixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
"""This test runs the Ocata data migrations on an empty databse."""
pass
FIXTURE = test_fixtures.MySQLOpportunisticFixture

View File

@ -10,11 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import utils as db_utils
import sqlalchemy
from glance.tests.functional.db import test_migrations
import glance.tests.utils as test_utils
class TestPikeContract01Mixin(test_migrations.AlembicMigrationsMixin):
@ -45,6 +46,9 @@ class TestPikeContract01Mixin(test_migrations.AlembicMigrationsMixin):
db_utils.get_table, engine, table_name)
class TestPikeContract01MySQL(TestPikeContract01Mixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestPikeContract01MySQL(
TestPikeContract01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture

View File

@ -10,10 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import utils as db_utils
from glance.tests.functional.db import test_migrations
import glance.tests.utils as test_utils
class TestPikeExpand01Mixin(test_migrations.AlembicMigrationsMixin):
@ -42,6 +43,9 @@ class TestPikeExpand01Mixin(test_migrations.AlembicMigrationsMixin):
self._pre_upgrade_pike_expand01(engine)
class TestPikeExpand01MySQL(TestPikeExpand01Mixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestPikeExpand01MySQL(
TestPikeExpand01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture

View File

@ -10,14 +10,18 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_fixtures
import glance.tests.functional.db.migrations.test_pike_expand01 as tpe01
import glance.tests.utils as test_utils
# no TestPikeMigrate01Mixin class needed, can use TestPikeExpand01Mixin instead
class TestPikeMigrate01MySQL(tpe01.TestPikeExpand01Mixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestPikeMigrate01MySQL(
tpe01.TestPikeExpand01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture

View File

@ -11,10 +11,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import utils as db_utils
from glance.tests.functional.db import test_migrations
import glance.tests.utils as test_utils
class TestRockyExpand01Mixin(test_migrations.AlembicMigrationsMixin):
@ -34,6 +35,9 @@ class TestRockyExpand01Mixin(test_migrations.AlembicMigrationsMixin):
self.assertFalse(images.c.os_hidden.nullable)
class TestRockyExpand01MySQL(TestRockyExpand01Mixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestRockyExpand01MySQL(
TestRockyExpand01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture

View File

@ -11,10 +11,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import utils as db_utils
from glance.tests.functional.db import test_migrations
import glance.tests.utils as test_utils
class TestRockyExpand02Mixin(test_migrations.AlembicMigrationsMixin):
@ -36,6 +37,9 @@ class TestRockyExpand02Mixin(test_migrations.AlembicMigrationsMixin):
self.assertTrue(images.c.os_hash_value.nullable)
class TestRockyExpand02MySQL(TestRockyExpand02Mixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestRockyExpand02MySQL(
TestRockyExpand02Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture

View File

@ -14,11 +14,12 @@
import datetime
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import utils as db_utils
from glance.db.sqlalchemy.alembic_migrations import data_migrations
from glance.tests.functional.db import test_migrations
import glance.tests.utils as test_utils
class TestTrainMigrate01Mixin(test_migrations.AlembicMigrationsMixin):
@ -94,14 +95,20 @@ class TestTrainMigrate01Mixin(test_migrations.AlembicMigrationsMixin):
self.assertIn('"store":', row['meta_data'])
class TestTrainMigrate01MySQL(TestTrainMigrate01Mixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestTrainMigrate01MySQL(
TestTrainMigrate01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture
class TestTrain01PostgresSQL(TestTrainMigrate01Mixin,
test_base.PostgreSQLOpportunisticTestCase):
pass
class TestTrain01PostgresSQL(
TestTrainMigrate01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.PostgresqlOpportunisticFixture
class TestTrainMigrate01_EmptyDBMixin(test_migrations.AlembicMigrationsMixin):
@ -130,11 +137,17 @@ class TestTrainMigrate01_EmptyDBMixin(test_migrations.AlembicMigrationsMixin):
data_migrations.migrate(engine)
class TestTrainMigrate01_EmptyDBMySQL(TestTrainMigrate01_EmptyDBMixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestTrainMigrate01_EmptyDBMySQL(
TestTrainMigrate01_EmptyDBMixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture
class TestTrainMigrate01_PySQL(TestTrainMigrate01_EmptyDBMixin,
test_base.PostgreSQLOpportunisticTestCase):
pass
class TestTrainMigrate01_PySQL(
TestTrainMigrate01_EmptyDBMixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.PostgresqlOpportunisticFixture

View File

@ -11,10 +11,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import utils as db_utils
from glance.tests.functional.db import test_migrations
import glance.tests.utils as test_utils
class TestWallabyExpand01Mixin(test_migrations.AlembicMigrationsMixin):
@ -47,6 +48,9 @@ class TestWallabyExpand01Mixin(test_migrations.AlembicMigrationsMixin):
('ix_tasks_image_id', 'tasks'))
class TestWallabyExpand01MySQL(TestWallabyExpand01Mixin,
test_base.MySQLOpportunisticTestCase):
pass
class TestWallabyExpand01MySQL(
TestWallabyExpand01Mixin,
test_fixtures.OpportunisticDBTestMixin,
test_utils.BaseTestCase,
):
FIXTURE = test_fixtures.MySQLOpportunisticFixture