Skip to content

test(iroh-relay): integration tests for embedding the relay#4206

Open
Frando wants to merge 1 commit intomainfrom
Frando/relay-embed-tests
Open

test(iroh-relay): integration tests for embedding the relay#4206
Frando wants to merge 1 commit intomainfrom
Frando/relay-embed-tests

Conversation

@Frando
Copy link
Copy Markdown
Member

@Frando Frando commented Apr 28, 2026

Description

Adds two integration tests that demonstrate embedding the relay inside an external HTTP server:

  • tests/relay_hyper.rs: serves a RelayServiceWithNotify directly via hyper.
  • tests/relay_axum.rs: uses axum, its Router and its WebSocketUpgrade for the /relay route. Then passes the client stream to the relay Clients. Does not use RelayServeWthNotfy.

Also exports the type aliases iroh_relay::server::http_server::BytesBody, HyperError, and HyperResult so that external code can name the response and error types of RelayServiceWithNotify's hyper service.

Change checklist

  • Self-review.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/4206/docs/iroh/

Last updated: 2026-04-29T09:57:56Z

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: 5dfdb1e

@n0bot n0bot Bot added this to iroh Apr 29, 2026
@github-project-automation github-project-automation Bot moved this to 🚑 Needs Triage in iroh Apr 29, 2026
@Frando Frando force-pushed the Frando/relay-embed-tests branch from 9c054dd to eb60061 Compare April 29, 2026 09:55
Adds two integration tests that demonstrate embedding the relay
inside an external HTTP server.

`tests/relay_hyper.rs` serves [`RelayServiceWithNotify`] directly
via hyper, with a `dispatch` function that routes `/ping` to a
hand-rolled probe response and `/relay` through a freshly
constructed `RelayServiceWithNotify` per request.

`tests/relay_axum.rs` hosts the relay alongside an axum router
on a single port, using axum's `WebSocketUpgrade` extractor and
bridging the resulting socket to iroh-relay's [`BytesStreamSink`]
via a small adapter modeled after kitsune2's `iroh_relay_axum.rs`.

Promotes `iroh_relay::server::http_server::BytesBody`, `HyperError`,
and `HyperResult` from `pub(super)` to `pub` so external code can
name the response and error types of `RelayServiceWithNotify`'s
hyper service.
@Frando Frando force-pushed the Frando/relay-embed-tests branch from eb60061 to ba16107 Compare April 29, 2026 10:39
@Frando Frando marked this pull request as ready for review April 29, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚑 Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant