summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-10-13 13:53:03 +0000
committerGerrit Code Review <review@openstack.org>2022-10-13 13:53:03 +0000
commit8c7ecfd93eb0e4f821fb48b85c75ec89a52185fd (patch)
tree502217823e1dd179112651223e0fad1a34863c4c
parentea9a9d8736ee8cfa714b37f327b924e8df7a8676 (diff)
parent437a19703d63801997f2ccece516a2790d438cee (diff)
downloadoslo-db-8c7ecfd93eb0e4f821fb48b85c75ec89a52185fd.tar.gz
Merge "tests: Fix compatibility with PostgreSQL 14+"
-rw-r--r--oslo_db/tests/sqlalchemy/test_exc_filters.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/oslo_db/tests/sqlalchemy/test_exc_filters.py b/oslo_db/tests/sqlalchemy/test_exc_filters.py
index 53789f5..7e03fce 100644
--- a/oslo_db/tests/sqlalchemy/test_exc_filters.py
+++ b/oslo_db/tests/sqlalchemy/test_exc_filters.py
@@ -462,10 +462,20 @@ class TestNonExistentDatabasePostgreSQL(
self.url
)
self.assertEqual('non_existent_database', matched.database)
- self.assertInnerException(
- matched,
+ # NOTE(stephenfin): As above, we cannot use assertInnerException since
+ # the error messages vary depending on the version of PostgreSQL
+ self.assertIsInstance(
+ matched.inner_exception,
sqlalchemy.exc.OperationalError,
- 'fatal: database "non_existent_database" does not exist\n',
+ )
+ # On Postgres 13:
+ # fatal: database "non_existent_database" does not exist
+ # On Postgres 14 or later:
+ # connection to server at "localhost" (::1), port 5432 failed: fatal:
+ # database "non_existent_database" does not exist
+ self.assertIn(
+ 'fatal: database "non_existent_database" does not exist',
+ str(matched.inner_exception).lower(),
)