test(iroh-relay): integration tests for embedding the relay#4206
Open
test(iroh-relay): integration tests for embedding the relay#4206
Conversation
|
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 |
9c054dd to
eb60061
Compare
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.
eb60061 to
ba16107
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds two integration tests that demonstrate embedding the relay inside an external HTTP server:
tests/relay_hyper.rs: serves aRelayServiceWithNotifydirectly via hyper.tests/relay_axum.rs: uses axum, itsRouterand itsWebSocketUpgradefor the/relayroute. Then passes the client stream to the relayClients. Does not useRelayServeWthNotfy.Also exports the type aliases
iroh_relay::server::http_server::BytesBody,HyperError, andHyperResultso that external code can name the response and error types ofRelayServiceWithNotify's hyper service.Change checklist