From 4e39890c0aae3045272929baee5c039277040df4 Mon Sep 17 00:00:00 2001 From: clawbot <35+clawbot@noreply.example.org> Date: Sun, 18 Oct 2026 14:45:15 +0000 Subject: [PATCH] watcher: names say "usable reply", as their comments do (rework for #302) The function that decides the round could not reach the DNS, and its test, are renamed to say no root server gave a usable reply, since a root server's address that replied unusably counts the same. Model: opus-5-5 --- internal/watcher/dnsunreachable_test.go | 24 ++++++++++++------------ internal/watcher/watcher.go | 14 +++++++------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/watcher/dnsunreachable_test.go b/internal/watcher/dnsunreachable_test.go index 7a2eecb..66698d7 100644 --- a/internal/watcher/dnsunreachable_test.go +++ b/internal/watcher/dnsunreachable_test.go @@ -8,18 +8,18 @@ import ( "sneak.berlin/go/dnswatcher/internal/watcher" ) -// TestDNSUnreachableWhenNoRootServerReplies runs one round of checks of -// a domain and a hostname with every walk starting at real servers that -// are not root servers. At 192.0.2.1, a documentation address, nothing -// answers, as when no root server answers. Public recursive resolvers of -// four operators mark their replies recursion available, as on a network -// that intercepts DNS queries; one that gives no reply is passed over -// for the next, and if none replies, no root server answered. Either -// way every lookup failed because no root server gave a usable reply, -// so the round could not reach the DNS. TestFirstRunBaseline and -// TestDomainThatDoesNotExist check rounds in which the root servers -// gave a usable reply. -func TestDNSUnreachableWhenNoRootServerReplies(t *testing.T) { +// TestDNSUnreachableWhenNoRootServerGivesUsableReply runs one round of +// checks of a domain and a hostname with every walk starting at real +// servers that are not root servers. At 192.0.2.1, a documentation +// address, nothing answers, as when no root server answers. Public +// recursive resolvers of four operators mark their replies recursion +// available, as on a network that intercepts DNS queries; one that gives +// no reply is passed over for the next, and if none replies, no root +// server answered. Either way every lookup failed because no root server +// gave a usable reply, so the round could not reach the DNS. +// TestFirstRunBaseline and TestDomainThatDoesNotExist check rounds in +// which the root servers gave a usable reply. +func TestDNSUnreachableWhenNoRootServerGivesUsableReply(t *testing.T) { t.Parallel() tests := []struct { diff --git a/internal/watcher/watcher.go b/internal/watcher/watcher.go index 64be30b..9550a87 100644 --- a/internal/watcher/watcher.go +++ b/internal/watcher/watcher.go @@ -299,16 +299,16 @@ func (w *Watcher) runDNSChecks(ctx context.Context) { } if ctx.Err() == nil { - w.dnsUnreachable.Store(noRootServerReplied(errs)) + w.dnsUnreachable.Store(noRootServerGaveUsableReply(errs)) } } -// noRootServerReplied reports whether errs, the errors of the lookups in -// a round of DNS checks, nil for a lookup that succeeded, show that -// every lookup failed because no root server gave a usable reply: each -// is ErrNoRootServerAnswered or ErrIntercepted. A round with no lookups -// shows nothing. -func noRootServerReplied(errs []error) bool { +// noRootServerGaveUsableReply reports whether errs, the errors of the +// lookups in a round of DNS checks, nil for a lookup that succeeded, +// show that every lookup failed because no root server gave a usable +// reply: each is ErrNoRootServerAnswered or ErrIntercepted. A round with +// no lookups shows nothing. +func noRootServerGaveUsableReply(errs []error) bool { for _, err := range errs { if !errors.Is(err, resolver.ErrNoRootServerAnswered) && !errors.Is(err, resolver.ErrIntercepted) {