diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2022-11-28 08:10:23 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-28 08:10:23 -0500 |
| commit | d58334ea1c09a911f801e5dd4781af83ae19f689 (patch) | |
| tree | e79dd7dc9189e02da505f421c92d1a06381ab80d /tests/topotests/lib/topotest.py | |
| parent | 398c407399280bdc2fcab02f0950218d236a5e69 (diff) | |
| parent | d3a6af081ed18ce245ccaa89d6096ac034bb09cf (diff) | |
Merge pull request #12342 from opensourcerouting/fix/small_waiting_times
tests: Fail tests immediately if they use too low wait/count values
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) |
