From e3c1708bddac8d215061d74e40b347041a35ae39 Mon Sep 17 00:00:00 2001 From: Thomas Ward Date: Thu, 9 Apr 2020 09:35:30 -0400 Subject: [PATCH] Reenable DNS tests, catch on dns.resolver.NoNameservers (fix #3793) (#3806) * Enable DNS tests, catch on dns.resolver.NoNameservers for SERVFAILs * Fix log level * FLAKE fixes. --- blacklists.py | 4 ++++ test/test_blacklists.py | 6 ------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/blacklists.py b/blacklists.py index ff664c1c7e..a4edf98b8c 100644 --- a/blacklists.py +++ b/blacklists.py @@ -293,6 +293,10 @@ def item_check(ns): soa = dns.resolver.query(ns, 'soa') log('debug', '{0} has no A record; SOA is {1}'.format( ns, ';'.join(s.to_text() for s in soa))) + except dns.resolver.NoNameservers: + if not item.get('pass', None): + log('warn', '{0} has no available servers to service DNS ' + 'request.'.format(ns)) return True host_regex = regex.compile(r'^([a-z0-9][-a-z0-9]*\.){2,}$') diff --git a/test/test_blacklists.py b/test/test_blacklists.py index b7feb7bf23..b6e67903bc 100755 --- a/test/test_blacklists.py +++ b/test/test_blacklists.py @@ -60,8 +60,6 @@ def test_yaml_blacklist(): assert '3.4.5.6' not in blacklist.parse() unlink('test_ip.yml') - # Temporarily disable to work aroud #3793 - return None yaml_validate_existing('blacklisted_cidrs.yml', YAMLParserCIDR) yaml_validate_existing('watched_cidrs.yml', YAMLParserCIDR) @@ -94,13 +92,9 @@ def test_yaml_asn(): assert '345' not in blacklist.parse() unlink('test_asn.yml') - # Temporarily disable to work aroud #3793 - return None yaml_validate_existing('watched_asns.yml', YAMLParserASN) def test_yaml_nses(): - # Temporarily disable to work around #3793 - return None yaml_validate_existing('blacklisted_nses.yml', YAMLParserNS) yaml_validate_existing('watched_nses.yml', YAMLParserNS)