mirror of https://github.com/fail2ban/fail2ban
tweaks to speedup test-cases (test-suite seems to be time stable now, so we could shorten sleeping intervals)
parent
7f0010be68
commit
55d6408b13
|
@ -292,15 +292,15 @@ def initTests(opts):
|
|||
unittest.F2B.SkipIfFast = F2B_SkipIfFast
|
||||
else:
|
||||
# smaller inertance inside test-cases (litle speedup):
|
||||
Utils.DEFAULT_SLEEP_TIME = 0.25
|
||||
Utils.DEFAULT_SLEEP_INTERVAL = 0.025
|
||||
Utils.DEFAULT_SLEEP_TIME = 0.025
|
||||
Utils.DEFAULT_SLEEP_INTERVAL = 0.005
|
||||
Utils.DEFAULT_SHORT_INTERVAL = 0.0005
|
||||
# sleep intervals are large - use replacement for sleep to check time to sleep:
|
||||
_org_sleep = time.sleep
|
||||
def _new_sleep(v):
|
||||
if v > max(1, Utils.DEFAULT_SLEEP_TIME): # pragma: no cover
|
||||
if v > 0.25: # pragma: no cover
|
||||
raise ValueError('[BAD-CODE] To long sleep interval: %s, try to use conditional Utils.wait_for instead' % v)
|
||||
_org_sleep(min(v, Utils.DEFAULT_SLEEP_TIME))
|
||||
_org_sleep(v)
|
||||
time.sleep = _new_sleep
|
||||
# --no-network :
|
||||
if unittest.F2B.no_network: # pragma: no cover
|
||||
|
|
Loading…
Reference in New Issue