Handle DBConnectionError in skip_if_timeout decorator
In some cases it may happen that when db test will fail due
to timeout oslo_db.exception.DBConnectionError will be raised
instead of sqlalchemy_exc.InterfaceError.
This patch adds handling such case in skip_if_timeout decorator.
Change-Id: I7350d5c884784317c94ff42f28526065ff399b40
Related-Bug: #1687027
(cherry picked from commit b7458b6159
)
This commit is contained in:
parent
7ba0d8fb49
commit
d6189d3bc3
|
@ -30,6 +30,7 @@ from neutron_lib.callbacks import manager as registry_manager
|
||||||
from neutron_lib import fixture
|
from neutron_lib import fixture
|
||||||
from oslo_concurrency.fixture import lockutils
|
from oslo_concurrency.fixture import lockutils
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
from oslo_db import exception as db_exceptions
|
||||||
from oslo_db import options as db_options
|
from oslo_db import options as db_options
|
||||||
from oslo_messaging import conffixture as messaging_conffixture
|
from oslo_messaging import conffixture as messaging_conffixture
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
|
@ -109,7 +110,8 @@ def skip_if_timeout(reason):
|
||||||
msg = ("Timeout raised for test %s, skipping it "
|
msg = ("Timeout raised for test %s, skipping it "
|
||||||
"because of: %s") % (self.id(), reason)
|
"because of: %s") % (self.id(), reason)
|
||||||
raise self.skipTest(msg)
|
raise self.skipTest(msg)
|
||||||
except sqlalchemy_exc.InterfaceError:
|
except (sqlalchemy_exc.InterfaceError,
|
||||||
|
db_exceptions.DBConnectionError):
|
||||||
# In case of db tests very often TimeoutException is reason of
|
# In case of db tests very often TimeoutException is reason of
|
||||||
# some sqlalchemy InterfaceError exception and that is final
|
# some sqlalchemy InterfaceError exception and that is final
|
||||||
# raised exception which needs to be handled
|
# raised exception which needs to be handled
|
||||||
|
|
Loading…
Reference in New Issue