Merge "[FT] Use an active wait in `test__cleanup_previous_tags`"

This commit is contained in:
Zuul
2025-11-05 17:01:53 +00:00
committed by Gerrit Code Review

View File

@@ -71,14 +71,6 @@ 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,19 +693,8 @@ class TestMetadataAgent(base.TestOVNFunctionalBase):
"Provisioning wasn't triggered"))
def test__cleanup_previous_tags(self):
external_ids = {
ovn_const.OVN_AGENT_NEUTRON_SB_CFG_KEY: '1',
ovn_const.OVN_AGENT_NEUTRON_DESC_KEY: 'description',
ovn_const.OVN_AGENT_NEUTRON_ID_KEY: uuidutils.generate_uuid()}
self.sb_api.db_set(
'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())
def check_tags():
try:
external_ids = self.sb_api.db_get(
'Chassis_Private', self.chassis_name,
'external_ids').execute(check_error=True)
@@ -726,3 +707,17 @@ class TestMetadataAgent(base.TestOVNFunctionalBase):
for _key in (ovn_const.OVN_AGENT_METADATA_SB_CFG_KEY,
ovn_const.OVN_AGENT_METADATA_ID_KEY):
self.assertIn(_key, external_ids)
return True
except Exception:
return False
external_ids = {
ovn_const.OVN_AGENT_NEUTRON_SB_CFG_KEY: '1',
ovn_const.OVN_AGENT_NEUTRON_DESC_KEY: 'description',
ovn_const.OVN_AGENT_NEUTRON_ID_KEY: uuidutils.generate_uuid()}
self.sb_api.db_set(
'Chassis_Private', self.chassis_name,
('external_ids', external_ids)).execute(check_error=True)
self.agent._cleanup_previous_tags()
n_utils.wait_until_true(check_tags, timeout=10)