Skip to content

Commit

Permalink
self review
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitropoulos committed Sep 24, 2024
1 parent eafedcb commit c56bffa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/turborepo-scm/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ mod tests {
};

/// By default `#[test_case]` will run in parallel.
/// This is a problem for testing things TODO
/// This is a problem for testing things like environment variables, which
/// are not thread-safe. This lock ensures that these tests run serially.
static TEST_PARALLELISM_LOCK: OnceLock<Mutex<bool>> = OnceLock::new();

fn setup_repository(
Expand Down Expand Up @@ -1145,7 +1146,7 @@ mod tests {
let _lock = TEST_PARALLELISM_LOCK
.get_or_init(Mutex::default)
.lock()
.unwrap();
.expect("failed to acquire TEST_PARALLELISM_LOCK");

// insert any Some values into the environment
for (key, value) in [
Expand All @@ -1158,6 +1159,7 @@ mod tests {
}
}

// note: we must bind here because otherwise the temporary file will be dropped
let _temp_file = if test_case.GITHUB_EVENT_PATH.is_some() {
let temp_file = NamedTempFile::new().expect("Failed to create temporary file");
fs::write(temp_file.path(), test_case.event_json)
Expand Down

0 comments on commit c56bffa

Please sign in to comment.