From 09249be0a0a778feba12ee5475d1feac2860f63c Mon Sep 17 00:00:00 2001 From: Brian Cunnie Date: Tue, 1 Dec 2020 09:22:24 -0800 Subject: [PATCH] CI: don't double-count the nameservers On macOS, `whois` returns _two_ results for the domain `sslip.io` from two different whois servers: - whois.nic.io - whois.namecheap.com This means that every nameservers is double-counted. To fix, we remove the duplicates. fixes: ``` Failure/Error: expect(dig_nameservers.sort).to eq(whois_nameservers.sort) expected: ["ns-aws.nono.io.", "ns-aws.nono.io.", "ns-azure.nono.io.", "ns-azure.nono.io.", "ns-gce.nono.io.", "ns-gce.nono.io."] got: ["ns-aws.nono.io.", "ns-azure.nono.io.", "ns-gce.nono.io."] (compared using ==) # ./spec/check-dns_spec.rb:44:in `block (3 levels) in ' ``` --- spec/check-dns_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/check-dns_spec.rb b/spec/check-dns_spec.rb index 9bc34f1..72a5acc 100644 --- a/spec/check-dns_spec.rb +++ b/spec/check-dns_spec.rb @@ -11,7 +11,7 @@ def get_whois_nameservers(domain) soa = nil whois_lines = whois_output.split(/\n+/) nameserver_lines = whois_lines.select { |line| line =~ /^Name Server:/ } - nameservers = nameserver_lines.map { |line| line.split.last.downcase } + nameservers = nameserver_lines.map { |line| line.split.last.downcase }.uniq # whois records don't have trail '.'; NS records do; add trailing '.' nameservers.map { |ns| ns << '.' } nameservers