fix(tests): use .invalid TLD for unresolvable DNS test#12416
Draft
Bojun-Vvibe wants to merge 1 commit intoaio-libs:masterfrom
Draft
fix(tests): use .invalid TLD for unresolvable DNS test#12416Bojun-Vvibe wants to merge 1 commit intoaio-libs:masterfrom
Bojun-Vvibe wants to merge 1 commit intoaio-libs:masterfrom
Conversation
test_aiohttp_request_ctx_manager_not_found was flaky on networks where 'wrong-dns-name.com' could occasionally resolve (e.g. ISP NXDOMAIN hijacking or transient parking entries), causing the request to proceed and trip the inner assertion. Switch to the reserved .invalid TLD (RFC 2606), which is guaranteed never to resolve.
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Merging this PR will not alter performance
Comparing Footnotes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11293
Repo
aio-libs/aiohttp
Issue
#11293
Root cause
test_aiohttp_request_ctx_manager_not_foundrelied onhttp://wrong-dns-name.comfailing DNS resolution, but on some networks (notably macOS / certain ISPs) that domain can intermittently resolve (NXDOMAIN hijacking, parking pages, cached records). When it resolves, the request proceeds past theasync with, the innerassert Falsetrips, and the outerpytest.raises(ClientConnectionError)fails.Fix
Switch the hostname to
wrong-dns-name.invalid, using the reserved.invalidTLD (RFC 2606) which is guaranteed never to resolve. Also added the"never executed"message to the inner assertion to match the sibling test and aid debugging.Regression test
tests/test_client_functional.py::test_aiohttp_request_ctx_manager_not_found— same test, now deterministic; it asserts that entering anaiohttp.requestcontext manager for an unresolvable host raisesClientConnectionErrorand never enters the body.Risk
trivial
Verification
skipped: local pytest env missing required plugins (
textual); manually verified viasocket.getaddrinfo('wrong-dns-name.invalid', 80)raisesgaierror, confirming.invalidis unresolvable and the test will reliably hit theClientConnectionErrorpath.