]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tests: Modify pbr test to give a reasonable amount of time to succeed
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 15 Jun 2020 20:59:38 +0000 (16:59 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 15 Jun 2020 20:59:38 +0000 (16:59 -0400)
Under heavy load some systems may still be processing.  Let's give
the system some time to figure out what is going wrong.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
tests/topotests/pbr-topo1/test_pbr_topo1.py

index 7de1cfa519d538aa2a535f36dafccfccc4e67d9b..63d1f26d1cc3783f9e5c266410ef00685c2526d7 100755 (executable)
@@ -32,6 +32,7 @@ import re
 import sys
 import pytest
 import json
+from functools import partial
 
 # Save the Current Working Directory to find configuration files.
 CWD = os.path.dirname(os.path.realpath(__file__))
@@ -140,9 +141,10 @@ def test_pbr_data():
         expected = json.loads(open(intf_file).read())
 
         # Actual output from router
-        actual = router.vtysh_cmd("show pbr interface json", isjson=True)
+        test_func = partial(topotest.router_json_cmp, router, "show pbr interface json", expected)
+        _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
         assertmsg = '"show pbr interface" mismatches on {}'.format(router.name)
-        assert topotest.json_cmp(actual, expected) is None, assertmsg
+        assert result is None, assertmsg
 
         map_file = "{}/{}/pbr-map.json".format(CWD, router.name)
         logger.info(map_file)
@@ -151,10 +153,10 @@ def test_pbr_data():
         expected = json.loads(open(map_file).read())
 
         # Actual output from router
-        actual = router.vtysh_cmd("show pbr map json", isjson=True)
-
+        test_func = partial(topotest.router_json_cmp, router, "show pbr map json", expected)
+        _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
         assertmsg = '"show pbr map" mismatches on {}'.format(router.name)
-        assert topotest.json_cmp(actual, expected) is None, assertmsg
+        assert result is None, assertmsg
 
         nexthop_file = "{}/{}/pbr-nexthop-groups.json".format(CWD, router.name)
         logger.info(nexthop_file)
@@ -163,11 +165,10 @@ def test_pbr_data():
         expected = json.loads(open(nexthop_file).read())
 
         # Actual output from router
-        actual = router.vtysh_cmd("show pbr nexthop-groups json", isjson=True)
-
+        test_func = partial(topotest.router_json_cmp, router, "show pbr nexthop-groups json", expected)
+        _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
         assertmsg = '"show pbr nexthop-groups" mismatches on {}'.format(router.name)
-        assert topotest.json_cmp(actual, expected) is None, assertmsg
-
+        assert result is None, assertmsg
 
 def test_pbr_flap():
     "Test PBR interface flapping"
@@ -199,10 +200,10 @@ def test_pbr_flap():
         expected = json.loads(open(intf_file).read())
 
         # Actual output from router
-        actual = router.vtysh_cmd("show pbr interface json", isjson=True)
+        test_func = partial(topotest.router_json_cmp, router, "show pbr interface json", expected)
+        _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
         assertmsg = '"show pbr interface" mismatches on {}'.format(router.name)
-
-        assert topotest.json_cmp(actual, expected) is None, assertmsg
+        assert result is None, assertmsg
 
 
 def test_rule_linux_installation():