summaryrefslogtreecommitdiff
path: root/oslo_db/tests/sqlalchemy
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2022-07-14 11:33:19 +0100
committerStephen Finucane <stephenfin@redhat.com>2022-07-27 11:20:59 +0100
commitf32890e41daca63b67074eb816b3d3d4458869b3 (patch)
treecf89e8b1477d4b7b97cebea1ef2f3cc44f319f91 /oslo_db/tests/sqlalchemy
parent8c9ef045d1e697c3bbca5379583f7bd93651f47f (diff)
downloadoslo-db-f32890e41daca63b67074eb816b3d3d4458869b3.tar.gz
Deprecate MySQL NDB Cluster Support
Traditionally, the MySQL support in oslo.db has assumed use of the InnoDB storage engine. However, this isn't the only storage engine available and a few years ago an effort was made to add support for another storage engine, MySQL Cluster (NDB). The oslo.db aspects of this effort were tracked via bug 1564110 [1] and from reading this bug and looking at other patches related to this effort [2], it becomes obvious that this was never seen through to the completion and the OpenStack-wide effort never took off [3]. As a result, much of what is here is in-effect dead code now. Given no one is using this engine, there's no reason to keep it around. Deprecate it with an eye on removing it sooner rather than later. [1] https://bugs.launchpad.net/oslo.db/+bug/1564110 [2] https://review.opendev.org/q/owner:octave.orgeron%2540oracle.com [3] https://review.opendev.org/c/openstack/openstack-specs/+/429940 Change-Id: Id5ddf1d6f47b8a572001f58ad8b9b8a7dbe4e8ac Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Diffstat (limited to 'oslo_db/tests/sqlalchemy')
-rw-r--r--oslo_db/tests/sqlalchemy/test_ndb.py34
-rw-r--r--oslo_db/tests/sqlalchemy/test_utils.py4
2 files changed, 24 insertions, 14 deletions
diff --git a/oslo_db/tests/sqlalchemy/test_ndb.py b/oslo_db/tests/sqlalchemy/test_ndb.py
index 06c4d82..c516b1b 100644
--- a/oslo_db/tests/sqlalchemy/test_ndb.py
+++ b/oslo_db/tests/sqlalchemy/test_ndb.py
@@ -15,6 +15,7 @@
import logging
from unittest import mock
+import warnings
from oslo_db import exception
from oslo_db.sqlalchemy import enginefacade
@@ -38,12 +39,16 @@ from sqlalchemy import Text
LOG = logging.getLogger(__name__)
_MOCK_CONNECTION = 'mysql+pymysql://'
-_TEST_TABLE = Table("test_ndb", MetaData(),
- Column('id', Integer, primary_key=True),
- Column('test1', String(255, mysql_ndb_type=TEXT)),
- Column('test2', String(4096, mysql_ndb_type=TEXT)),
- Column('test3', String(255, mysql_ndb_length=64)),
- mysql_engine='InnoDB')
+with warnings.catch_warnings(): # hide deprecation warning
+ _TEST_TABLE = Table(
+ "test_ndb",
+ MetaData(),
+ Column('id', Integer, primary_key=True),
+ Column('test1', String(255, mysql_ndb_type=TEXT)),
+ Column('test2', String(4096, mysql_ndb_type=TEXT)),
+ Column('test3', String(255, mysql_ndb_length=64)),
+ mysql_engine='InnoDB',
+ )
class NDBMockTestBase(test_base.BaseTestCase):
@@ -57,7 +62,9 @@ class NDBMockTestBase(test_base.BaseTestCase):
self.addCleanup(
setattr, test_engine.dialect, "_oslodb_enable_ndb_support", False
)
- ndb.init_ndb_events(test_engine)
+ # hide deprecation warnings
+ with warnings.catch_warnings():
+ ndb.init_ndb_events(test_engine)
class NDBEventTestCase(NDBMockTestBase):
@@ -164,9 +171,10 @@ class NDBOpportunisticTestCase(
# if we want NDB, make a new local engine that uses the
# URL / database / schema etc. of the provisioned engine,
# since NDB-ness is a per-table thing
- self.engine = engines.create_engine(
- self.engine.url, mysql_enable_ndb=True
- )
+ with warnings.catch_warnings(): # hide deprecation warnings
+ self.engine = engines.create_engine(
+ self.engine.url, mysql_enable_ndb=True
+ )
self.addCleanup(self.engine.dispose)
self.test_table = _TEST_TABLE
try:
@@ -176,7 +184,8 @@ class NDBOpportunisticTestCase(
def test_ndb_enabled(self):
self.init_db(True)
- self.assertTrue(ndb.ndb_status(self.engine))
+ with warnings.catch_warnings(): # hide deprecation warnings
+ self.assertTrue(ndb.ndb_status(self.engine))
self.assertIsInstance(self.test_table.c.test1.type, TINYTEXT)
self.assertIsInstance(self.test_table.c.test2.type, Text)
self.assertIsInstance(self.test_table.c.test3.type, String)
@@ -185,7 +194,8 @@ class NDBOpportunisticTestCase(
def test_ndb_disabled(self):
self.init_db(False)
- self.assertFalse(ndb.ndb_status(self.engine))
+ with warnings.catch_warnings(): # hide deprecation warnings
+ self.assertFalse(ndb.ndb_status(self.engine))
self.assertIsInstance(self.test_table.c.test1.type, String)
self.assertEqual(255, self.test_table.c.test1.type.length)
self.assertIsInstance(self.test_table.c.test2.type, String)
diff --git a/oslo_db/tests/sqlalchemy/test_utils.py b/oslo_db/tests/sqlalchemy/test_utils.py
index 27ed640..50973fa 100644
--- a/oslo_db/tests/sqlalchemy/test_utils.py
+++ b/oslo_db/tests/sqlalchemy/test_utils.py
@@ -1020,7 +1020,7 @@ class TestMigrationUtils(db_test_base._DbTestCase):
normalize_fk_entries(existing_foreign_keys)
)
- with mock.patch("oslo_db.sqlalchemy.ndb.ndb_status",
+ with mock.patch("oslo_db.sqlalchemy.ndb._ndb_status",
mock.Mock(return_value=True)):
with utils.suspend_fk_constraints_for_col_alter(
self.engine, 'a', 'id', referents=['b', 'c']):
@@ -1034,7 +1034,7 @@ class TestMigrationUtils(db_test_base._DbTestCase):
self.assertEqual(existing_foreign_keys, get_fk_entries())
- with mock.patch("oslo_db.sqlalchemy.ndb.ndb_status",
+ with mock.patch("oslo_db.sqlalchemy.ndb._ndb_status",
mock.Mock(return_value=True)):
with utils.suspend_fk_constraints_for_col_alter(
self.engine, 'b', 'archive_id', referents=['c']):