Commit 1154485
authored
test: stabilize flaky Rust tests (#724)
#### Overview
Stabilize two Rust tests that could fail under parallel CI load: the interactive terminal job-control regression and Switchyard accounting-event assertions.
- [x] I confirm this contribution is my own work, or I have the right to submit it under this project license.
- [x] I searched existing issues and open pull requests, and this does not duplicate existing work.
#### Details
The PTY driver previously matched `AGENT_DELAY_ARMED` before Python had necessarily written the trailing newline. Under load, it could suspend the agent between those writes and then time out waiting for the SIGCONT marker. Consume the remainder of the acknowledgment line before injecting the terminal suspend character.
Switchyard's managed-call test helpers previously registered process-global subscribers. Parallel tests could therefore contribute unrelated optimization events and make exact accounting assertions fail. Register those captures against the current task-local scope so each test observes only its own events.
Validation:
- 20 consecutive focused CLI test runs
- 20 consecutive Switchyard library test runs (720 tests total)
- `cargo fmt --all --check`
- `cargo clippy --workspace --all-targets -- -D warnings`
- `just test-rust`
- `uv run pre-commit run --all-files`
#### Where should the reviewer start?
Start with the scope-local subscriber change in `crates/switchyard/tests/unit/component_tests.rs`, then review the PTY synchronization change in `crates/cli/tests/cli_tests.rs`.
#### Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
- Relates to: none
## Summary by CodeRabbit
* **Bug Fixes**
* Improved terminal command handling reliability, including more consistent processing of command output.
* Improved isolation of accounting event handling to prevent cross-context interference during operations.
* **Tests**
* Strengthened coverage for terminal job control and accounting event processing to help ensure consistent behavior.
Authors:
- Will Killian (https://github.com/willkill07)
Approvers:
- Eric Evans II (https://github.com/ericevans-nv)
URL: #7241 parent 2b2d4d8 commit 1154485
2 files changed
Lines changed: 14 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4170 | 4170 | | |
4171 | 4171 | | |
4172 | 4172 | | |
| 4173 | + | |
4173 | 4174 | | |
4174 | 4175 | | |
4175 | 4176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
1234 | 1238 | | |
1235 | 1239 | | |
1236 | 1240 | | |
1237 | | - | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
1238 | 1244 | | |
1239 | 1245 | | |
1240 | 1246 | | |
| |||
1259 | 1265 | | |
1260 | 1266 | | |
1261 | 1267 | | |
1262 | | - | |
| 1268 | + | |
1263 | 1269 | | |
1264 | 1270 | | |
1265 | 1271 | | |
| |||
1270 | 1276 | | |
1271 | 1277 | | |
1272 | 1278 | | |
1273 | | - | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
1274 | 1282 | | |
1275 | 1283 | | |
1276 | 1284 | | |
| |||
1299 | 1307 | | |
1300 | 1308 | | |
1301 | 1309 | | |
1302 | | - | |
| 1310 | + | |
1303 | 1311 | | |
1304 | 1312 | | |
1305 | 1313 | | |
| |||
0 commit comments