watcher: names say "usable reply", as their comments do (rework for #302)
check / check (push) Waiting to run

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
This commit is contained in:
2026-10-18 14:45:15 +00:00
parent cc27d8d957
commit 4e39890c0a
2 changed files with 19 additions and 19 deletions
+12 -12
View File
@@ -8,18 +8,18 @@ import (
"sneak.berlin/go/dnswatcher/internal/watcher" "sneak.berlin/go/dnswatcher/internal/watcher"
) )
// TestDNSUnreachableWhenNoRootServerReplies runs one round of checks of // TestDNSUnreachableWhenNoRootServerGivesUsableReply runs one round of
// a domain and a hostname with every walk starting at real servers that // checks of a domain and a hostname with every walk starting at real
// are not root servers. At 192.0.2.1, a documentation address, nothing // servers that are not root servers. At 192.0.2.1, a documentation
// answers, as when no root server answers. Public recursive resolvers of // address, nothing answers, as when no root server answers. Public
// four operators mark their replies recursion available, as on a network // recursive resolvers of four operators mark their replies recursion
// that intercepts DNS queries; one that gives no reply is passed over // available, as on a network that intercepts DNS queries; one that gives
// for the next, and if none replies, no root server answered. Either // no reply is passed over for the next, and if none replies, no root
// way every lookup failed because no root server gave a usable reply, // server answered. Either way every lookup failed because no root server
// so the round could not reach the DNS. TestFirstRunBaseline and // gave a usable reply, so the round could not reach the DNS.
// TestDomainThatDoesNotExist check rounds in which the root servers // TestFirstRunBaseline and TestDomainThatDoesNotExist check rounds in
// gave a usable reply. // which the root servers gave a usable reply.
func TestDNSUnreachableWhenNoRootServerReplies(t *testing.T) { func TestDNSUnreachableWhenNoRootServerGivesUsableReply(t *testing.T) {
t.Parallel() t.Parallel()
tests := []struct { tests := []struct {
+7 -7
View File
@@ -299,16 +299,16 @@ func (w *Watcher) runDNSChecks(ctx context.Context) {
} }
if ctx.Err() == nil { if ctx.Err() == nil {
w.dnsUnreachable.Store(noRootServerReplied(errs)) w.dnsUnreachable.Store(noRootServerGaveUsableReply(errs))
} }
} }
// noRootServerReplied reports whether errs, the errors of the lookups in // noRootServerGaveUsableReply reports whether errs, the errors of the
// a round of DNS checks, nil for a lookup that succeeded, show that // lookups in a round of DNS checks, nil for a lookup that succeeded,
// every lookup failed because no root server gave a usable reply: each // show that every lookup failed because no root server gave a usable
// is ErrNoRootServerAnswered or ErrIntercepted. A round with no lookups // reply: each is ErrNoRootServerAnswered or ErrIntercepted. A round with
// shows nothing. // no lookups shows nothing.
func noRootServerReplied(errs []error) bool { func noRootServerGaveUsableReply(errs []error) bool {
for _, err := range errs { for _, err := range errs {
if !errors.Is(err, resolver.ErrNoRootServerAnswered) && if !errors.Is(err, resolver.ErrNoRootServerAnswered) &&
!errors.Is(err, resolver.ErrIntercepted) { !errors.Is(err, resolver.ErrIntercepted) {