Skip to content

Commit 51ac57a

Browse files
committed
test(netwatch): add patchbay network simulation tests
Add patchbay tests that exercise netwatch's interface and route detection inside virtual network namespaces. The tests cover v4-only, v6-only, dual-stack, and v4-to-v6 replug scenarios. Three of the five tests are currently ignored: they expose a bug where default_route() fails to detect IPv6 default routes on Linux because /proc/net/route only contains IPv4 entries and the netlink fallback is never reached. Also adds patchbay CI workflow, nextest patchbay profile, and a cargo-make task to match the iroh project's patchbay setup.
1 parent 2cdaf61 commit 51ac57a

7 files changed

Lines changed: 463 additions & 14 deletions

File tree

.config/nextest.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,13 @@ run-in-isolation = { max-threads = 32 }
77
[[profile.ci.overrides]]
88
filter = 'test(::run_in_isolation::)'
99
test-group = 'run-in-isolation'
10-
threads-required = 32
10+
threads-required = 32
11+
12+
[profile.default]
13+
default-filter = 'not binary(patchbay)'
14+
15+
[profile.patchbay]
16+
fail-fast = false
17+
test-threads = 1
18+
default-filter = 'binary(patchbay)'
19+
slow-timeout = { period = "30s", terminate-after = 4 }

.github/workflows/patchbay.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Patchbay Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: patchbay-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
env:
14+
RUST_BACKTRACE: 1
15+
SCCACHE_CACHE_SIZE: "10G"
16+
17+
jobs:
18+
patchbay_tests:
19+
name: Patchbay Tests
20+
timeout-minutes: 15
21+
runs-on: [self-hosted, linux, X64]
22+
env:
23+
RUSTC_WRAPPER: "sccache"
24+
steps:
25+
- name: Enable unprivileged user namespaces
26+
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
27+
continue-on-error: true
28+
29+
- uses: actions/checkout@v6
30+
- uses: dtolnay/rust-toolchain@stable
31+
- uses: mozilla-actions/sccache-action@v0.0.9
32+
- name: Install cargo-make and cargo-nextest
33+
uses: taiki-e/install-action@v2
34+
with:
35+
tool: nextest@0.9.80,cargo-make
36+
37+
- name: Build patchbay tests
38+
run: cargo make patchbay --no-run
39+
40+
- name: Run patchbay tests
41+
run: |
42+
set -o pipefail
43+
cargo make patchbay 2>&1 | tee "$RUNNER_TEMP/logs.txt"
44+
env:
45+
PATCHBAY_LOG: trace
46+
RUST_LOG: trace
47+
48+
- name: Upload test results
49+
if: always()
50+
uses: actions/upload-artifact@v7
51+
with:
52+
name: patchbay-testdir-${{ github.sha }}
53+
path: |
54+
${{ runner.temp }}/logs.txt
55+
retention-days: 7
56+
if-no-files-found: ignore

0 commit comments

Comments
 (0)