Repository navigation
Done
Labels
area: cliFlags, exit codes, main.gohelp wantedExtra attention is neededseverity: mediumEdge-case bugs, degraded behavior, meaningful maintenance costtestingTest coverage and test infrastructure
Description
Summary
The -ptr pass (new in v0.12.0) has an end-to-end test whose -max-queries case cannot fail, and several of its branches (pool routing, deadline, failure verdict) never run in the suite.
Where
internal/cli/ptr_test.go:147("-max-queries caps the PTR queries" case)internal/cli/ptr.go:104-107(cap branch: count 0 under-coverpkg=./...)internal/cli/ptr.go:138,internal/dns/ptr.go:68((*Pool).LookupPTR, 0% covered)internal/cli/ptr.go:129,:211(-max-durationexpiry),:225(refound names)internal/cli/session.go:921,internal/cli/summary.go:76-86(failed pass verdict)
Details
The fixture produces one address, so the assertion of 1 PTR query holds with the cap deleted.
Impact
A regression in the PTR budget, pool routing, deadline handling or failure verdict ships silently. The verdict and exit code are what CI users gate on with the Action's fail-on.
Suggested fix
Add cases, each against a local dnstest server:
- 3 public addresses with
-ptr -max-queries 2: exactly 2 PTR queries,ptr_addresses 3, and the "left 1 addresses unasked" line. -
-ptrwith a-rpool of two dnstest servers: PTR queries spread over members, and a member answering NXDOMAIN for every PTR stays healthy. - Pool with no healthy member:
LookupPTRreturns "no healthy resolver in the pool" and the pass is not reported complete. -
-ptr -max-durationthat expires mid-pass (slow reverse server): verdictdegraded, the reason names -max-duration, and the exit code follows the degraded rule. - A PTR pass that fails: run marked failed, summary verdict degraded with the PTR reason.
- A PTR name already found by
-resumeis not counted twice inptr_found.
Getting started
- Relevant files:
internal/cli/ptr.go,internal/cli/ptr_test.go,internal/dnstest - How to run tests:
go test ./internal/cli -run TestE2EPTR -coverprofile=c.out
Filed by repo-audit/full-audit at a45b999. Severity: medium. Effort: M. audit-key: testing|internal/cli/ptr.go|lookupPTRs
Metadata
Metadata
Assignees
Labels
area: cliFlags, exit codes, main.gohelp wantedExtra attention is neededseverity: mediumEdge-case bugs, degraded behavior, meaningful maintenance costtestingTest coverage and test infrastructure
Activity
TMHSDigital commentedon Nov 29, 2026
Fixed in f0db944: new tests TestE2EPTRMaxQueriesCapsAddresses (3 addresses, -max-queries 2: exactly 2 PTR queries, ptr_addresses 2, the 'left 1 addresses unasked' line; fails with the cap branch removed), TestE2EPTRThroughPool (PTR queries reach both -r members, and a member answering NXDOMAIN for every PTR leaves the run complete), TestE2EPTRMaxDuration (slow reverse server: the expiry line, verdict degraded naming -max-duration), TestPoolLookupPTRNoHealthyMember, and TestTargetSummaryFailedPTRPass (an unfinished or expired PTR pass gives degraded with the PTR reason). The last checklist item, a PTR name restored by -resume not counted twice, is still covered only by the existing TestPTRResume (the restored hit is not looked up again); I added no ptr_found assertion for it. Gate (gofmt, vet, golangci-lint v2.15.0, full suite) passes.