Skip to content

fix: serialize VCS tests to prevent race conditions (EME-368)#2811

Merged
runningcode merged 2 commits intomasterfrom
fix/serialize-vcs-tests-eme-368
Sep 29, 2025
Merged

fix: serialize VCS tests to prevent race conditions (EME-368)#2811
runningcode merged 2 commits intomasterfrom
fix/serialize-vcs-tests-eme-368

Conversation

@runningcode
Copy link
Copy Markdown
Contributor

@runningcode runningcode commented Sep 29, 2025

Summary

  • Fixes flaky test_find_base_sha test that was consistently failing on Windows CI
  • Adds serial_test dependency to serialize tests that share the GITHUB_EVENT_PATH environment variable
  • Adds #[serial(github_event_path)] attribute to both conflicting tests

Root Cause

The flakiness was caused by a race condition where two tests run in parallel and both manipulate the same global GITHUB_EVENT_PATH environment variable:

  • test_find_base_sha()
  • test_find_head_with_github_event_path()

When running in parallel (Rust's default), these tests could overwrite each other's environment variable settings, causing random failures.

Solution

Using the serial_test crate with #[serial(github_event_path)] ensures these specific tests run sequentially while allowing other tests to continue running in parallel.

Closes EME-368

🤖 Generated with Claude Code


Note

Serializes two VCS tests using serial_test to avoid GITHUB_EVENT_PATH race; adds serial_test as a dev dependency.

  • Tests:
    • Add #[serial(github_event_path)] to test_find_head_with_github_event_path and test_find_base_sha in src/utils/vcs.rs.
  • Dependencies:
    • Add dev-dependency serial_test in Cargo.toml.
    • Update Cargo.lock with serial_test and transitive deps (scc, sdd) and include serial_test in sentry-cli package deps.

Written by Cursor Bugbot for commit c6c76f3. This will update automatically on new commits. Configure here.

Adds serial_test dependency and #[serial(github_event_path)] attribute to:
- test_find_base_sha
- test_find_head_with_github_event_path

This prevents race conditions when tests run in parallel, where both tests
manipulate the same global GITHUB_EVENT_PATH environment variable.

Fixes EME-368: Flakiness in `test_find_base_sha` CLI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear bot commented Sep 29, 2025

Reorder imports alphabetically as per Rust formatting standards.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@runningcode runningcode marked this pull request as ready for review September 29, 2025 13:47
@runningcode runningcode requested review from a team and szokeasaurusrex as code owners September 29, 2025 13:47
@runningcode runningcode merged commit 355993c into master Sep 29, 2025
25 checks passed
@runningcode runningcode deleted the fix/serialize-vcs-tests-eme-368 branch September 29, 2025 13:50
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.

2 participants