From 29d2cfd37a3cd43fc2b2b909bf1316b6d76004f8 Mon Sep 17 00:00:00 2001 From: Phoebus Date: Wed, 30 Sep 2026 04:59:28 -0700 Subject: [PATCH] test(executor): synchronize PHOEBUS_AI_TIMEOUT test modifications with a mutex --- installer-rs/crates/phoebus-executor/src/ai.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/installer-rs/crates/phoebus-executor/src/ai.rs b/installer-rs/crates/phoebus-executor/src/ai.rs index 7731ee2..5caeabb 100644 --- a/installer-rs/crates/phoebus-executor/src/ai.rs +++ b/installer-rs/crates/phoebus-executor/src/ai.rs @@ -394,10 +394,12 @@ mod tests { ); } - /// Save, set, and restore PHOEBUS_AI_TIMEOUT around a check. Only this - /// module's tests touch the variable, and no other test asserts a - /// timeout value, so parallel execution stays deterministic. + static ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(()); + + /// Save, set, and restore PHOEBUS_AI_TIMEOUT around a check. + /// Serialized via ENV_LOCK to keep parallel test execution deterministic. fn with_ai_timeout(var: Option<&str>, check: impl FnOnce()) { + let _guard = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner()); let prev = std::env::var("PHOEBUS_AI_TIMEOUT").ok(); match var { Some(v) => std::env::set_var("PHOEBUS_AI_TIMEOUT", v),