[OVN][FT] Retry in case of timeout when executing "ovsdb-client".
The shell command "ovsdb-client", in the functional tests, is prone to
timeouts. This patch adds a tenacity decorator and sets the command
timeout to 3 seconds, that should be more than enough to retrieve one
single register.
Closes-Bug: #1955008
Change-Id: I38626835ca809cc3f2894e5f81fab55cf3f40071
(cherry picked from commit 64fddf4f2d
)
This commit is contained in:
parent
4b47f8d930
commit
1f5ce18a14
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
import datetime
|
||||
import functools
|
||||
import subprocess
|
||||
from unittest import mock
|
||||
|
||||
import fixtures as og_fixtures
|
||||
@ -26,6 +27,7 @@ from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
from ovsdbapp.backend.ovs_idl import event
|
||||
from ovsdbapp.backend.ovs_idl import idlutils
|
||||
import tenacity
|
||||
|
||||
from neutron.common.ovn import constants as ovn_const
|
||||
from neutron.common import utils as n_utils
|
||||
@ -144,6 +146,10 @@ class TestNBDbMonitor(base.TestOVNFunctionalBase):
|
||||
'port_id': port['id']}})
|
||||
return r1_f2
|
||||
|
||||
@tenacity.retry(
|
||||
retry=tenacity.retry_if_exception_type(subprocess.TimeoutExpired),
|
||||
wait=tenacity.wait_exponential(multiplier=0.02, max=1),
|
||||
reraise=True)
|
||||
def _check_mac_binding_exists(self, macb_id):
|
||||
cmd = ['ovsdb-client', 'transact',
|
||||
self.mech_driver.sb_ovn.connection_string]
|
||||
@ -156,8 +162,7 @@ class TestNBDbMonitor(base.TestOVNFunctionalBase):
|
||||
cmd += ['["OVN_Southbound", {"op": "select", "table": "MAC_Binding", '
|
||||
'"where": [["_uuid", "==", ["uuid", "%s"]]]}]' % macb_id]
|
||||
|
||||
out, _ = processutils.execute(*cmd,
|
||||
log_errors=False)
|
||||
out, _ = processutils.execute(*cmd, log_errors=False, timeout=3)
|
||||
return str(macb_id) in out
|
||||
|
||||
def test_floatingip_mac_bindings(self):
|
||||
|
Loading…
Reference in New Issue
Block a user