Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d38b3a7
tests: add patchbay netsim tests
Frando Mar 5, 2026
722f174
tests: improve patchbay test error reporting
Frando Mar 24, 2026
141cce5
improve patchbay test error reporting
Frando Mar 24, 2026
c5d5928
fixup timeouts
Frando Mar 24, 2026
ff384df
chore: bump patchbay
Frando Mar 24, 2026
42c6001
update patchbay, enable parallelism, export metrics
Frando Mar 26, 2026
26f4b83
split out degradation tests into individual tests
Frando Mar 26, 2026
e9b2dcb
fix: improve CI workflow
Frando Mar 30, 2026
ef8a3f4
fix: use nextest profiles instead of cfg directive
Frando Mar 30, 2026
1849bbf
address review: remove obsolete helper fns
Frando Mar 30, 2026
44a7ac5
fixup after rebase
Frando Mar 30, 2026
ea4aa51
chore: fmt
Frando Mar 30, 2026
bfd933f
remove netreport test draft (was not used yet), will be added back later
Frando Mar 30, 2026
4778d37
docs fixes
Frando Mar 30, 2026
400ecf2
fixup workflow
Frando Mar 30, 2026
17cf5df
fix: ignore patchbay tests in cross ci
Frando Mar 30, 2026
9153977
fix: reduce concurrency
Frando Mar 30, 2026
6be3c7f
chore: update to patchbay 0.2.0
Frando Mar 30, 2026
3b8a11a
refactor: remove macro for degrade ladder
Frando Mar 30, 2026
d8c8fc4
refactor: use enum for server/client side
Frando Mar 30, 2026
9f7f09c
fix: use patchbay with fix for bidi link conditioning
Frando Mar 31, 2026
b8f2082
ignore extreme and absurd degradations for now
Frando Mar 31, 2026
82f9d7a
fix: make test less flaky
Frando Mar 31, 2026
8c243d8
deps: bump patchbay to 0.3
Frando Mar 31, 2026
044ed4a
chore: remove patchbay publishing for now
Frando Mar 31, 2026
7dbb85b
refactor: use server/client fns for pair constructions
Frando Apr 1, 2026
3ebee11
refactor: remove some patchbay tests
Frando Apr 1, 2026
207fa3f
refactor: improve and harden patchbay tests
Frando Apr 1, 2026
4405898
fix: incongruency btw log and test
Frando Apr 1, 2026
a29eb7f
improve docs
Frando Apr 1, 2026
91cfc40
fixup workflow
Frando Apr 1, 2026
b4ef35d
Revert "refactor: remove some patchbay tests"
Frando Apr 1, 2026
7d83af1
Merge remote-tracking branch 'origin/Frando/more-patchbay-tests' into…
matheus23 Apr 2, 2026
761ee0e
Unignore tests
matheus23 Apr 2, 2026
82e1279
Disable retries
matheus23 Apr 2, 2026
0234aa3
Properly close connections
matheus23 Apr 7, 2026
73f7b0f
Merge branch 'main' into matheus23/check-hp
matheus23 Apr 8, 2026
e4a2060
Update to latest noq
matheus23 Apr 8, 2026
51f5156
Set router to V4 only in first phase of switch_uplink_v6
matheus23 Apr 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/patchbay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@ jobs:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: mozilla-actions/sccache-action@v0.0.9
- name: Install cargo-make and cargo-nextest

- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: nextest@${{ env.NEXTEST_VERSION }},cargo-make
tool: nextest@${{ env.NEXTEST_VERSION }}

- name: Build patchbay tests
run: cargo make patchbay --no-run
run: cargo nextest run -p iroh --test patchbay --profile patchbay --release --no-run

