Lightweight coding agent that runs in your terminal
Rust
Stabilize exec-server process tests (#17605)
Eric Traut6550007cca50
diff --git a/codex-rs/Cargo.lock b/codex-rs/Cargo.lockindex 533c28d6f7..728a404ce3 100644--- a/codex-rs/Cargo.lock+++ b/codex-rs/Cargo.lock@@ -2107,6 +2107,7 @@ dependencies = ["pretty_assertions","serde","serde_json",+ "serial_test","tempfile","test-case","thiserror 2.0.18",diff --git a/codex-rs/exec-server/Cargo.toml b/codex-rs/exec-server/Cargo.tomlindex 25570dc71b..805d962ab0 100644--- a/codex-rs/exec-server/Cargo.toml+++ b/codex-rs/exec-server/Cargo.toml@@ -42,5 +42,6 @@ uuid = { workspace = true, features = ["v4"] }anyhow = { workspace = true }codex-utils-cargo-bin = { workspace = true }pretty_assertions = { workspace = true }+serial_test = { workspace = true }tempfile = { workspace = true }test-case = "3.3.1"diff --git a/codex-rs/exec-server/tests/common/exec_server.rs b/codex-rs/exec-server/tests/common/exec_server.rsindex 0b6eec5447..a2476b4fbb 100644--- a/codex-rs/exec-server/tests/common/exec_server.rs+++ b/codex-rs/exec-server/tests/common/exec_server.rs@@ -47,6 +47,7 @@ pub(crate) async fn exec_server() -> anyhow::Result<ExecServerHarness> {child.stdin(Stdio::null());child.stdout(Stdio::piped());child.stderr(Stdio::inherit());+ child.kill_on_drop(true);let mut child = child.spawn()?;let websocket_url = read_listen_url_from_stdout(&mut child).await?;@@ -140,6 +141,9 @@ impl ExecServerHarness {pub(crate) async fn shutdown(&mut self) -> anyhow::Result<()> {self.child.start_kill()?;+ timeout(CONNECT_TIMEOUT, self.child.wait())+ .await+ .map_err(|_| anyhow!("timed out waiting for exec-server shutdown"))??;Ok(())}diff --git a/codex-rs/exec-server/tests/exec_process.rs b/codex-rs/exec-server/tests/exec_process.rsindex ab232ccd3e..489cd251fc 100644--- a/codex-rs/exec-server/tests/exec_process.rs+++ b/codex-rs/exec-server/tests/exec_process.rs@@ -210,6 +210,8 @@ async fn assert_exec_process_preserves_queued_events_before_subscribe(}#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+// Serialize tests that launch a real exec-server process through the full CLI.+#[serial_test::serial(remote_exec_server)]async fn remote_exec_process_reports_transport_disconnect() -> Result<()> {let mut context = create_process_context(/*use_remote*/ true).await?;let session = context@@ -255,6 +257,8 @@ async fn remote_exec_process_reports_transport_disconnect() -> Result<()> {#[test_case(false ; "local")]#[test_case(true ; "remote")]#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+// Serialize tests that launch a real exec-server process through the full CLI.+#[serial_test::serial(remote_exec_server)]async fn exec_process_starts_and_exits(use_remote: bool) -> Result<()> {assert_exec_process_starts_and_exits(use_remote).await}@@ -262,6 +266,8 @@ async fn exec_process_starts_and_exits(use_remote: bool) -> Result<()> {#[test_case(false ; "local")]#[test_case(true ; "remote")]#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+// Serialize tests that launch a real exec-server process through the full CLI.+#[serial_test::serial(remote_exec_server)]async fn exec_process_streams_output(use_remote: bool) -> Result<()> {assert_exec_process_streams_output(use_remote).await}@@ -269,6 +275,8 @@ async fn exec_process_streams_output(use_remote: bool) -> Result<()> {#[test_case(false ; "local")]#[test_case(true ; "remote")]#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+// Serialize tests that launch a real exec-server process through the full CLI.+#[serial_test::serial(remote_exec_server)]async fn exec_process_write_then_read(use_remote: bool) -> Result<()> {assert_exec_process_write_then_read(use_remote).await}@@ -276,6 +284,8 @@ async fn exec_process_write_then_read(use_remote: bool) -> Result<()> {#[test_case(false ; "local")]#[test_case(true ; "remote")]#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+// Serialize tests that launch a real exec-server process through the full CLI.+#[serial_test::serial(remote_exec_server)]async fn exec_process_preserves_queued_events_before_subscribe(use_remote: bool) -> Result<()> {assert_exec_process_preserves_queued_events_before_subscribe(use_remote).await}