The results that we get back from DNS are returned in an arbitrary
order. Technically that's fine, because all we want to see is the
set-difference between the actual/expected results. However, it breaks
our test suite which needs to know what certain examples will
output. This commit sorts the results, so that the output is a little
bit more deterministic (subject to network issues and changes).
.I $ echo \(dqexample.com\(dq | \\\\
.I " haeredes \-\-no\-append\-root a.iana-servers.net b.iana-servers.net"
Domain \(dqexample.com\(dq delegates somewhere else:
-\(dqb.iana-servers.net.\(dq \(dqa.iana-servers.net.\(dq
+\(dqa.iana-servers.net.\(dq \(dqb.iana-servers.net.\(dq
.fi
.IP \[bu]
Check orlitzky.com against the expected name servers, using
getContents,
pack,
words )
-import Data.List ( (\\), intersperse )
+import Data.List ( (\\), intersperse, sort )
import Network.DNS (
DNSError(NameError),
Domain,
-- report the leftovers.
report delgts normalize_function (d, Right raw_hosts) = do
let nrml_hosts = map normalize_function raw_hosts
- let leftovers = nrml_hosts \\ delgts
+ -- Sort the leftovers so that we can test the expected output.
+ let leftovers = sort (nrml_hosts \\ delgts)
unless (null leftovers) $
putStrLn $ "Domain " ++
(show d) ++
# (without adding the trailing dot), then things go wrong.
echo "example.com" | dist/build/haeredes/haeredes --no-append-root a.iana-servers.net b.iana-servers.net
>>>
-Domain "example.com" delegates somewhere else: "b.iana-servers.net." "a.iana-servers.net."
+Domain "example.com" delegates somewhere else: "a.iana-servers.net." "b.iana-servers.net."
>>>= 0