Skip to content

test(node): cover self-hosted discovery two-node NodeAnnounce + probe without n0 fallback (#967) - #983

Merged
thiras merged 2 commits into
mainfrom
test/967-self-hosted-discovery
Jun 25, 2026
Merged

thiras merged 2 commits into
mainfrom
test/967-self-hosted-discovery

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Closes #967

Summary

Adds crates/node/tests/self_hosted_discovery.rs, an integration test that stands up two nodes wired with ONLY the operator-configured discovery seam added in #829 — a MemoryLookup static peer map on presets::Minimal with relays disabled (no n0 DNS / pkarr / relay anywhere) — and confirms:

  1. NodeAnnounce exchange — the two nodes run the production GossipService publisher + subscriber path (validate_envelope + peer-table insert) and each lands the other in its PeerTable, with addresses resolved purely through the operator-configured MemoryLookup.
  2. Probe round-trip — a cdn/probe/v1 exchange completes where the client resolves the server by NodeId alone. Since both endpoints are presets::Minimal + RelayMode::Disabled with only a MemoryLookup leg, a successful connect can only mean self-hosted discovery (not n0 infra) resolved the address.

The test mirrors runtime::add_discovery_lookups's static-peer-map composition, so it is self-certifying: it cannot pass via a silent n0 fallback because no n0 discovery/relay service is wired. Deterministic and loopback-only (passed 5/5 reruns, ~0.3-0.5s each).

Coverage caveat (documented in the test)

GossipService::spawn subscribes every topic with an empty iroh-gossip bootstrap set, so iroh-gossip's membership never proactively dials — a node can only accept inbound gossip. The two-node mesh is therefore seeded explicitly by one extra subscribe_and_join(global_topic, [peer]) handle whose bootstrap address is still resolved through the same MemoryLookup. What this does not cover (called out as out-of-scope future work): mesh self-bootstrap by GossipService alone (it has no bootstrap-peer seam), and the live PkarrPublisher / DnsAddressLookup legs (which need a real pkarr relay / DNS zone).

Verification

  • cargo build --tests -p decdn-node — clean
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo fmt -- --check — clean
  • cargo nextest run -p decdn-node — 654 passed, 0 failed (incl. both new tests)

🤖 Generated with Claude Code

… without n0 fallback (#967)

Adds `crates/node/tests/self_hosted_discovery.rs`, an integration test that
stands up two nodes using ONLY the operator-configured discovery seam from
#829 — a `MemoryLookup` static peer map on `presets::Minimal` with relays
disabled, i.e. no n0 DNS/pkarr/relay anywhere — and proves:

- two nodes exchange a real `NodeAnnounce` over the production `GossipService`
  publisher/subscriber path and each lands the other in its `PeerTable`, and
- a `cdn/probe/v1` round-trip completes where the client resolves the server
  by `NodeId` alone, so a successful connect can only mean operator discovery
  (not n0 infra) resolved the address.

Both endpoints are built on `presets::Minimal` + `RelayMode::Disabled` with a
single `MemoryLookup` leg, mirroring `runtime::add_discovery_lookups` for a
static-peer-map config, so the tests cannot pass via a silent n0 fallback.
Deterministic and loopback-only (no external network).

Coverage caveat documented in the test: `GossipService::spawn` subscribes with
an empty iroh-gossip bootstrap set, so the two-node mesh is seeded explicitly
via one extra `subscribe_and_join` handle whose bootstrap addr is resolved
through the same `MemoryLookup`. Mesh self-bootstrap by `GossipService` alone
and the live `PkarrPublisher`/`DnsAddressLookup` legs (which need real
pkarr/DNS infra) are called out as out-of-scope future work.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI review requested due to automatic review settings June 24, 2026 13:42

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a new integration test suite self_hosted_discovery.rs to verify operator-configured self-hosted discovery without relying on n0 infrastructure. The tests cover exchanging NodeAnnounce gossip and completing a cdn/probe/v1 round-trip where the client resolves the server by NodeId alone. The review feedback suggests enhancing test robustness by propagating panics from background tasks rather than swallowing them, and adding timeouts to network operations (connecting, opening streams, and reading frames) to prevent potential hangs in CI pipelines.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@github-actions

github-actions Bot commented Jun 24, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 83.65% (was 83.61%, ▲ +0.04%) — 39884/47682 lines

No coverage data for changed Rust files.

History
Commit Total Δ vs base
2bec5df 83.64% ▲ +0.03%
041e6be (HEAD) 83.65% ▲ +0.04%

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.

Pull request overview

Adds a new Rust integration test to validate the operator-configured self-hosted discovery path in decdn-node by standing up two loopback-only nodes on iroh::endpoint::presets::Minimal with relays disabled and a MemoryLookup static peer map (i.e., no n0 DNS/pkarr/relay fallback available).

Changes:

  • Introduces crates/node/tests/self_hosted_discovery.rs covering (1) NodeAnnounce gossip reception into PeerTable and (2) a cdn/probe/v1 round-trip where the client connects by NodeId-only with address resolution via MemoryLookup.
  • Implements a deterministic, hermetic two-node harness (custom endpoint builder + explicit gossip mesh seeding) to ensure the test cannot pass via n0 infrastructure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…timeouts (#967)

Make the two-node NodeAnnounce test prove MUTUAL discovery instead of
only A->B: give node B a region ("DE") so its GossipService publisher is
enabled, seed the mesh with a bootstrap-join in both directions (A toward
B and B toward A, each resolved only via the operator MemoryLookup), and
assert both saw_a (B learned A) and saw_b (A learned B). Seed A's
MemoryLookup with B's addr out-of-band after B binds; return the lookup
handle from bind_discovery_endpoint to do so.

Harden the probe round-trip against hangs: wrap connect, open_bi, and
read_frame in 5s tokio timeouts. Propagate background-task panics during
teardown via join_gossip_tasks (resume_unwind on a JoinError panic)
instead of dropping JoinHandle results with `let _ =`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@thiras
thiras merged commit eba7b04 into main Jun 25, 2026
20 checks passed
@thiras
thiras deleted the test/967-self-hosted-discovery branch June 25, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants