Merge "Ensure PostgreSQL connection errors are wrapped"

This commit is contained in:
Jenkins 2015-01-06 02:07:43 +00:00 committed by Gerrit Code Review
commit 98b434db7d
2 changed files with 16 additions and 0 deletions

View File

@ -270,6 +270,7 @@ def _raise_operational_errors_directly_filter(operational_error,
@filters("mysql", sqla_exc.OperationalError, r".*\(.*(?:2002|2003|2006|2013)") @filters("mysql", sqla_exc.OperationalError, r".*\(.*(?:2002|2003|2006|2013)")
@filters("postgresql", sqla_exc.OperationalError, r".*could not connect to server") # noqa
@filters("ibm_db_sa", sqla_exc.OperationalError, r".*(?:30081)") @filters("ibm_db_sa", sqla_exc.OperationalError, r".*(?:30081)")
def _is_db_connection_error(operational_error, match, engine_name, def _is_db_connection_error(operational_error, match, engine_name,
is_disconnect): is_disconnect):

View File

@ -745,6 +745,21 @@ class TestDBDisconnected(TestsExceptionFilter):
is_disconnect=False is_disconnect=False
) )
def test_postgresql_ping_listener_disconnected(self):
self._test_ping_listener_disconnected(
"postgresql",
self.OperationalError(
"could not connect to server: Connection refused"),
)
def test_postgresql_ping_listener_disconnected_regex_only(self):
self._test_ping_listener_disconnected(
"postgresql",
self.OperationalError(
"could not connect to server: Connection refused"),
is_disconnect=False
)
class TestDBConnectRetry(TestsExceptionFilter): class TestDBConnectRetry(TestsExceptionFilter):