mirror of
https://github.com/cunnie/sslip.io.git
synced 2025-10-05 23:56:50 +08:00
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 <top (required)>' ```
This commit is contained in:
@@ -11,7 +11,7 @@ def get_whois_nameservers(domain)
|
|||||||
soa = nil
|
soa = nil
|
||||||
whois_lines = whois_output.split(/\n+/)
|
whois_lines = whois_output.split(/\n+/)
|
||||||
nameserver_lines = whois_lines.select { |line| line =~ /^Name Server:/ }
|
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 '.'
|
# whois records don't have trail '.'; NS records do; add trailing '.'
|
||||||
nameservers.map { |ns| ns << '.' }
|
nameservers.map { |ns| ns << '.' }
|
||||||
nameservers
|
nameservers
|
||||||
|
Reference in New Issue
Block a user