OVN TestNBDbResources wait for NB_Global table to be present

In functional jobs (neutron-functional-with-uwsgi)
test_ovn_db_resources.TestNBDbResources.test_port_dhcp_options failes
time-to-time at the phase of creating network.
Wait for NB_Global table at the setUp() phase of TestNBDbResources.

Change-Id: I92132233dae77ffbbd5565caa320c7dac19e2194
Closes-Bug: #1956965
This commit is contained in:
elajkat
2022-01-20 15:56:58 +01:00
parent 528a516768
commit 654c3b796f

View File

@@ -24,6 +24,7 @@ from ovsdbapp.backend.ovs_idl import idlutils
from neutron.common.ovn import constants as ovn_const
from neutron.common.ovn import utils
from neutron.common import utils as n_utils
from neutron.conf.plugins.ml2.drivers.ovn import ovn_conf as ovn_config
from neutron.tests.functional import base
@@ -31,6 +32,13 @@ from neutron.tests.functional import base
class TestNBDbResources(base.TestOVNFunctionalBase):
_extension_drivers = ['dns']
def _is_nb_global_ready(self):
try:
next(iter(self.nb_api.tables['NB_Global'].rows))
except StopIteration:
return False
return True
def setUp(self):
super(TestNBDbResources, self).setUp()
self.orig_get_random_mac = n_net.get_random_mac
@@ -40,6 +48,12 @@ class TestNBDbResources(base.TestOVNFunctionalBase):
group='ovn')
ovn_config.cfg.CONF.set_override('dns_domain', 'ovn.test')
# Wait for NB_Global table, for details see: LP #1956965
n_utils.wait_until_true(
self._is_nb_global_ready,
timeout=15, sleep=1
)
# FIXME(lucasagomes): Map the revision numbers properly instead
# of stripping them out. Currently, tests like test_dhcp_options()
# are quite complex making it difficult to map the exact the revision