From 35fac654c3a283e95468fcc5635d9024b78d73b2 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Wed, 8 Apr 2026 14:29:00 -0400 Subject: [PATCH] fix(test): reduce test server stop timeout from 8s to 500ms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test harness waited 8s for the server to shut down gracefully, accommodating the server's 5s WORKER_CANCEL_GRACE. But in tests, the CLI returns before workers exit (terminal SSE event → CLI exits → TestContext drops → SIGTERM while workers still cleaning up), so the last test in every session paid a ~5s penalty. No real work needs preserving in tests, so SIGKILL after 500ms instead. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/crates/fabro-test/src/lib.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/crates/fabro-test/src/lib.rs b/lib/crates/fabro-test/src/lib.rs index 183351fcc..28aab0c78 100644 --- a/lib/crates/fabro-test/src/lib.rs +++ b/lib/crates/fabro-test/src/lib.rs @@ -596,9 +596,11 @@ fn stop_test_server(server: &ServerPaths) { } fn test_server_stop_timeout() -> std::time::Duration { - // Allow the real server to finish its own 5s worker-shutdown grace before - // we escalate and risk orphaning active run workers. - std::time::Duration::from_secs(8) + // Give the server a brief window to flush state, then escalate. + // The server's own 5s worker-shutdown grace is unnecessary in tests + // because no real work needs preserving — any lingering workers are + // from already-completed runs racing to exit. + std::time::Duration::from_millis(500) } fn shared_server_paths(root: &Path) -> ServerPaths { @@ -1772,10 +1774,10 @@ mod tests { } #[test] - fn stop_test_server_timeout_exceeds_server_worker_grace() { + fn stop_test_server_timeout_is_short() { assert!( - test_server_stop_timeout() >= std::time::Duration::from_secs(6), - "test harness must give the server longer than its 5s worker shutdown grace" + test_server_stop_timeout() <= std::time::Duration::from_secs(1), + "test harness should SIGKILL quickly — no real work to preserve" ); }