Skip to content

Commit 87acc7f

Browse files
Arqudignifiedquire
authored andcommitted
fix: make netsim run from examples (#2959)
## Description Moves our netsim tests to run from an example and only test the lib part of the code, not the full CLI & blobs. Things left to do: - [x] rename the example from `new` to anything that makes more sense `netsim` runs it under `iroh-transfer` - [x] clean up the example code - [x] add the option to provide either a relay config or pass in at least the relay url as an argument - [x] continue the CI adjustment and move all invocations of the netsim runner to run from `iroh_v2` and `integration_v2` sims (we want a less abrupt netsim switchover) - [x] convert the remaining sims in `chuck/netsim/sims` to the new format - [ ] after some time flip back the CI invocations to be regular `iroh` and `integration` sims which includes doing the same on `netsim` and removing the old ones ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [ ] Self-review. - [ ] 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. - [ ] Tests if relevant. - [ ] All breaking changes documented.
1 parent 9b3f007 commit 87acc7f

File tree

7 files changed

+345
-9
lines changed

7 files changed

+345
-9
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,13 @@ jobs:
246246
# TODO: We have a bunch of platform-dependent code so should
247247
# probably run this job on the full platform matrix
248248
- name: clippy check (all features)
249-
run: cargo clippy --workspace --all-features --all-targets --bins --tests --benches
249+
run: cargo clippy --workspace --all-features --all-targets --lib --bins --tests --benches --examples
250250

251251
- name: clippy check (no features)
252-
run: cargo clippy --workspace --no-default-features --lib --bins --tests
252+
run: cargo clippy --workspace --no-default-features --all-targets --lib --bins --tests --benches --examples
253253

254254
- name: clippy check (default features)
255-
run: cargo clippy --workspace --all-targets
255+
run: cargo clippy --workspace --all-targets --lib --bins --tests --benches --examples
256256

257257
msrv:
258258
if: "github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')"
@@ -295,7 +295,7 @@ jobs:
295295
branch: ${{ github.ref }}
296296
max_workers: 4
297297
netsim_branch: "main"
298-
sim_paths: "sims/iroh/iroh.json,sims/integration"
298+
sim_paths: "sims/iroh_v2/iroh.json,sims/integration_v2"
299299
pr_number: ${{ github.event.pull_request.number || '' }}
300300

301301
codespell:

.github/workflows/netsim.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
branch: "main"
4040
max_workers: 1
4141
netsim_branch: "main"
42-
sim_paths: "sims/iroh,sims/integration"
42+
sim_paths: "sims/iroh_v2,sims/integration_v2"
4343
pr_number: ""
4444
publish_metrics: true
4545
build_profile: "optimized-release"
@@ -53,7 +53,7 @@ jobs:
5353
branch: ${{inputs.branch}}
5454
max_workers: 1
5555
netsim_branch: ${{inputs.netsim_branch}}
56-
sim_paths: "sims/iroh"
56+
sim_paths: "sims/iroh_v2"
5757
pr_number: ${{inputs.pr_number}}
5858
publish_metrics: false
5959
build_profile: "optimized-release"

.github/workflows/netsim_runner.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ jobs:
133133
- name: Copy binaries to right location
134134
run: |
135135
cp target/${{inputs.build_profile}}/examples/* ../chuck/netsim/bins/
136-
cp target/${{inputs.build_profile}}/iroh ../chuck/netsim/bins/iroh
136+
cp target/${{inputs.build_profile}}/examples/transfer ../chuck/netsim/bins/iroh-transfer
137137
cp target/${{inputs.build_profile}}/iroh-relay ../chuck/netsim/bins/iroh-relay
138138
cp ../chuck/target/release/chuck ../chuck/netsim/bins/chuck
139139

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

iroh-net/bench/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub mod s2n;
2121
pub mod stats;
2222

2323
#[derive(Parser, Debug, Clone, Copy)]
24-
#[clap(name = "bulk")]
24+
#[clap(name = "iroh-net-bench")]
2525
pub enum Commands {
2626
Iroh(Opt),
2727
#[cfg(not(any(target_os = "freebsd", target_os = "openbsd", target_os = "netbsd")))]

iroh/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ ref-cast = "1.0.23"
6262
# Examples
6363
clap = { version = "4", features = ["derive"], optional = true }
6464
indicatif = { version = "0.17", features = ["tokio"], optional = true }
65+
parse-size = { version = "=1.0.0", optional = true } # pinned version to avoid bumping msrv to 1.81
6566

6667
# Documentation tests
6768
url = { version = "2.5.0", features = ["serde"] }
@@ -74,7 +75,7 @@ test = []
7475
discovery-pkarr-dht = ["iroh-net/discovery-pkarr-dht"]
7576
test-utils = ["iroh-net/test-utils"]
7677

77-
examples = ["dep:clap", "dep:indicatif"]
78+
examples = ["dep:clap", "dep:indicatif", "dep:parse-size"]
7879

7980
[dev-dependencies]
8081
anyhow = { version = "1" }
@@ -101,3 +102,7 @@ rustdoc-args = ["--cfg", "iroh_docsrs"]
101102
[[example]]
102103
name = "rpc"
103104
required-features = ["examples"]
105+
106+
[[example]]
107+
name = "transfer"
108+
required-features = ["examples"]

0 commit comments

Comments
 (0)