- name: Run patchbay tests
id: tests
run: cargo make patchbay
run: cargo nextest run -p iroh --test patchbay --profile patchbay --release
env:
RUST_LOG: ${{ runner.debug && 'trace' || 'debug' }}
PATCHBAY_LOG: trace
Expand Down
20 changes: 17 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions iroh/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ n0-tracing-test = "0.3"
clap = { version = "4", features = ["derive"] }
tracing-subscriber = { version = "0.3", features = [
"env-filter",
"json",
] }
indicatif = { version = "0.18", features = ["tokio"] }
parse-size = { version = "1.1.0", features = ['std'] }
Expand Down
19 changes: 10 additions & 9 deletions iroh/tests/patchbay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use std::time::Duration;
use iroh::{TransportAddr, endpoint::Side};
use n0_error::{Result, StackResultExt, StdResultExt};
use n0_tracing_test::traced_test;
use patchbay::{LinkCondition, LinkDirection, LinkLimits, Nat, RouterPreset, TestGuard};
use patchbay::{IpSupport, LinkCondition, LinkDirection, LinkLimits, Nat, RouterPreset, TestGuard};
use testdir::testdir;
use tracing::info;

Expand Down Expand Up @@ -79,6 +79,7 @@ async fn holepunch_simple() -> Result {
.await
.context("holepunch to direct")?;
info!("connection became direct");
conn.close(0u32.into(), b"bye!");
Ok(())
})
.run()
Expand All @@ -97,7 +98,6 @@ async fn holepunch_simple() -> Result {
/// uplink switch.
#[tokio::test]
#[traced_test]
#[ignore = "known to still fail"]
async fn switch_uplink_v4() -> Result {
let (lab, relay_map, _relay_guard, guard) = lab_with_relay(testdir!()).await?;
let nat1 = lab.add_router("nat1").nat(Nat::Home).build().await?;
Expand Down Expand Up @@ -154,6 +154,7 @@ async fn switch_uplink_v4() -> Result {
.await
.context("failed at ping_open")?;
info!("ping done");
conn.close(0u32.into(), b"bye!");
Ok(())
})
.run()
Expand All @@ -171,7 +172,6 @@ async fn switch_uplink_v4() -> Result {
/// Currently ignored because this fails in roughly half of runs.
#[tokio::test]
#[traced_test]
#[ignore = "known to still be flaky"]
async fn switch_uplink_v6() -> Result {
let (lab, relay_map, _relay_guard, guard) = lab_with_relay(testdir!()).await?;
let public = lab
Expand All @@ -182,6 +182,7 @@ async fn switch_uplink_v6() -> Result {
let home = lab
.add_router("nat2")
.preset(RouterPreset::Home)
.ip_support(IpSupport::V4Only)
.build()
.await?;
let mobile = lab
Expand Down Expand Up @@ -249,6 +250,7 @@ async fn switch_uplink_v6() -> Result {
ping_open(&conn, timeout)
.await
.context("ping after v6 switch")?;
conn.close(0u32.into(), b"bye!");
Ok(())
})
.run()
Expand Down Expand Up @@ -322,6 +324,7 @@ async fn change_ifaces() -> Result {
info!(addr=?next.remote_addr(), "new direct path established");

ping_open(&conn, timeout).await.context("ping_open")?;
conn.close(0u32.into(), b"bye!");
Ok(())
})
.run()
Expand Down Expand Up @@ -377,6 +380,7 @@ async fn link_outage_recovery() -> Result {
ping_open(&conn, timeout)
.await
.context("ping_open after direct")?;
conn.close(0u32.into(), b"bye!");
Ok(())
})
.run()
Expand Down Expand Up @@ -505,6 +509,7 @@ async fn run_degrade_level(impaired_side: Side, level: usize) -> Result<TestGuar
info!("direct path established, sending ping");
ping_open(&conn, timeout).await.context("ping_open")?;
info!("ping complete");
conn.close(0u32.into(), b"bye!");
Ok(())
})
.run(),
Expand All @@ -515,7 +520,7 @@ async fn run_degrade_level(impaired_side: Side, level: usize) -> Result<TestGuar

