summaryrefslogtreecommitdiff
path: root/oslo_db/tests/sqlalchemy
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2021-03-31 18:36:35 +0100
committerStephen Finucane <stephenfin@redhat.com>2021-07-28 18:10:53 +0100
commitbd69e86d523a5f44d061310373c0516881bd8624 (patch)
treeecf53a232b1a198358a75aa512a932d4af2ef123 /oslo_db/tests/sqlalchemy
parentf3bdd4d4220a884e4752ce6b61c2605bfd72f2fb (diff)
downloadoslo-db-bd69e86d523a5f44d061310373c0516881bd8624.tar.gz
Drop checks for IBM DB2
This hasn't been supported by any project for many years. Quoting from the nova patch that removed DB2 support [1] This removes db2 support from tree completely. This is an oddball non open database that made doing live data migrations difficult. It is used by 0% of users in the OpenStack User Survey. Supporting commercial software that doesn't have users at the cost of delivering features and fixes to our community is the wrong tradeoff. This corrects that. There's no need to keep this around. [1] Ifeb9929e4515e3483eb65d371126afd7672b92a4 Change-Id: I8c3f23083e09e5ac924e35d1b7b3248a0d074e1b Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Diffstat (limited to 'oslo_db/tests/sqlalchemy')
-rw-r--r--oslo_db/tests/sqlalchemy/test_exc_filters.py74
-rw-r--r--oslo_db/tests/sqlalchemy/test_sqlalchemy.py16
-rw-r--r--oslo_db/tests/sqlalchemy/test_utils.py10
3 files changed, 3 insertions, 97 deletions
diff --git a/oslo_db/tests/sqlalchemy/test_exc_filters.py b/oslo_db/tests/sqlalchemy/test_exc_filters.py
index 677516d..532c949 100644
--- a/oslo_db/tests/sqlalchemy/test_exc_filters.py
+++ b/oslo_db/tests/sqlalchemy/test_exc_filters.py
@@ -881,28 +881,6 @@ class TestDuplicate(TestsExceptionFilter):
exception.DBError
)
- def test_ibm_db_sa(self):
- self._run_dupe_constraint_test(
- 'ibm_db_sa',
- 'SQL0803N One or more values in the INSERT statement, UPDATE '
- 'statement, or foreign key update caused by a DELETE statement are'
- ' not valid because the primary key, unique constraint or unique '
- 'index identified by "2" constrains table "NOVA.KEY_PAIRS" from '
- 'having duplicate values for the index key.',
- expected_columns=[]
- )
-
- def test_ibm_db_sa_notadupe(self):
- self._not_dupe_constraint_test(
- 'ibm_db_sa',
- 'ALTER TABLE instance_types ADD CONSTRAINT '
- 'uniq_name_x_deleted UNIQUE (name, deleted)',
- 'SQL0542N The column named "NAME" cannot be a column of a '
- 'primary key or unique key constraint because it can contain null '
- 'values.',
- exception.DBError
- )
-
class TestDeadlock(TestsExceptionFilter):
statement = ('SELECT quota_usages.created_at AS '
@@ -1004,25 +982,6 @@ class TestDeadlock(TestsExceptionFilter):
orig_exception_cls=self.TransactionRollbackError
)
- def test_ibm_db_sa_deadlock(self):
- self._run_deadlock_detect_test(
- "ibm_db_sa",
- "SQL0911N The current transaction has been "
- "rolled back because of a deadlock or timeout",
- # use the lowest class b.c. I don't know what actual error
- # class DB2's driver would raise for this
- orig_exception_cls=self.Error
- )
-
- def test_ibm_db_sa_not_deadlock(self):
- self._not_deadlock_test(
- "ibm_db_sa",
- "SQL01234B Some other error.",
- exception.DBError,
- "Error",
- orig_exception_cls=self.Error
- )
-
class TestDataError(TestsExceptionFilter):
def _run_bad_data_test(self, dialect_name, message, error_class):
@@ -1256,21 +1215,6 @@ class TestDBDisconnected(TestsExceptionFilter):
is_disconnect=False
)
- def test_db2_ping_listener_disconnected(self):
- self._test_ping_listener_disconnected(
- "ibm_db_sa",
- self.OperationalError(
- 'SQL30081N: DB2 Server connection is no longer active')
- )
-
- def test_db2_ping_listener_disconnected_regex_only(self):
- self._test_ping_listener_disconnected(
- "ibm_db_sa",
- self.OperationalError(
- 'SQL30081N: DB2 Server connection is no longer active'),
- is_disconnect=False
- )
-
def test_postgresql_ping_listener_disconnected(self):
self._test_ping_listener_disconnected(
"postgresql",
@@ -1355,24 +1299,6 @@ class TestDBConnectRetry(TestsExceptionFilter):
3, 2
)
- def test_db2_error_positive(self):
- conn = self._run_test(
- "ibm_db_sa",
- self.OperationalError("blah blah -30081 blah blah"),
- 2, -1
- )
- # conn is good
- self.assertEqual(1, conn.scalar(sqla.select([1])))
-
- def test_db2_error_negative(self):
- self.assertRaises(
- sqla.exc.OperationalError,
- self._run_test,
- "ibm_db_sa",
- self.OperationalError("blah blah -39981 blah blah"),
- 2, 3
- )
-
class TestDBConnectPingWrapping(TestsExceptionFilter):
diff --git a/oslo_db/tests/sqlalchemy/test_sqlalchemy.py b/oslo_db/tests/sqlalchemy/test_sqlalchemy.py
index 2dd863a..cd30f15 100644
--- a/oslo_db/tests/sqlalchemy/test_sqlalchemy.py
+++ b/oslo_db/tests/sqlalchemy/test_sqlalchemy.py
@@ -202,22 +202,6 @@ class ProgrammingError(Exception):
pass
-class FakeDB2Engine(object):
-
- class Dialect(object):
-
- def is_disconnect(self, e, *args):
- expected_error = ('SQL30081N: DB2 Server connection is no longer '
- 'active')
- return (str(e) == expected_error)
-
- dialect = Dialect()
- name = 'ibm_db_sa'
-
- def dispose(self):
- pass
-
-
class QueryParamTest(test_base.DbTestCase):
def _fixture(self):
from sqlalchemy import create_engine
diff --git a/oslo_db/tests/sqlalchemy/test_utils.py b/oslo_db/tests/sqlalchemy/test_utils.py
index 50f4af1..9923856 100644
--- a/oslo_db/tests/sqlalchemy/test_utils.py
+++ b/oslo_db/tests/sqlalchemy/test_utils.py
@@ -20,7 +20,7 @@ import fixtures
from oslotest import base as test_base
import sqlalchemy
from sqlalchemy.dialects import mysql
-from sqlalchemy import Boolean, Index, Integer, DateTime, String, SmallInteger
+from sqlalchemy import Boolean, Index, Integer, DateTime, String
from sqlalchemy import CheckConstraint
from sqlalchemy import MetaData, Table, Column
from sqlalchemy import ForeignKey, ForeignKeyConstraint
@@ -847,8 +847,7 @@ class TestMigrationUtils(db_test_base._DbTestCase):
self.assertIsInstance(table.c.deleted.type, Integer)
def test_change_deleted_column_type_to_boolean(self):
- expected_types = {'mysql': mysql.TINYINT,
- 'ibm_db_sa': SmallInteger}
+ expected_types = {'mysql': mysql.TINYINT}
table_name = 'abc'
table = Table(table_name, self.meta,
Column('id', Integer, primary_key=True),
@@ -862,8 +861,7 @@ class TestMigrationUtils(db_test_base._DbTestCase):
expected_types.get(self.engine.name, Boolean))
def test_change_deleted_column_type_to_boolean_with_fc(self):
- expected_types = {'mysql': mysql.TINYINT,
- 'ibm_db_sa': SmallInteger}
+ expected_types = {'mysql': mysql.TINYINT}
table_name_1 = 'abc'
table_name_2 = 'bcd'
@@ -1605,7 +1603,6 @@ class TestDialectFunctionDispatcher(test_base.BaseTestCase):
dispatcher("postgresql+pyodbc://", 1)
dispatcher("mysql+pymysql://", 2)
- dispatcher("ibm_db_sa+db2://", 3)
dispatcher("postgresql+psycopg2://", 4)
dispatcher("postgresql://", 5)
@@ -1620,7 +1617,6 @@ class TestDialectFunctionDispatcher(test_base.BaseTestCase):
mock.call.mysql_pymysql('mysql+pymysql://', 2),
mock.call.mysql('mysql+pymysql://', 2),
mock.call.default('mysql+pymysql://', 2),
- mock.call.default('ibm_db_sa+db2://', 3),
mock.call.postgresql_psycopg2('postgresql+psycopg2://', 4),
mock.call.postgresql('postgresql+psycopg2://', 4),
mock.call.default('postgresql+psycopg2://', 4),