functional: Handle ovsdb monitor returning inserts in different checks

The test case should be satisfied as long as monitor receives the
events; it doesn't matter if the insert events were received at the same
call to process_events.

Closes-Bug: #2095034
Change-Id: Ib5b78c3bdb9f4efbbc9bad9a45be45fb97da3c1d
This commit is contained in:
Ihar Hrachyshka
2025-01-15 13:38:29 -05:00
parent 585ea689d5
commit 9568038198

View File

@@ -65,10 +65,20 @@ class SimpleInterfaceMonitorTestCase(base.BaseSudoTestCase):
p2 = self.useFixture(net_helpers.OVSPortFixture(br_2))
ports_expected = {p1.port.name, p2.port.name}
def process_new_events(mon, ports_expected):
remaining = self._check_port_events(
mon, ports_expected=ports_expected)
# Next time check only the ports not seen yet
ports_expected.clear() # Python doesn't support {:} syntax
ports_expected.update(remaining)
return bool(ports_expected) # True if there are remaining ports
try:
common_utils.wait_until_true(
lambda: not self._check_port_events(
mon_no_filter, ports_expected=ports_expected),
lambda: not process_new_events(mon_no_filter, ports_expected),
timeout=5)
except common_utils.WaitTimeout:
self.fail('Interface monitor not filtered did not received an '