Skip to content

Commit 1729243

Browse files
authored
feat(netsim): filter tests (#3946)
## Description Improves on the current filtering logistics of netsim. Instead of just a skiplist, you now have a filter field. Depending on prefix you either run it: - empty - no filtering - prefix the list with `skip:` to skip specific tests in a run - prefix the list with `only:` to only run specific tests - defaults to `only:` if you just provide a list without a prefix ## 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 <!-- Remove any that are not relevant. --> - [ ] 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. - [ ] List all breaking changes in the above "Breaking Changes" section. - [ ] Open an issue or PR on any number0 repos that are affected by this breaking change. Give guidance on how the updates should be handled or do the actual updates themselves. The major ones are: - [ ] [`quic-rpc`](https://github.com/n0-computer/quic-rpc) - [ ] [`iroh-gossip`](https://github.com/n0-computer/iroh-gossip) - [ ] [`iroh-blobs`](https://github.com/n0-computer/iroh-blobs) - [ ] [`dumbpipe`](https://github.com/n0-computer/dumbpipe) - [ ] [`sendme`](https://github.com/n0-computer/sendme)
1 parent 08b0b8a commit 1729243

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ jobs:
351351
netsim_branch: "main"
352352
sim_paths: ${{ github.event_name == 'pull_request' && 'sims/integration' || 'sims/iroh/iroh.json,sims/integration' }}
353353
pr_number: ${{ github.event.pull_request.number || '' }}
354-
skip: ${{ github.event_name == 'pull_request' && 'intg_iroh_full__1_to_3,intg_iroh_full__1_to_1x3,intg_iroh_relay_only__1_to_3' || '' }}
354+
filter: ${{ github.event_name == 'pull_request' && 'skip:intg_iroh_full__1_to_3,intg_iroh_full__1_to_1x3,intg_iroh_relay_only__1_to_3' || '' }}
355355

356356
codespell:
357357
timeout-minutes: 30

.github/workflows/netsim_runner.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ on:
3939
required: false
4040
type: boolean
4141
default: false
42-
skip:
42+
filter:
43+
description: "Test filter: 'skip:test1,test2' to exclude or 'only:test1,test2' to run exclusively"
4344
required: false
4445
type: string
4546
default: ""
@@ -81,7 +82,8 @@ on:
8182
required: false
8283
type: boolean
8384
default: false
84-
skip:
85+
filter:
86+
description: "Test filter: 'skip:test1,test2' to exclude or 'only:test1,test2' to run exclusively. No prefix defaults to only."
8587
required: false
8688
type: string
8789
default: ""
@@ -147,14 +149,24 @@ jobs:
147149
continue-on-error: true
148150
run: |
149151
cd ../chuck/netsim
150-
# split sim_paths by comma
151152
IFS=',' read -ra sim_paths <<< "${{ inputs.sim_paths }}"
152153
rust_log="${{ inputs.rust_log }}"
154+
filter="${{ inputs.filter }}"
155+
filter_flag=""
156+
if [[ -n "${filter}" ]]; then
157+
if [[ "${filter}" == skip:* ]]; then
158+
filter_flag="--skip=${filter#skip:}"
159+
elif [[ "${filter}" == only:* ]]; then
160+
filter_flag="--only=${filter#only:}"
161+
else
162+
filter_flag="--only=${filter}"
163+
fi
164+
fi
153165
for sim_path in "${sim_paths[@]}"; do
154166
if [[ -n "${rust_log}" ]]; then
155-
sudo RUST_LOG="${rust_log}" python3 main.py --max-workers=${{ inputs.max_workers }} ${{ inputs.skip && format('--skip={0}', inputs.skip) || ''}} --integration $sim_path
167+
sudo RUST_LOG="${rust_log}" python3 main.py ${filter_flag} --max-workers=${{ inputs.max_workers }} --integration $sim_path
156168
else
157-
sudo python3 main.py --max-workers=${{ inputs.max_workers }} ${{ inputs.skip && format('--skip={0}', inputs.skip) || ''}} --integration $sim_path
169+
sudo python3 main.py ${filter_flag} --max-workers=${{ inputs.max_workers }} --integration $sim_path
158170
fi
159171
done
160172

0 commit comments

Comments
 (0)