fix(test): isolate repositories test to prevent response cache bleed by BYK · Pull Request #864 · getsentry/cli · GitHub
Skip to content

fix(test): isolate repositories test to prevent response cache bleed#864

Merged
BYK merged 1 commit into
mainfrom
byk/fix-repo-test-isolation
Apr 28, 2026
Merged

fix(test): isolate repositories test to prevent response cache bleed#864
BYK merged 1 commit into
mainfrom
byk/fix-repo-test-isolation

Conversation

@BYK

@BYK BYK commented Apr 28, 2026

Copy link
Copy Markdown
Member

Summary

Fix flaky test/lib/api/repositories.test.ts failure on main:

Expected: "owner/primary-succeeded"
Received: "owner/fresh"

Root Cause

The test file was missing useTestConfigDir(), so all three tests shared the same config directory and disk-based HTTP response cache. Test 2's API response got cached to ~/.sentry/cache/responses/, and test 3 was served that stale cached response instead of hitting its own fetch mock.

Every other API test file (issues.test.ts, organizations.test.ts, releases.test.ts) already uses useTestConfigDir() — this one was the outlier.

Fix

  • Add useTestConfigDir("repo-cache-") for per-test config directory isolation
  • Add setAuthToken() in beforeEach to provide the auth token authenticatedFetch needs

useTestConfigDir gives each test its own config directory so the
disk-based HTTP response cache from test 2 doesn't serve stale data
to test 3, which was causing the CI failure on main.
@github-actions

Copy link
Copy Markdown
Contributor

@BYK BYK merged commit 3cd2e43 into main Apr 28, 2026
23 checks passed
@BYK BYK deleted the byk/fix-repo-test-isolation branch April 28, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant