Repository navigation
test(node): cover self-hosted discovery two-node NodeAnnounce + probe without n0 fallback (#967) - #983
Conversation
… 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]>
There was a problem hiding this comment.
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.
Coverage reportTotal: 83.65% (was 83.61%, ▲ +0.04%) — 39884/47682 lines No coverage data for changed Rust files. History
|
There was a problem hiding this comment.
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.rscovering (1) NodeAnnounce gossip reception intoPeerTableand (2) acdn/probe/v1round-trip where the client connects by NodeId-only with address resolution viaMemoryLookup. - 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]>
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 — aMemoryLookupstatic peer map onpresets::Minimalwith relays disabled (no n0 DNS / pkarr / relay anywhere) — and confirms:GossipServicepublisher + subscriber path (validate_envelope+ peer-table insert) and each lands the other in itsPeerTable, with addresses resolved purely through the operator-configuredMemoryLookup.cdn/probe/v1exchange completes where the client resolves the server byNodeIdalone. Since both endpoints arepresets::Minimal+RelayMode::Disabledwith only aMemoryLookupleg, 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::spawnsubscribes 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 extrasubscribe_and_join(global_topic, [peer])handle whose bootstrap address is still resolved through the sameMemoryLookup. What this does not cover (called out as out-of-scope future work): mesh self-bootstrap byGossipServicealone (it has no bootstrap-peer seam), and the livePkarrPublisher/DnsAddressLookuplegs (which need a real pkarr relay / DNS zone).Verification
cargo build --tests -p decdn-node— cleancargo clippy --all-targets -- -D warnings— cleancargo fmt -- --check— cleancargo nextest run -p decdn-node— 654 passed, 0 failed (incl. both new tests)🤖 Generated with Claude Code