From 2ca908755cca6db723ceffc7ccd362eb2d52ee73 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 23 May 2022 08:16:56 -0400 Subject: [PATCH] tests: pbr_topo1 sometimes fails under really heavy load This test is sometimes failing under severe load. Give some time for the linux rule installation to actually be registered by the system before declaring failure. Signed-off-by: Donald Sharp --- tests/topotests/pbr_topo1/test_pbr_topo1.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/topotests/pbr_topo1/test_pbr_topo1.py b/tests/topotests/pbr_topo1/test_pbr_topo1.py index 586d9217d2..8506a15135 100644 --- a/tests/topotests/pbr_topo1/test_pbr_topo1.py +++ b/tests/topotests/pbr_topo1/test_pbr_topo1.py @@ -234,15 +234,23 @@ def test_rule_linux_installation(): logger.info("Checking for installed PBR rules in OS") + def _get_router_rules(router, expected): + actual = topotest.ip_rules(router) + + logger.info(actual) + return topotest.json_cmp(actual, expected) + router_list = tgen.routers().values() for router in router_list: rules_file = "{}/{}/linux-rules.json".format(CWD, router.name) - actual = topotest.ip_rules(router) expected = json.loads(open(rules_file).read()) + test_func = partial(_get_router_rules, router, expected) + + _, result = topotest.run_and_expect(test_func, None, count=20, wait=1) assertmsg = "Router {} OS rules mismatch".format(router.name) - assert topotest.json_cmp(actual, expected) is None, assertmsg + assert result is None, assertmsg if __name__ == "__main__":