Repository navigation
Provider URL validation tests: count only the lookups the code under test made - #12771
Merged
Merged
Conversation
…test made socket.getaddrinfo is patched process-wide, so a lookup from any other thread in the xdist worker also reached the fake and was counted: 'assert 33 == 32' in test_stalled_lookups_do_not_pile_up (#12759) and 'assert 3 == 2' in test_a_timed_out_lookup_is_not_remembered (#12750), on PRs that do not touch the provider code. Route this file's .example hosts to the fake and everything else to the real resolver in the five tests that count calls, and pin the routing.
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Summary
Two tests in
studio/backend/tests/test_provider_base_url_validation.pyfail intermittently on PRs that do not touch the provider code:test_stalled_lookups_do_not_pile_up:assert 33 == 32(Studio: show automatic compaction count in context meter #12759,(Python 3.13, l-r))test_a_timed_out_lookup_is_not_remembered:assert 3 == 2(Fix managed vLLM startup in Windows Studio #12750,(Python 3.13, l-r))Both pass in isolation on main. Both are off by exactly one.
Cause
The tests replace
socket.getaddrinfofor the whole process and count every call the fake receives. Any other thread in the same xdist worker that resolves a name while the patch is in place lands in the fake too and is counted, for example a client or background refresh left behind by an earlier test. The fakes also make that unrelated caller sleep 30 seconds. The product is behaving correctly. The count is reading lookups it did not make.Change
_for_test_hosts(fake): answers this file's.examplehosts with the fake and passes every other lookup to the real resolver.test_dns_alias_verdict_is_cached,test_the_opt_in_path_shares_the_one_lookupandtest_the_opt_in_path_does_not_re_resolve_after_a_timeout, which have the same exposure.test_a_lookup_from_another_thread_is_not_countedpins the routing. A concurrentgetaddrinfo("localhost")from another thread must not reach the fake. Without the routing it fails with['localhost', 'route.example'] == ['route.example'].Verification
test_provider_base_url_validation.py: 131 passed.