Merge "Drop support for SQLite < 3.7"

This commit is contained in:
Zuul 2021-05-04 04:44:51 +00:00 committed by Gerrit Code Review
commit 7953c0197d
2 changed files with 3 additions and 13 deletions

View File

@ -387,15 +387,6 @@ class TestCase(base.BaseTestCase):
engine = sqlalchemy_api.get_engine()
dialect = engine.url.get_dialect()
if dialect == sqlite.dialect:
# We're seeing issues with foreign key support in SQLite 3.6.20
# SQLAlchemy doesn't support it at all with < SQLite 3.6.19
# It works fine in SQLite 3.7.
# So return early to skip this test if running SQLite < 3.7
import sqlite3
tup = sqlite3.sqlite_version_info
if tup[0] < 3 or (tup[0] == 3 and tup[1] < 7):
self.skipTest(
'sqlite version too old for reliable SQLA foreign_keys')
engine.connect().execute("PRAGMA foreign_keys = ON")
def start_service(self, name, host=None, cell_name=None, **kwargs):

View File

@ -6224,13 +6224,12 @@ class ArchiveTestCase(test.TestCase, ModelsObjectComparatorMixin):
# Verify the insertions into shadow is same as deletions from main
self.assertEqual(len(shadow_rows), len(rows) - len(main_rows))
def _check_sqlite_version_less_than_3_7(self):
def test_archive_deleted_rows_for_migrations(self):
# migrations.instance_uuid depends on instances.uuid
# SQLite doesn't enforce foreign key constraints without a pragma.
self.enforce_fk_constraints(engine=self.engine)
def test_archive_deleted_rows_for_migrations(self):
# migrations.instance_uuid depends on instances.uuid
self._check_sqlite_version_less_than_3_7()
instance_uuid = uuidsentinel.instance
ins_stmt = self.instances.insert().values(
uuid=instance_uuid,