Browse Source

avoid DNS of local names in fast tests (small optimization)

pull/3381/head
sebres 11 months ago
parent
commit
7de1057f94
  1. 6
      fail2ban/tests/utils.py

6
fail2ban/tests/utils.py

@ -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…
Cancel
Save