test(executor): synchronize PHOEBUS_AI_TIMEOUT test modifications with a mutex
Some checks are pending
ci / test (push) Waiting to run

This commit is contained in:
Phoebus 2026-09-30 04:59:28 -07:00
parent bed56cd52a
commit 29d2cfd37a

View file

@ -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),