[OVN][FT] Wait for "Chassis_Private" update event
In the ``test__cleanup_previous_tags`` tests, it is needed to wait for the "Chassis_Private" update event before checking the values inside the "external_ids" field. Closes-Bug: #2122505 Signed-off-by: Rodolfo Alonso Hernandez <ralonsoh@redhat.com> Change-Id: Ia116ec5f8661ddebca85d7e2927dfca1398a1168
This commit is contained in:
committed by
Rodolfo Alonso
parent
46f4ef4475
commit
0c59b19c03
@@ -18,6 +18,7 @@ import uuid
|
||||
|
||||
from oslo_config import fixture as fixture_config
|
||||
from oslo_utils import uuidutils
|
||||
from ovsdbapp.backend.ovs_idl import event
|
||||
from ovsdbapp.backend.ovs_idl import idlutils
|
||||
|
||||
from neutron.agent.ovn.agent import ovn_neutron_agent
|
||||
@@ -38,6 +39,14 @@ EXTENSION_NAMES = {TEST_EXTENSION: 'Fake OVN agent extension',
|
||||
}
|
||||
|
||||
|
||||
class ChassisPrivateUpdateEvent(event.WaitEvent):
|
||||
def __init__(self, chassis_private, timeout=5):
|
||||
table = 'Chassis_Private'
|
||||
events = (self.ROW_UPDATE,)
|
||||
conditions = (('name', '=', chassis_private),)
|
||||
super().__init__(events, table, conditions, timeout=timeout)
|
||||
|
||||
|
||||
class TestOVNNeutronAgentBase(base.TestOVNFunctionalBase):
|
||||
|
||||
def setUp(self, extensions, **kwargs):
|
||||
@@ -209,7 +218,11 @@ class TestOVNNeutronAgentMetadataExtension(TestOVNNeutronAgentBase):
|
||||
'Chassis_Private', self.ovn_agent.chassis,
|
||||
('external_ids', external_ids)).execute(check_error=True)
|
||||
|
||||
cp_event = ChassisPrivateUpdateEvent(self.chassis_name)
|
||||
self.ovn_agent.sb_idl.idl.notify_handler.watch_event(cp_event)
|
||||
self.ovn_agent._cleanup_previous_tags()
|
||||
self.assertTrue(cp_event.wait())
|
||||
|
||||
external_ids = self.ovn_agent.sb_idl.db_get(
|
||||
'Chassis_Private', self.ovn_agent.chassis,
|
||||
'external_ids').execute(check_error=True)
|
||||
|
||||
@@ -71,6 +71,14 @@ class PortBindingUpdateEvent(event.WaitEvent):
|
||||
super().__init__(events, table, conditions, timeout=timeout)
|
||||
|
||||
|
||||
class ChassisPrivateUpdateEvent(event.WaitEvent):
|
||||
def __init__(self, chassis_private, timeout=5):
|
||||
table = 'Chassis_Private'
|
||||
events = (self.ROW_UPDATE,)
|
||||
conditions = (('name', '=', chassis_private),)
|
||||
super().__init__(events, table, conditions, timeout=timeout)
|
||||
|
||||
|
||||
class TestMetadataAgent(base.TestOVNFunctionalBase):
|
||||
OVN_BRIDGE = 'br-int'
|
||||
FAKE_CHASSIS_HOST = 'ovn-host-fake'
|
||||
@@ -701,7 +709,11 @@ class TestMetadataAgent(base.TestOVNFunctionalBase):
|
||||
'Chassis_Private', self.chassis_name,
|
||||
('external_ids', external_ids)).execute(check_error=True)
|
||||
|
||||
cp_event = ChassisPrivateUpdateEvent(self.chassis_name)
|
||||
self.agent.sb_idl.idl.notify_handler.watch_event(cp_event)
|
||||
self.agent._cleanup_previous_tags()
|
||||
self.assertTrue(cp_event.wait())
|
||||
|
||||
external_ids = self.sb_api.db_get(
|
||||
'Chassis_Private', self.chassis_name,
|
||||
'external_ids').execute(check_error=True)
|
||||
|
||||
Reference in New Issue
Block a user