diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-11-18 17:22:46 +0200 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-11-22 11:17:04 +0200 |
| commit | a5722d5a78c40286bbb68d3b6b611f05e3807683 (patch) | |
| tree | 56eecd33234aa3a9afd761f9c0ff8c9007ffc27c /tests/topotests/lib/topotest.py | |
| parent | c90ff0c4dbc38aa98173561657cd5b549508501a (diff) | |
tests: Fail tests immediately if they use too low wait/count values
This is for run_and_expect_type and run_and_expect topotests method.
Some contributions unintentionally get merged with very low values, that leads
to CI failures, let's guard this a bit.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'tests/topotests/lib/topotest.py')
| -rw-r--r-- | tests/topotests/lib/topotest.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index 5a3f586f82..61cf16944f 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -355,6 +355,16 @@ def run_and_expect(func, what, count=20, wait=3): else: func_name = func.__name__ + # Just a safety-check to avoid running topotests with very + # small wait/count arguments. + wait_time = wait * count + if wait_time < 5: + assert ( + wait_time >= 5 + ), "Waiting time is too small (count={}, wait={}), adjust timer values".format( + count, wait + ) + logger.info( "'{}' polling started (interval {} secs, maximum {} tries)".format( func_name, wait, count @@ -402,6 +412,16 @@ def run_and_expect_type(func, etype, count=20, wait=3, avalue=None): else: func_name = func.__name__ + # Just a safety-check to avoid running topotests with very + # small wait/count arguments. + wait_time = wait * count + if wait_time < 5: + assert ( + wait_time >= 5 + ), "Waiting time is too small (count={}, wait={}), adjust timer values".format( + count, wait + ) + logger.info( "'{}' polling started (interval {} secs, maximum wait {} secs)".format( func_name, wait, int(wait * count) |