match &result {
Ok(()) => tracing::event!(
target: "test::_events::ladder_pass",
target: "iroh::_events::test_ladder_pass",
tracing::Level::INFO,
level,
latency_ms = limits.latency_ms,
Expand All @@ -525,7 +530,7 @@ async fn run_degrade_level(impaired_side: Side, level: usize) -> Result<TestGuar
"PASSED",
),
Err(err) => tracing::event!(
target: "test::_events::ladder_fail",
target: "iroh::_events::test_ladder_fail",
tracing::Level::WARN,
level,
latency_ms = limits.latency_ms,
Expand Down Expand Up @@ -572,15 +577,13 @@ async fn degrade_server_3_terrible() -> Result {

#[tokio::test]
#[traced_test]
#[ignore = "not yet passing reliably"]
async fn degrade_server_4_extreme() -> Result {
run_degrade_level(Side::Server, 4).await?.ok();
Ok(())
}

#[tokio::test]
#[traced_test]
#[ignore = "not yet passing reliably"]
async fn degrade_server_5_absurd() -> Result {
run_degrade_level(Side::Server, 5).await?.ok();
Ok(())
Expand Down Expand Up @@ -617,15 +620,13 @@ async fn degrade_client_3_terrible() -> Result {

#[tokio::test]
#[traced_test]
#[ignore = "not yet passing reliably"]
async fn degrade_client_4_extreme() -> Result {
run_degrade_level(Side::Client, 4).await?.ok();
Ok(())
}

#[tokio::test]
#[traced_test]
#[ignore = "not yet passing reliably"]
async fn degrade_client_5_absurd() -> Result {
run_degrade_level(Side::Client, 5).await?.ok();
Ok(())
Expand Down
14 changes: 4 additions & 10 deletions iroh/tests/patchbay/util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{future::Future, path::PathBuf, sync::Arc, time::Duration};
use std::{future::Future, path::PathBuf, time::Duration};

use iroh::{
Endpoint, EndpointAddr, RelayMap, RelayMode, Watcher,
Expand All @@ -9,7 +9,7 @@ use iroh_metrics::MetricsGroupSet;
use n0_error::{Result, StackResultExt, StdResultExt, anyerr, ensure_any};
use n0_future::{boxed::BoxFuture, task::AbortOnDropHandle};
use patchbay::{Device, IpSupport, Lab, LabOpts, OutDir, TestGuard};
use tokio::sync::{Barrier, oneshot};
use tokio::sync::oneshot;
use tracing::{Instrument, debug, error, error_span, event, info};

use self::relay::run_relay_server;
Expand Down Expand Up @@ -143,10 +143,7 @@ impl Pair {

let (addr_tx, addr_rx) = oneshot::channel();
let relay_map2 = self.relay_map.clone();
let barrier = Arc::new(Barrier::new(2));
let barrier2 = barrier.clone();
let server_task = server_device.spawn(|dev| {
let barrier = barrier2;
async move {
let endpoint = endpoint_builder(&dev, relay_map2).bind().await
.context("server endpoint bind")?;
Expand All @@ -165,8 +162,7 @@ impl Pair {
Ok(()) => info!("run function completed successfully"),
Err(err)=> error!("run function failed: {err:#}"),
}
// Wait until the client run function completed before dropping the endpoint.
barrier.wait().await;
endpoint.close().await;
for group in endpoint.metrics().groups() {
dev.record_iroh_metrics(group);
}
Expand All @@ -190,9 +186,7 @@ impl Pair {
Ok(()) => info!("run function completed successfully"),
Err(err)=> error!("run function failed: {err:#}"),
}
// Wait until the server run function completed before dropping the endpoint.
barrier.wait().await;
// endpoint.close().await;
endpoint.close().await;
for group in endpoint.metrics().groups() {
dev.record_iroh_metrics(group);
}
Expand Down
Loading