fix: assert the timeout class RSC19e's budgets can actually produce - #721
Merged
Merged
Conversation
`http_request_timeout` reaches httpx alongside the four-second default `http_open_timeout`, so a request carries a connect budget as well as a read budget and either can be the one to expire: a connection that opens promptly exhausts the read budget, while a slow one exhausts the connect budget first. Pinning the assertion to `ReadTimeout` makes the test a function of how quickly the runner reaches the host, and `check (3.13)` has already failed on it with `httpx.ConnectTimeout`. `TimeoutException` is the common base of the two, and is what `resthttp_test.py` already asserts for the same reason. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 42 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This branch was successfully deployed
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.
test/ably/rest/restrequest_test.py::TestRestRequest::test_timeoutfailsintermittently in CI with
httpx.ConnectTimeout, most recently oncheck (3.13)for #703.
The test sets
http_request_timeout=0.000001and leaveshttp_open_timeoutat itsdefault of
4.Http.make_requestpasses the pair through as an httpx 2-tuple,which httpx reads as
Timeout(connect=4, read=1e-06), so the request carries twobudgets and whichever expires first decides the exception class:
ReadTimeoutConnectTimeoutAblyRest(token="foo")resolves to three hosts (main.realtime.ably.netplus twofallbacks) and
make_requestonly re-raises on the last, so the runner has tocomplete three connects before the assertion is reached — three chances for a slow
DNS or TLS path to be the first budget to go.
TimeoutExceptionis the common base of the two, so the assertion still holds thespecification's point — that
http_request_timeoutis honoured — without dependingon how fast the runner reaches the host.
resthttp_test.py:55already assertsTimeoutExceptionfor the same reason.Verification
Both timeout paths were exercised against the assertion, forcing the second by
pointing the host list at an unroutable address:
The old assertion fails the second case.
test_timeoutpasses in both its async andits generated sync form, and
ruff check .is clean.🤖 Generated with Claude Code