From 7b10101f603e4d82abe1fcd3233b86e10bbe96bc Mon Sep 17 00:00:00 2001 From: ldm0 Date: Sun, 1 Nov 2026 20:51:44 +0800 Subject: [PATCH] test(worker): await nested keepalive detachment before inspection Joining a parent Worker intentionally does not synchronously join its nested Workers. Wait for the child to publish its pending detached keepalive before asserting its exact count, while withholding the server response. Keep the existing timeout and the zero-after-completion assertion. Validation: workspace fmt, all-target/all-feature clippy and full nextest. --- .../src/worker/thread/tests/lifecycle/keepalive_fetch.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/moli-renderer-v8/src/worker/thread/tests/lifecycle/keepalive_fetch.rs b/moli-renderer-v8/src/worker/thread/tests/lifecycle/keepalive_fetch.rs index 3299a426e93..4a3cbf86c73 100644 --- a/moli-renderer-v8/src/worker/thread/tests/lifecycle/keepalive_fetch.rs +++ b/moli-renderer-v8/src/worker/thread/tests/lifecycle/keepalive_fetch.rs @@ -84,6 +84,15 @@ async fn assert_immediate_close_keepalive(shared: bool, post: bool, nested: bool let method = if post { "POST" } else { "GET" }; assert!(request.starts_with(&format!("{method} /keepalive HTTP/1.1\r\n"))); assert!(request.ends_with(&format!("\r\n\r\n{body}"))); + // Joining the parent does not join its nested workers. Their asynchronous + // teardown must detach the pending load before we inspect the registry. + timeout(TIMEOUT, async { + while runtime.detached_keepalive_diagnostics().active_load_count == 0 { + tokio::task::yield_now().await; + } + }) + .await + .expect("the closing worker must detach its pending keepalive request"); assert_eq!( runtime.detached_keepalive_diagnostics().active_load_count, 1