Commit 41120c00 authored by Daniel Salzman's avatar Daniel Salzman

tests-extra: improve hostname acquisition

parent c6e94b3a
......@@ -25,7 +25,12 @@ resp.check('"' + name + '"')
# 2) FQDN hostname.
resp = server2.dig("id.server", "TXT", "CH")
resp.check(socket.gethostname())
try:
addrinfo = socket.getaddrinfo(socket.gethostname(), 0, socket.AF_UNSPEC,
socket.SOCK_DGRAM, 0, socket.AI_CANONNAME)
resp.check(addrinfo[0][3])
except:
resp.check(socket.gethostname())
# 3) Explicitly disabled.
resp = server3.dig("id.server", "TXT", "CH")
......
......@@ -30,7 +30,12 @@ resp.check_edns(nsid=name)
# 2) FQDN hostname.
resp = server2.dig("example.com", "SOA", nsid=True)
resp.check_edns(nsid=socket.gethostname())
try:
addrinfo = socket.getaddrinfo(socket.gethostname(), 0, socket.AF_UNSPEC,
socket.SOCK_DGRAM, 0, socket.AI_CANONNAME)
resp.check_edns(nsid=addrinfo[0][3])
except:
resp.check_edns(nsid=socket.gethostname())
# 3) Explicitly disabled.
resp = server3.dig("example.com", "SOA", nsid=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment