🐞 Nameservers test: whois is a subset of NS

Slight tweak: I want every WHOIS nameserver to be reflected in the NS
records, but I also want to allow for additional NS records.
Specifically, I've paid the Google Cloud Platform (GCP) "Committed Use
Discounts" for `ns-gce.sslip.io`, but it attracts *lots* of traffic, and
that can easily incur $100+ in bandwidth charges per month. To tamp down
on traffic, I don't include `ns-gce` in the whois nameservers, but I do
include it in the NS records.

But then my tests fail, so this commit tweaks the tests so that as long
as the NS records are a superset of the whois records, I'm fine
(previously they had to match).

Fixes, when running `DOMAIN=sslip.io rspec --format documentation
--color spec/`:

```
rspec './spec/check-dns_spec.rb[1:3]' # sslip.io nameserver ns-ovh.sslip.io.'s NS records match whois's ["ns-ovh.sslip.io.", "ns-hetzner.sslip.io.", "ns-do-sg.sslip.io."], `dig @ns-ovh.sslip.io. ns sslip.io +short`
rspec './spec/check-dns_spec.rb[1:18]' # sslip.io nameserver ns-hetzner.sslip.io.'s NS records match whois's ["ns-ovh.sslip.io.", "ns-hetzner.sslip.io.", "ns-do-sg.sslip.io."], `dig @ns-hetzner.sslip.io. ns sslip.io +short`
rspec './spec/check-dns_spec.rb[1:33]' # sslip.io nameserver ns-do-sg.sslip.io.'s NS records match whois's ["ns-ovh.sslip.io.", "ns-hetzner.sslip.io.", "ns-do-sg.sslip.io."], `dig @ns-do-sg.sslip.io. ns sslip.io +short`
```
This commit is contained in:
Brian Cunnie
2025-05-24 07:51:03 -04:00
parent a02936a34c
commit dbc1d3c70c

View File

@@ -39,10 +39,10 @@ describe domain do
end
whois_nameservers.each do |whois_nameserver|
it "nameserver #{whois_nameserver}'s NS records match whois's #{whois_nameservers}, " +
it "nameserver #{whois_nameserver}'s NS records include all whois nameservers #{whois_nameservers}, " +
"`dig @#{whois_nameserver} ns #{domain} +short`" do
dig_nameservers = `dig @#{whois_nameserver} ns #{domain} +short`.split(/\n+/)
expect(dig_nameservers.sort).to eq(whois_nameservers.sort)
expect(whois_nameservers - dig_nameservers).to be_empty
end
it "nameserver #{whois_nameserver}'s SOA record match" do