From ed776e38f69080febcc5b4d9db8d55b5101cbdf1 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Sat, 19 Jun 2021 12:09:06 +0000 Subject: tests: apply KISS to retry fixture This python fixture was way too complex for what is needed. Eliminate gratuitous options/over-engineering: - Change from non-deterministic `wait` and `attempts` to a single `retry_timeout` value. This is both more deterministic, as well as what the user should actually be thinking about. - Use a fixed 2 second pause between executing the wrapped function rather than a bunch of arbitrary choices of 2, 3 and 4 seconds spread all over the test code. - Get rid of the multiple variables for determining what "Positive" and "Negative" results are. Instead just implement what all the user code already wants, i.e., boolean False or a str (errormsg) means "Negative" result otherwise it's a "Positive" result. - As part of the above the inversion logic is much more comprehensible in the fixture code (and more correct to boot). Signed-off-by: Christian Hopps --- .../ospf_basic_functionality/test_ospf_authentication.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/topotests/ospf_basic_functionality/test_ospf_authentication.py') diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py b/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py index 9c3be58937..a7f2893eab 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py @@ -257,7 +257,7 @@ def test_ospf_authentication_simple_pass_tc28_p1(request): sleep(6) dut = "r2" ospf_covergence = verify_ospf_neighbor( - tgen, topo, dut=dut, expected=False, attempts=5 + tgen, topo, dut=dut, expected=False, retry_timeout=10 ) assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format( ospf_covergence @@ -395,7 +395,7 @@ def test_ospf_authentication_md5_tc29_p1(request): sleep(6) dut = "r1" ospf_covergence = verify_ospf_neighbor( - tgen, topo, dut=dut, expected=False, attempts=3 + tgen, topo, dut=dut, expected=False, retry_timeout=6 ) assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format( ospf_covergence @@ -460,7 +460,7 @@ def test_ospf_authentication_md5_tc29_p1(request): sleep(6) dut = "r2" ospf_covergence = verify_ospf_neighbor( - tgen, topo, dut=dut, expected=False, attempts=5 + tgen, topo, dut=dut, expected=False, retry_timeout=10 ) assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format( ospf_covergence @@ -610,7 +610,7 @@ def test_ospf_authentication_different_auths_tc30_p1(request): step("Verify that the neighbour is not FULL between R1 and R2.") dut = "r1" ospf_covergence = verify_ospf_neighbor( - tgen, topo, dut=dut, expected=False, attempts=5 + tgen, topo, dut=dut, expected=False, retry_timeout=10 ) assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format( ospf_covergence -- cgit v1.2.3