#55409: test: make configureHostResolver spec hermetic
Requested by John Kleinschmidt · Slack thread
Description of Change
The app module > configureHostResolver > affects dns lookup behavior spec sent a real HEAD request to https://www.electronjs.org to show that name resolution worked before switching to a dead DoH server. That is external egress from CI and depends on the network being up.
The spec now starts a small local DoH server (RFC 8484 POST, answering every A query with 127.0.0.1 and any other query type with an empty NOERROR response, not NXDOMAIN, because an NXDOMAIN answer to Chromium's www.gstatic.com DoH probe trips a DCHECK in the network service) and a local HTTP server. It points configureHostResolver at the local DoH server and expects the request to succeed, then switches to the dead DoH address and expects a different hostname to fail with ERR_NAME_NOT_RESOLVED. The coverage is the same, and the spec now also proves that the configured resolver is actually used. The DoH server uses the fixture certificate, so the spec trusts it with setCertificateVerifyProc on the default session and resets that afterwards.
I checked the same logic in a standalone app on the v47.0.0-nightly.20261027 Linux x64 build: step 1 got a 200 through the local DoH server, step 3 failed with ERR_NAME_NOT_RESOLVED, and without the verify proc the DoH handshake is rejected as expected.
Checklist
- I have filled out the PR description
- I have reviewed and verified the changes
-
npm testpasses - tests are changed or added
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, past tense, and no longer than 80 characters.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Vf2yMt934Tt5KncFWXpm2G
Release Notes
Notes: none
Generated by Claude Code
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron