diff options
| author | Christian Hopps <chopps@labn.net> | 2021-06-19 12:09:06 +0000 |
|---|---|---|
| committer | Christian Hopps <chopps@labn.net> | 2021-06-25 05:33:04 +0000 |
| commit | ed776e38f69080febcc5b4d9db8d55b5101cbdf1 (patch) | |
| tree | e8b3dae689ab9900ec24c79c333a5cb117f13ec2 /tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py | |
| parent | d8c3138cd9d18563e291586f1d4c0b2ca0fc9184 (diff) | |
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 <chopps@labn.net>
Diffstat (limited to 'tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py')
| -rw-r--r-- | tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py b/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py index 7864d0307a..0848f6c94a 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py @@ -501,7 +501,7 @@ def test_ospf_routemaps_functionality_tc20_p0(request): dut = "r1" protocol = "ospf" - result = verify_ospf_rib(tgen, dut, input_dict, attempts=2, expected=False) + result = verify_ospf_rib(tgen, dut, input_dict, retry_timeout=4, expected=False) assert ( result is not True ), "Testcase {} : Failed \n " "r1: OSPF routes are present \n Error: {}".format( @@ -509,7 +509,7 @@ def test_ospf_routemaps_functionality_tc20_p0(request): ) result = verify_rib( - tgen, "ipv4", dut, input_dict, protocol=protocol, attempts=2, expected=False + tgen, "ipv4", dut, input_dict, protocol=protocol, retry_timeout=4, expected=False ) assert ( result is not True |
