From a517f6f55b392c14946c0d0521ff7292741eed55 Mon Sep 17 00:00:00 2001 From: Gabriel Peal Date: Tue, 21 Oct 2025 09:08:34 -0700 Subject: [PATCH] Fix flaky auth tests (#5461) This #[serial] approach is not ideal. I am tracking a separate issue to create an injectable env var provider but I want to fix these tests first. Fixes #5447 --- codex-rs/core/src/auth.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/codex-rs/core/src/auth.rs b/codex-rs/core/src/auth.rs index 92074c66..3dcc037b 100644 --- a/codex-rs/core/src/auth.rs +++ b/codex-rs/core/src/auth.rs @@ -542,6 +542,7 @@ mod tests { } #[tokio::test] + #[serial(codex_api_key)] async fn pro_account_with_no_api_key_uses_chatgpt_auth() { let codex_home = tempdir().unwrap(); let fake_jwt = write_auth_file( @@ -591,6 +592,7 @@ mod tests { } #[tokio::test] + #[serial(codex_api_key)] async fn loads_api_key_from_auth_json() { let dir = tempdir().unwrap(); let auth_file = dir.path().join("auth.json"); @@ -742,6 +744,7 @@ mod tests { } #[tokio::test] + #[serial(codex_api_key)] async fn enforce_login_restrictions_logs_out_for_workspace_mismatch() { let codex_home = tempdir().unwrap(); let _jwt = write_auth_file( @@ -767,6 +770,7 @@ mod tests { } #[tokio::test] + #[serial(codex_api_key)] async fn enforce_login_restrictions_allows_matching_workspace() { let codex_home = tempdir().unwrap(); let _jwt = write_auth_file(