Repository navigation
test: Reset the connection cache before each test - #585
Merged
Merged
Conversation
The proxy rejection test asserts that the thread-local connection cache is empty, but only this class's teardown clears it. Whenever that test ran first in the class, it saw a connection left behind by the class that ran before it and failed, about once in 50 runs. That turned an unrelated spec sync red in openapi-spec.
Contributor
[Low impact] This PR appears safe to merge. SummaryClears the shared connection cache before each test in
Reviews (1) · Last reviewed commit: "test: Reset the connection cache before ..." · Reviewed by Greptile |
gjtorikian
enabled auto-merge (squash)
November 24, 2026 16:01
gjtorikian
disabled auto-merge
November 24, 2026 16:02
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
BaseClientTest#test_proxy_rejecting_connect_raises_api_connection_error_without_retrying(added in feat: Add opt-in proxy option to the client #581) asserts that the thread-local connection cache is empty, but that cache is shared by every client on the thread and only this class'steardownclears it.api.workos.comconnection left by whichever test class ran before it and fails withExpected {"https:api.workos.com:443:30" => #<Net::HTTP ...>} to be empty. That is about 1 run in 50.OrganizationDomainsTest), and passed on the re-run.setupnow clears the cache, so every test in the class starts from an empty cache whatever ran before it.OrganizationDomainsTesttest across seeds 1 to 6: seeds 2 and 5 (other class first) failed before the change and pass after it.script/cipasses (1539 runs, 0 failures).