From 72d3987c86ec143f4c5f38ca4c865c35bbc44b41 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Mon, 6 Jul 2020 20:14:21 -0700 Subject: Give up on socket.getfqdn() testing with CDN-hosted resources as it has too much magic. --- tests/test_resolver_override.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/test_resolver_override.py b/tests/test_resolver_override.py index 5f93281..73484f6 100644 --- a/tests/test_resolver_override.py +++ b/tests/test_resolver_override.py @@ -118,13 +118,22 @@ class OverrideSystemResolverTestCase(unittest.TestCase): except socket.gaierror as e: self.assertEqual(e.errno, socket.EAI_NONAME) - def test_getfqdn(self): - b = socket.getfqdn('www.dnspython.org') - # we do this now because python's original getfqdn calls - # gethostbyaddr() and we don't want it to call us! - dns.resolver.restore_system_resolver() - a = dns.resolver._original_getfqdn('www.dnspython.org') - self.assertEqual(dns.name.from_text(a), dns.name.from_text(b)) +# Give up on testing this for now as all of the names I've considered +# using for testing are part of CDNs and there is deep magic in +# gethostbyaddr() that python's getfqdn() is using. At any rate, +# the problem is that dnspython just gives up whereas the native python +# code is looking up www.dnspython.org, picking a CDN IPv4 address +# (sometimes) and returning the reverse lookup of that address (i.e. +# the domain name of the CDN server). This isn't what I'd consider the +# FQDN of www.dnspython.org to be! +# +# def test_getfqdn(self): +# b = socket.getfqdn('www.dnspython.org') +# # we do this now because python's original getfqdn calls +# # gethostbyaddr() and we don't want it to call us! +# dns.resolver.restore_system_resolver() +# a = dns.resolver._original_getfqdn('www.dnspython.org') +# self.assertEqual(dns.name.from_text(a), dns.name.from_text(b)) def test_gethostbyaddr(self): a = dns.resolver._original_gethostbyaddr('8.8.8.8') -- cgit v1.2.1