mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-15 23:32:46 +00:00
fix(nextest): let shared test server reap run workers
Give the harness longer to stop the shared test server than the server itself uses to shut down active run workers. This prevents session cleanup from SIGKILLing the server before it can terminate worker process groups, which was leaving orphaned `fabro <run> running` subprocesses behind.
This commit is contained in:
parent
9d9ebd529f
commit
099362cd42
1 changed files with 15 additions and 1 deletions
|
|
@ -576,7 +576,7 @@ fn stop_test_server(server: &ServerPaths) {
|
|||
fabro_proc::sigterm(pid);
|
||||
|
||||
let poll = std::time::Duration::from_millis(50);
|
||||
let timeout = std::time::Duration::from_secs(3);
|
||||
let timeout = test_server_stop_timeout();
|
||||
let mut elapsed = std::time::Duration::ZERO;
|
||||
while elapsed < timeout && fabro_proc::process_alive(pid) {
|
||||
std::thread::sleep(poll);
|
||||
|
|
@ -590,6 +590,12 @@ fn stop_test_server(server: &ServerPaths) {
|
|||
let _ = std::fs::remove_file(&record_path);
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
fn shared_server_paths(root: &Path) -> ServerPaths {
|
||||
ServerPaths {
|
||||
root: root.to_path_buf(),
|
||||
|
|
@ -1737,6 +1743,14 @@ mod tests {
|
|||
assert!(create_args.contains(&context.test_case_label()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stop_test_server_timeout_exceeds_server_worker_grace() {
|
||||
assert!(
|
||||
test_server_stop_timeout() >= std::time::Duration::from_secs(6),
|
||||
"test harness must give the server longer than its 5s worker shutdown grace"
|
||||
);
|
||||
}
|
||||
|
||||
struct EnvGuard {
|
||||
key: &'static str,
|
||||
original: Option<String>,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue