From: Donald Sharp Date: Sat, 27 May 2023 12:50:01 +0000 (-0400) Subject: tests: Allow ping to run multiple times before failing X-Git-Tag: base_9.0~26^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=131153ea22aa3de94e36b2caf06d45068b0393de;p=mirror%2Ffrr.git tests: Allow ping to run multiple times before failing the bgp_default_originate test brings up the topology and then immediately pings. Which sometimes fails. This is of course possible since the first ping might actually fail due to arp going on. So let's give it a second chance or two. Especially since the test, at this point, is just installing a default route. Signed-off-by: Donald Sharp --- diff --git a/tests/topotests/bgp_default_originate/test_bgp_default_originate_2links.py b/tests/topotests/bgp_default_originate/test_bgp_default_originate_2links.py index 8058823baf..75e66566b7 100644 --- a/tests/topotests/bgp_default_originate/test_bgp_default_originate_2links.py +++ b/tests/topotests/bgp_default_originate/test_bgp_default_originate_2links.py @@ -26,6 +26,7 @@ from time import sleep from lib.topogen import Topogen, get_topogen from lib.topojson import build_config_from_json from lib.topolog import logger +from lib import topotest from lib.bgp import ( verify_bgp_convergence, @@ -1559,8 +1560,14 @@ def test_verify_default_originate_with_2way_ecmp_p2(request): step("Ping R1 configure IPv4 and IPv6 loopback address from R2") pingaddr = topo["routers"]["r1"]["links"]["lo"]["ipv4"].split("/")[0] router = tgen.gears["r2"] - output = router.run("ping -c 4 -w 4 {}".format(pingaddr)) - assert " 0% packet loss" in output, "Ping R1->R2 FAILED" + + def ping_router(): + output = router.run("ping -c 4 -w 4 {}".format(pingaddr)) + logger.info(output) + if " 0% packet loss" not in output: + return False + + _, res = topotest.run_and_expect(ping_router, None, count=10, wait=1) logger.info("Ping from R1 to R2 ... success") step("Shuting up the active route")