]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: Allow ping to run multiple times before failing
authorDonald Sharp <sharpd@nvidia.com>
Sat, 27 May 2023 12:50:01 +0000 (08:50 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Sun, 28 May 2023 11:37:25 +0000 (07:37 -0400)
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 <sharpd@nvidia.com>
tests/topotests/bgp_default_originate/test_bgp_default_originate_2links.py

index 8058823baf5b1fbd3ff8411054f446a629ffe8d2..75e66566b75bf54549954320288afb9c79e91c64 100644 (file)
@@ -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")