Skip to content

Commit 355993c

Browse files
runningcodeclaude
andauthored
fix: serialize VCS tests to prevent race conditions (EME-368) (#2811)
## 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](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!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. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit c6c76f3. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4ff5286 commit 355993c

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

Cargo.lock

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ assert_cmd = "2.0.11"
8686
insta = { version = "1.26.0", features = ["redactions", "yaml"] }
8787
mockito = "1.6.1"
8888
rstest = "0.18.2"
89+
serial_test = "3.1.1"
8990
tempfile = "3.8.1"
9091
trycmd = "0.14.11"
9192

src/utils/vcs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,7 @@ mod tests {
806806
use {
807807
crate::api::RepoProvider,
808808
insta::{assert_debug_snapshot, assert_yaml_snapshot},
809+
serial_test::serial,
809810
std::fs::File,
810811
std::io::Write as _,
811812
std::path::Path,
@@ -1672,6 +1673,7 @@ mod tests {
16721673
}
16731674

16741675
#[test]
1676+
#[serial(github_event_path)]
16751677
fn test_find_head_with_github_event_path() {
16761678
use std::fs;
16771679

@@ -1751,6 +1753,7 @@ mod tests {
17511753
}
17521754

17531755
#[test]
1756+
#[serial(github_event_path)]
17541757
fn test_find_base_sha() {
17551758
use std::fs;
17561759

0 commit comments

Comments
 (0)