Skip to content

test(node): route dht_lookup teardown through the bounded support::shutdown helper (#1831) - #1846

Merged
thiras merged 2 commits into
mainfrom
fix/dht-lookup-teardown
Aug 26, 2026
Merged

thiras merged 2 commits into
mainfrom
fix/dht-lookup-teardown

Conversation

@thiras

@thiras thiras commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1831.

Mirrors what #1830 did for dht_integration.rs: crates/node/tests/dht_lookup.rs no longer hand-rolls teardown.

  • Add mod support; + use support::shutdown;, as dht_loopback.rs and probe_loopback.rs do. Nothing in this file shadows the name: TestServer::shutdown is gone.
  • Change the accept task's return type to JoinHandle<()> (drop the decorative anyhow::Result), so shutdown returns a panicking server task's JoinError rather than discarding it via .abort().
  • Replace TestServer::shutdown (fire-and-forget tokio::spawn close) with into_teardown_parts(self) -> (JoinHandle<()>, Endpoint).
  • Fold each test's client + server teardown into one shutdown call, client endpoint first — one deadline per test rather than one per endpoint.
  • The six-server ceiling test carries its length in the type: servers is a [TestServer; 6], so teardown destructures servers.map(TestServer::into_teardown_parts) into the two arrays shutdown wants.

Verified: cargo fmt -- --check and cargo clippy -p decdn-node --all-targets -- -D warnings clean; dht_lookup, dht_integration, and dht_loopback suites all pass (28/28).

Copilot AI lite review requested due to automatic review settings August 26, 2026 21:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

… six-server teardown

The comment above `mod support;` justified fully-qualified `support::shutdown`
calls by a competing `TestServer::shutdown` method, which this file no longer
has. Import the helper instead, as `dht_loopback.rs` and `probe_loopback.rs` do,
and keep only the part of the comment that holds: teardown goes through the
bounded helper rather than a bare `Endpoint::close().await`.

The six-server ceiling test now carries its length in the type. `servers` becomes
a `[TestServer; 6]` at construction, so teardown destructures
`servers.map(TestServer::into_teardown_parts)` into the two arrays `shutdown`
wants instead of rebuilding them through two `Vec` conversions whose error arms
cannot fire.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown

Coverage report

Total: 82.09% (was 82.08%, ● 0.00%) — 68890/83925 lines

No coverage data for changed Rust files.

History
Commit Total Δ vs base
7ce3dea (HEAD) 82.09% ● 0.00%

@thiras
thiras merged commit 4474ca6 into main Aug 26, 2026
25 checks passed
@thiras
thiras deleted the fix/dht-lookup-teardown branch August 26, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(node): dht_lookup.rs tears endpoints down unbounded and fire-and-forget

3 participants