Drop retries in tests for TimeoutException

It was originally added due to [1] which is
already reverted[2] as pyroute2>=0.5.5 included
the fix, so the retries hack can also be removed.

[1] https://review.opendev.org/c/openstack/neutron/+/631275
[2] https://review.opendev.org/c/openstack/neutron/+/698854

Related-Bug: #1811515
Change-Id: I6d7b1c82c19d93c4a24f253bdc4c5b6164cfbaaa
This commit is contained in:
yatinkarel 2023-05-05 12:08:16 +05:30
parent fd17662611
commit 6eb7006801
1 changed files with 4 additions and 23 deletions

View File

@ -46,7 +46,6 @@ from oslotest import base
from osprofiler import profiler
from sqlalchemy import exc as sqlalchemy_exc
import testtools
from testtools import content
from neutron._i18n import _
from neutron.agent.linux import external_process
@ -68,8 +67,6 @@ ETCDIR = os.path.join(ROOTDIR, 'etc')
SUDO_CMD = 'sudo -n'
TESTCASE_RETRIES = 3
def etcdir(*p):
return os.path.join(ETCDIR, *p)
@ -177,26 +174,10 @@ class AttributeDict(dict):
def _catch_timeout(f):
@functools.wraps(f)
def func(self, *args, **kwargs):
for idx in range(1, TESTCASE_RETRIES + 1):
try:
return f(self, *args, **kwargs)
except eventlet.Timeout as e:
self.fail('Execution of this test timed out: %s' % e)
# NOTE(ralonsoh): exception catch added due to the constant
# occurrences of this exception during FT and UT execution.
# This is due to [1]. Once the sync decorators are removed or the
# privsep ones are decorated by those ones (swap decorator
# declarations) this catch can be remove.
# [1] https://review.opendev.org/#/c/631275/
except fixtures.TimeoutException:
if idx < TESTCASE_RETRIES:
msg = ('"fixtures.TimeoutException" during test case '
'execution no %s; test case re-executed' % idx)
self.addDetail('DietTestCase',
content.text_content(msg))
self._set_timeout()
else:
self.fail('Execution of this test timed out')
try:
return f(self, *args, **kwargs)
except eventlet.Timeout as e:
self.fail('Execution of this test timed out: %s' % e)
return func