Skip to content

refactor(tests): one DNS seam with a shared fake and contract suite - #3773

Merged
dan-petty merged 5 commits into
mainfrom
refactor/1314-dns-seam
Nov 6, 2026
Merged

dan-petty merged 5 commits into
mainfrom
refactor/1314-dns-seam

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The egress check resolved names through socket.getaddrinfo and anyio.getaddrinfo, so a test had to patch the standard library. The Resolver seam in http/egress.py now serves both vet_addresses and avet_addresses. SystemResolver is the real lookup. DnsFake in tests/support/fakes/dns.py replaces it, behind the dns fixture, and one contract suite runs over the fake and the real lookup. Checks, errors and timeouts do not change.

Closes #3752

Change: openspec/changes/archive/2026-11-06-3752-dns-seam/

…ared fake and its contract suite

vet_addresses and avet_addresses resolve through the Resolver Protocol. SystemResolver is the real lookup, and install_resolver gives a test another. DnsFake and its dns fixture map names to addresses, script answers per lookup, stall a name and record each lookup. The contract suite runs each case over the fake and the real resolver.

Refs #1314
…ting tests prove the seam

The contract suite moves to tests/http. The vetting tests install a bare DnsFake, so they fail if vet_addresses or avet_addresses skip the seam. SystemResolver is compared by class.
@dan-petty dan-petty added type/refactor Type refactor: a new structure, same behavior scope/tests The test suite, its fixtures, fakes and floor labels Nov 6, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test and check results:

  • Focused run: tests/http, tests/invariants and tests/support pass (851 tests) after the rebase onto origin/main.
  • Mutation check: when vet_addresses and avet_addresses call SystemResolver directly, 5 vetting tests fail and 7 error. So the tests prove the routing through the seam.
  • The pre-push static checks pass.

Review findings fixed: the contract suite moved to tests/http/test_dns_contract.py (it mirrors http/egress.py); the vetting tests install a bare DnsFake; SystemResolver is compared by class; the duplicate default-resolver test is gone.
Skipped: DnsFake.aresolve raises TimeoutError for a stalled name whatever the timeout is. A real lookup with no timeout would wait without end. The fake raises at once, so no test waits. The fake documents this.

The title scope is tests because .github/labels.yml has no scope/core label.

anyio.getaddrinfo cuts an IPv6 socket address to two items, so a whole-tuple compare failed on a runner where localhost answers ::1.
The change files name the new place of the contract suite.
@dan-petty
dan-petty force-pushed the refactor/1314-dns-seam branch from 3563a97 to 37c55f5 Compare November 6, 2026 07:48
@dan-petty
dan-petty marked this pull request as ready for review November 6, 2026 07:55
@dan-petty
dan-petty merged commit 10c7896 into main Nov 6, 2026
24 checks passed
@dan-petty
dan-petty deleted the refactor/1314-dns-seam branch November 6, 2026 07:58
dan-petty pushed a commit that referenced this pull request Nov 6, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.67.2](v0.67.1...v0.67.2)
(2026-11-06)


### Code Refactoring

* **ai:** test-only model request hooks leave src
([#3768](#3768))
([9b01821](9b01821))
* **tests:** one DNS seam with a shared fake and contract suite
([#3773](#3773))
([10c7896](10c7896)),
closes [#3752](#3752)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/tests The test suite, its fixtures, fakes and floor type/refactor Type refactor: a new structure, same behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(cli): one DNS seam under vet_addresses, with a fake

1 participant