diff options
author | Zuul <zuul@review.opendev.org> | 2021-07-29 14:34:27 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-07-29 14:34:27 +0000 |
commit | 1b48a34bd11f40fc516995ed693d193f28c80b25 (patch) | |
tree | 0ecb44f4ef04690f7b9ac54315535c3de7ae8af0 /oslo_db/tests/sqlalchemy | |
parent | a3ee5b99426f9da5fac2efc399968ee5f865a049 (diff) | |
parent | bd69e86d523a5f44d061310373c0516881bd8624 (diff) | |
download | oslo-db-1b48a34bd11f40fc516995ed693d193f28c80b25.tar.gz |
Merge "Drop checks for IBM DB2"
Diffstat (limited to 'oslo_db/tests/sqlalchemy')
-rw-r--r-- | oslo_db/tests/sqlalchemy/test_exc_filters.py | 74 | ||||
-rw-r--r-- | oslo_db/tests/sqlalchemy/test_sqlalchemy.py | 16 | ||||
-rw-r--r-- | oslo_db/tests/sqlalchemy/test_utils.py | 10 |
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), |