Commit 6327c67
Add tests and docs for per-connection memory budgets (8.3.6) (#489)
* test(memory-budgets): add comprehensive tests for per-connection memory budgets
Add new async unit tests for apply_memory_pressure covering Abort, Pause, and Continue actions.
Introduce two new BDD suites: budget_cleanup and budget_transitions, with six scenarios validating cleanup semantics, budget reclamation, soft-limit pacing escalation, recovery after assembly completion, and tightest dimension enforcement.
Create fixtures, steps, and scenario bindings to support the new BDD tests.
Update docs/roadmap.md to mark 8.3.6 as done and add implementation decisions to ADR 0002.
This change significantly improves test coverage for the three-tier per-connection memory budget protection system, enabling better verification of budget enforcement, back-pressure, cleanup, and pressure-level transitions without modifying production code.
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
* test(budget): harden connection abort assertions for budget-related errors
Refined the `assert_connection_aborted` method in both `budget_transitions.rs` and `memory_budget_hard_cap.rs` tests to specifically verify that the error kind is `InvalidData`, which is the expected error kind produced by budget enforcement, instead of accepting any server error. Updated documentation accordingly to reflect this stricter error validation.
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
* refactor(tests): simplify error handling and adjust payload checks in budget tests
Refactor budget transition and memory budget hard cap tests:
- Simplified the handling of send_result by flattening nested matches into combinators
- Updated assert_connection_aborted to drain payloads after server task finishes to catch payloads during teardown
- Documented that send errors in send_first_frames_for_range are intentionally ignored due to expected abort behavior
These changes improve code clarity and correctness in test fixtures.
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
* refactor(tests/fixtures): refactor MemoryBudgetHardCapWorld server join handling
- Added SERVER_JOIN_TIMEOUT constant for server join timeout
- Extracted join_server() method to unify server task joining and error handling
- Replaced inline server join handling in assert_connection_aborted with join_server()
- Introduced helper parse function for cleaner HardCapConfig parsing
- Moved with_runtime() impl block for better code organization
- Removed redundant error handling branch for join errors
This improves test reliability by timing out server joins and simplifies error handling.
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
---------
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>1 parent e5f08b6 commit 6327c67
File tree
16 files changed
+1714
-76
lines changed- docs
- execplans
- src/app/frame_handling
- tests
- features
- fixtures
- scenarios
- steps
16 files changed
+1714
-76
lines changedLines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
376 | 398 | | |
377 | 399 | | |
378 | 400 | | |
| |||
Lines changed: 604 additions & 0 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
| 302 | + | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments