Serialize managed agent PATH tests (#1777)

Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
Will Pfleger
2026-07-12 20:48:32 -04:00
committed by GitHub
parent 620822899a
commit 1fc7488ea5
4 changed files with 20 additions and 14 deletions

View File

@@ -923,6 +923,7 @@ fn find_nvm_default_bin_returns_none_when_versions_dir_empty() {
#[test]
fn refresh_login_shell_path_clears_cache() {
let _guard = crate::managed_agents::lock_path_mutex();
// Populate the cache with a first call.
let before = super::login_shell_path();
assert!(

View File

@@ -31,6 +31,15 @@ mod team_repair;
mod teams;
mod types;
// Shared guard for tests that mutate or read process-global PATH.
#[cfg(test)]
static PATH_MUTEX: std::sync::Mutex<()> = std::sync::Mutex::new(());
#[cfg(test)]
pub(crate) fn lock_path_mutex() -> std::sync::MutexGuard<'static, ()> {
PATH_MUTEX.lock().unwrap_or_else(|e| e.into_inner())
}
pub use backend::*;
pub use discovery::*;
pub use env_vars::*;

View File

@@ -1125,10 +1125,6 @@ mod tests {
// ── codex readiness version gate ───────────────────────────────────────
// Mutex to serialize tests that mutate PATH so parallel test threads
// don't interfere with each other's resolve_command results.
static PATH_MUTEX: std::sync::Mutex<()> = std::sync::Mutex::new(());
/// Build a minimal `KnownAcpRuntime` for testing the codex version gate.
/// `adapter_commands` are the exact strings passed to `find_command` — use
/// `&["codex-acp"]` when the binary is on PATH, or `&[<absolute_path>]`
@@ -1203,7 +1199,7 @@ mod tests {
#[cfg(unix)]
#[test]
fn cli_login_requirements_codex_outdated_adapter_emits_adapter_outdated() {
let _guard = PATH_MUTEX.lock().unwrap_or_else(|e| e.into_inner());
let _guard = crate::managed_agents::lock_path_mutex();
let (dir, orig) = setup_temp_codex_acp("#!/bin/sh\nexit 1\n");
let exe = present_binary_str();
@@ -1241,7 +1237,7 @@ mod tests {
#[cfg(unix)]
#[test]
fn cli_login_requirements_codex_garbage_version_output_emits_adapter_outdated() {
let _guard = PATH_MUTEX.lock().unwrap_or_else(|e| e.into_inner());
let _guard = crate::managed_agents::lock_path_mutex();
let (dir, orig) = setup_temp_codex_acp("#!/bin/sh\necho 'not a version string'\nexit 0\n");
let exe = present_binary_str();

View File

@@ -708,10 +708,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
url: "https://pub.dev"
source: hosted
version: "1.17.0"
version: "1.18.0"
mime:
dependency: transitive
description:
@@ -1137,26 +1137,26 @@ packages:
dependency: transitive
description:
name: test
sha256: "280d6d890011ca966ad08df7e8a4ddfab0fb3aa49f96ed6de56e3521347a9ae7"
sha256: "8d9ceddbab833f180fbefed08afa76d7c03513dfdba87ffcec2718b02bbcbf20"
url: "https://pub.dev"
source: hosted
version: "1.30.0"
version: "1.31.0"
test_api:
dependency: transitive
description:
name: test_api
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
url: "https://pub.dev"
source: hosted
version: "0.7.10"
version: "0.7.11"
test_core:
dependency: transitive
description:
name: test_core
sha256: "0381bd1585d1a924763c308100f2138205252fb90c9d4eeaf28489ee65ccde51"
sha256: "1991d4cfe85d5043241acac92962c3977c8d2f2add1ee73130c7b286417d1d34"
url: "https://pub.dev"
source: hosted
version: "0.6.16"
version: "0.6.17"
tuple:
dependency: transitive
description: