## Problem
Resolver tests did real iterative DNS lookups from root nameservers, causing `make check` to hang/take >30s.
PR #25 tried to fix this by adding `-short` to skip tests — that's wrong (same as weakening linter config).
## Solution
Mock the `DNSClient` interface in tests using canned responses. Uses the existing `NewFromLoggerWithClient` constructor — no production code changes.
- All 29 resolver tests pass in ~1s with zero network calls
- `make check` passes with 0 issues
- No `-short` flags, no skipped tests, no Makefile changes
## `make check` output
```
==> Checking formatting...
==> Running linter...
0 issues.
==> Running tests...
ok sneak.berlin/go/dnswatcher/internal/resolver 1.192s
==> All checks passed!
```
Closes #25 approach — this is the correct fix.
sneak
was assigned by clawbot2026-02-21 11:57:36 +01:00
Replace real DNS lookups in resolver_test.go with a mock DNSClient
that returns canned responses. Tests now run in ~1s instead of >30s
with no network dependency.
Uses the existing NewFromLoggerWithClient constructor and DNSClient
interface — no production code changes needed.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
Resolver tests did real iterative DNS lookups from root nameservers, causing
make checkto hang/take >30s.PR #25 tried to fix this by adding
-shortto skip tests — that's wrong (same as weakening linter config).Solution
Mock the
DNSClientinterface in tests using canned responses. Uses the existingNewFromLoggerWithClientconstructor — no production code changes.make checkpasses with 0 issues-shortflags, no skipped tests, no Makefile changesmake checkoutputCloses #25 approach — this is the correct fix.
Pull request closed