Draft
Conversation
- make it more obvious who is client and who is server - drop endpoint dead on the floor after both run functions completed
Member
Author
|
Note: Initial review of some tests is here https://github.com/n0-computer/iroh/pull/3986/files/044ed4a5c474e5c00d8d75bec1d59aab0c507ed3#diff-c02a524f2ce2330ad0e4643988865ff152cb0d1ac8712cd2dbcb2b91c80c3eca |
3 tasks
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/4065/docs/iroh/ Last updated: 2026-04-01T10:54:31Z |
858177d to
b4ef35d
Compare
Frando
added a commit
that referenced
this pull request
Apr 2, 2026
## Description Adds a first round of tests using our new network simulation framework, [patchbay](https://github.com/n0-computer/patchbay). Patchbay uses Linux network namespaces to create isolated network topologies with routers, NATs, and link impairment. This lets us test actual holepunching and NAT traversal in realistic conditions, without needing any external infrastructure. The test suite covers establishing a direct path in different scenarios: - Holepunching: two devices behind destination-independent NATs connect via relay, then upgrade to direct. - Uplink switching: a device changes its network uplink (v4 and v6) mid-connection and recovers a direct path. - Interface changes: network interfaces are added or removed while connected - Link outage recovery: a device goes offline and comes back, direct connection resumes - Degraded links: increasing levels of impairment (latency, jitter, packet loss) are applied to either side of a connection and holepunching still succeeds Some tests that iroh doesn't pass yet are included but marked `#[ignore]`. They should be un-ignored as we improve things. ### Running the tests On Linux, things just work with user namespace support: ```sh cargo make patchbay # expands to: cargo nextest run -p iroh --features qlog --test patchbay --profile patchbay # run a specific test with logs: RUST_LOG=trace cargo make patchbay holepunch_simple --nocapture ``` Test output is saved in `./target/testdir-current/patchbay/<test-name>`. Patchbay currently collects tracing logs for each device, qlog files (if the feature is enabled), and endpoint metrics. There's also a browser UI for viewing timelines, topologies, and logs. The UI can also be used to compare different test runs. ```sh cargo install --git https://github.com/n0-computer/patchbay patchbay-cli patchbay serve --testdir --open ``` On macOS you'll need to run the patchbay tests in a VM or container. The `patchbay` CLI includes a tool to set up a container or QEMU VM for this. ```sh # both commands default to the container backend on macOS and native on linux patchbay test -p iroh --test patchbay patchbay serve --testdir --open # use --vm to force VM mode even on linux ``` See the [patchbay docs](https://n0-computer.github.io/patchbay/) and [README](https://github.com/n0-computer/patchbay) for more details. ## Notes and open questions There's a draft PR with some more tests: #4065, but they need more thought and work to really cover what we want to test. ## Breaking Changes None. ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [x] Tests if relevant.
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
restores patchbay tests that have been removed from initial PR in #3986
(not yet reviewed, might need more changes)
Breaking Changes
Notes & open questions
Change checklist
quic-rpciroh-gossipiroh-blobsdumbpipesendme