Skip to content

test: Reset the connection cache before each test - #585

Merged
gjtorikian merged 1 commit into
mainfrom
fix/base-client-test-connection-cache
Nov 24, 2026
Merged

gjtorikian merged 1 commit into
mainfrom
fix/base-client-test-connection-cache

Conversation

@gjtorikian

Copy link
Copy Markdown
Contributor

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's teardown clears it.
  • When that test runs first in its class, it sees a stubbed api.workos.com connection left by whichever test class ran before it and fails with Expected {"https:api.workos.com:443:30" => #<Net::HTTP ...>} to be empty. That is about 1 run in 50.
  • It failed the Ruby build on an unrelated spec sync, Update OpenAPI spec (fd4535b) openapi-spec#295 (seed 63625, right after OrganizationDomainsTest), and passed on the re-run.
  • setup now clears the cache, so every test in the class starts from an empty cache whatever ran before it.
  • Checked by running the proxy test with one OrganizationDomainsTest test across seeds 1 to 6: seeds 2 and 5 (other class first) failed before the change and pass after it. script/ci passes (1539 runs, 0 failures).

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.
@gjtorikian
gjtorikian requested a review from a team as a code owner November 24, 2026 15:59
@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Summary

Clears the shared connection cache before each test in BaseClientTest.

  • Base client tests start with an empty connection cache.

Reviews (1) · Last reviewed commit: "test: Reset the connection cache before ..." · Reviewed by Greptile

@gjtorikian
gjtorikian enabled auto-merge (squash) November 24, 2026 16:01
@gjtorikian
gjtorikian disabled auto-merge November 24, 2026 16:02
@gjtorikian
gjtorikian merged commit 24a04a3 into main Nov 24, 2026
10 checks passed
@gjtorikian
gjtorikian deleted the fix/base-client-test-connection-cache branch November 24, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant