From 654c3b796fb467f92ce06528f64904086b0beb17 Mon Sep 17 00:00:00 2001 From: elajkat Date: Thu, 20 Jan 2022 15:56:58 +0100 Subject: [PATCH] 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 --- .../ovn/mech_driver/ovsdb/test_ovn_db_resources.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_resources.py b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_resources.py index 241677e9375..aeb5c084b25 100644 --- a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_resources.py +++ b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_resources.py @@ -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