Repository navigation
Description
Split out of #1830, which fixed the same defect in crates/node/tests/dht_integration.rs.
crates/node/tests/dht_lookup.rs does not declare mod support; and hand-rolls teardown:
TestServer::shutdown(crates/node/tests/dht_lookup.rs:117-121) aborts the accept loop and then doestokio::spawn(async move { ep.close().await })— fire-and-forget. The test returns while the close is still in flight, so the runtime is torn down mid-close and the endpoint may never drain.- Call sites
:275,:330,:382,:549, each preceded by a bareclient_ep.close().awaitwith no deadline of its own.
That is exactly the hazard support::shutdown documents at crates/node/tests/support/mod.rs:164-166: a caller that tears an endpoint down by hand is outside the helper's guarantee and can park until the .config/nextest.toml backstop (180s for this package) instead of failing in 15s with the stalled stage named.
Fix
Mirror what #1830 did for dht_integration.rs:
- Add
mod support;; call it fully qualified assupport::shutdown(...)since the file has a competingTestServer::shutdownmethod. - Change the accept task's return type to
JoinHandle<()>if it carries a decorativeanyhow::Result.support::shutdownthen returns a panicking server task'sJoinError, so a handler panic in the accept loop fails its test rather than being discarded by.abort(). - Add
into_teardown_parts(self) -> (JoinHandle<()>, Endpoint)and fold each test's client + server teardown into onesupport::shutdowncall, client endpoint first — so a whole test's teardown costs one deadline, not one per endpoint. - Delete the detached variant.
crates/node/tests/dht_loopback.rs:1580 and crates/node/tests/dht_integration.rs are both working templates.
Not a live flake
No failure has been attributed to this file. It is the same latent unbounded-park hazard, filed so the two DHT test binaries do not diverge.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
test(node): route dht_lookup teardown through the bounded support::sh…