Skip to content

test(relay-server): cover a full relay's multiaddr and ENR endpoints - #690

Merged
varex83 merged 1 commit into
mainfrom
fix/issue-118-relay-enr-integration-tests
Sep 9, 2026
Merged

test(relay-server): cover a full relay's multiaddr and ENR endpoints#690
varex83 merged 1 commit into
mainfrom
fix/issue-118-relay-enr-integration-tests

Conversation

@varex83agent

Copy link
Copy Markdown
Collaborator

Closes #118.

The relay-server suite only exercised enr_server with synthetic listen addresses, so nothing in this crate covered a relay whose swarm actually bound a TCP and a UDP listener.

Adds two integration tests that start a whole relay through bind_relay/serve — the path run_relay_p2p_node takes — with one TCP and one UDP listen address on loopback ephemeral ports, then assert GET / advertises both transports with the relay's peer ID appended, and GET /enr reports the ports libp2p actually bound (not the configured port 0). Mirrors charon@v1.7.1 cmd/relay/relay_internal_test.go's TestServeAddrs multiaddrs/enr subtests. Tests only; no production code changed.

Co-Authored-By: Bohdan Ohorodnii 35969035+varex83@users.noreply.github.com

Closes #118.

The relay-server suite only exercised `enr_server` with synthetic listen
addresses, so nothing in this crate covered a relay whose swarm actually
bound a TCP and a UDP listener. Start one through `bind_relay`/`serve` —
the path `run_relay_p2p_node` takes — on loopback ephemeral ports, and
assert `GET /` advertises both transports with the relay's peer ID and
that `GET /enr` reports the ports libp2p bound rather than the
configured port 0.

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
let peer = relay.peer_id;
let tcp = format!("/ip4/127.0.0.1/tcp/{}/p2p/{peer}", relay.tcp_port);
let udp = format!("/ip4/127.0.0.1/udp/{}/quic-v1/p2p/{peer}", relay.udp_port);
assert!(body.contains(&tcp), "missing {tcp} in {body:?}");
let tcp = format!("/ip4/127.0.0.1/tcp/{}/p2p/{peer}", relay.tcp_port);
let udp = format!("/ip4/127.0.0.1/udp/{}/quic-v1/p2p/{peer}", relay.udp_port);
assert!(body.contains(&tcp), "missing {tcp} in {body:?}");
assert!(body.contains(&udp), "missing {udp} in {body:?}");
@varex83
varex83 merged commit 480ff99 into main Sep 9, 2026
19 checks passed
@varex83
varex83 deleted the fix/issue-118-relay-enr-integration-tests branch September 9, 2026 10:37
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.

Add integration tests for relay ENR server

4 participants