diff --git a/fail2ban/tests/utils.py b/fail2ban/tests/utils.py index ef908ddb96..93054d57e4 100644 --- a/fail2ban/tests/utils.py +++ b/fail2ban/tests/utils.py @@ -308,6 +308,9 @@ def F2B_SkipIfNoNetwork(): c.set('2001:db8::ffff', 'test-other') c.set('87.142.124.10', 'test-host') if unittest.F2B.no_network: # pragma: no cover + if unittest.F2B.fast: # pragma: no cover + for i in ('127.0.0.1', '::1'): # DNSUtils.dnsToIp('localhost') + c.set(i, 'localhost') # precache all ip to dns used in test cases: c.set('192.0.2.888', None) c.set('8.8.4.4', 'dns.google') @@ -329,8 +332,9 @@ def F2B_SkipIfNoNetwork(): c.set(*i) # if fast - precache all host names as localhost addresses (speed-up getSelfIPs/ignoreself): if unittest.F2B.fast: # pragma: no cover + ips = set([IPAddr('127.0.0.1'), IPAddr('::1')]); # DNSUtils.dnsToIp('localhost') for i in DNSUtils.getSelfNames(): - c.set(i, DNSUtils.dnsToIp('localhost')) + c.set(i, ips) def mtimesleep():