mirror of https://github.com/fail2ban/fail2ban
avoid DNS of local names in fast tests (small optimization)
parent
dd4431cd63
commit
7de1057f94
|
@ -308,6 +308,9 @@ def initTests(opts):
|
|||
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 initTests(opts):
|
|||
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():
|
||||
|
|
Loading…
Reference in New Issue