test(pm): cover install scheduler core#3052
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a unit test suite for the install_scheduler service, covering package download deduplication, state transitions following download and extraction, and clone operation deduplication. The reviewer suggested expanding the test coverage to include other critical state machine transitions, specifically for OpDone::SeededCache and OpDone::Clone completion, to ensure the scheduler's logic is fully verified and resilient to regressions.
| #[tokio::test] | ||
| async fn queue_clone_dedupes_inflight_target() { | ||
| let mut state = state(); | ||
| let target = PathBuf::from("/tmp/project/node_modules/react"); | ||
| let spec = clone_spec("react", "18.2.0", target.to_string_lossy().as_ref()); | ||
| let (first, _first_rx) = oneshot::channel(); | ||
| let (second, _second_rx) = oneshot::channel(); | ||
|
|
||
| state.queue_clone(spec.clone(), Some(first)); | ||
| state.queue_clone(spec, Some(second)); | ||
|
|
||
| assert_eq!(state.clone_waiters[&target].len(), 2); | ||
| assert_eq!(state.ops.len(), 1); | ||
| } |
There was a problem hiding this comment.
The current test suite provides good coverage for deduplication and basic wakeups, but it lacks verification for several other core state machine transitions. Specifically, transitions for OpDone::SeededCache (handling both cache hits and misses) and OpDone::Clone completion (verifying that clone_active is cleared and responders are notified) are critical paths in the scheduler. Adding tests for these transitions would ensure the core logic is fully covered and resilient to regressions.
717e4cd to
8891916
Compare
55a7594 to
c72a46b
Compare
8891916 to
4b77dd1
Compare
4b77dd1 to
d279722
Compare
📊 pm-bench-phases ·
|
| PM | wall | ±σ | user | sys | RSS | pgMinor |
|---|---|---|---|---|---|---|
| bun | 8.95s | 0.03s | 10.25s | 9.73s | 742M | 331.6K |
| utoo-next | 7.95s | 0.27s | 10.11s | 11.60s | 983M | 118.1K |
| utoo-npm | 7.99s | 0.16s | 10.33s | 11.96s | 996M | 126.4K |
| utoo | 7.79s | 0.03s | 10.16s | 11.71s | 1021M | 129.8K |
| PM | vCtx | iCtx | netRX | netTX | cache | node_mod | lock |
|---|---|---|---|---|---|---|---|
| bun | 15.6K | 18.1K | 1.19G | 6M | 1.86G | 1.75G | 1M |
| utoo-next | 113.5K | 83.0K | 1.16G | 5M | 1.71G | 1.70G | 2M |
| utoo-npm | 128.3K | 94.6K | 1.16G | 5M | 1.71G | 1.70G | 2M |
| utoo | 116.7K | 80.2K | 1.16G | 5M | 1.71G | 1.70G | 2M |
p1_resolve
| PM | wall | ±σ | user | sys | RSS | pgMinor |
|---|---|---|---|---|---|---|
| bun | 1.96s | 0.04s | 3.99s | 1.04s | 533M | 170.4K |
| utoo-next | 2.87s | 0.14s | 4.90s | 1.78s | 611M | 84.6K |
| utoo-npm | 2.98s | 0.06s | 5.10s | 2.13s | 609M | 84.5K |
| utoo | 2.81s | 0.07s | 4.96s | 1.81s | 607M | 90.0K |
| PM | vCtx | iCtx | netRX | netTX | cache | node_mod | lock |
|---|---|---|---|---|---|---|---|
| bun | 9.0K | 4.6K | 203M | 3M | 108M | - | 1M |
| utoo-next | 49.4K | 67.7K | 200M | 2M | 7M | 3M | 2M |
| utoo-npm | 74.3K | 86.8K | 200M | 2M | 7M | 3M | 2M |
| utoo | 48.5K | 67.7K | 200M | 2M | 7M | 3M | 2M |
p3_cold_install
| PM | wall | ±σ | user | sys | RSS | pgMinor |
|---|---|---|---|---|---|---|
| bun | 6.44s | 0.16s | 6.34s | 9.46s | 605M | 199.4K |
| utoo-next | 5.61s | 0.20s | 4.94s | 10.37s | 487M | 65.1K |
| utoo-npm | 7.91s | 1.75s | 5.24s | 10.79s | 496M | 56.8K |
| utoo | 6.58s | 1.98s | 5.13s | 10.40s | 531M | 64.2K |
| PM | vCtx | iCtx | netRX | netTX | cache | node_mod | lock |
|---|---|---|---|---|---|---|---|
| bun | 4.3K | 7.0K | 1019M | 4M | 1.76G | 1.76G | 1M |
| utoo-next | 103.2K | 50.7K | 989M | 3M | 1.70G | 1.70G | 2M |
| utoo-npm | 137.0K | 54.0K | 990M | 4M | 1.70G | 1.70G | 2M |
| utoo | 101.1K | 55.7K | 990M | 3M | 1.70G | 1.70G | 2M |
p4_warm_link
| PM | wall | ±σ | user | sys | RSS | pgMinor |
|---|---|---|---|---|---|---|
| bun | 3.30s | 0.06s | 0.18s | 2.40s | 134M | 32.8K |
| utoo-next | 2.23s | 0.12s | 0.45s | 3.68s | 78M | 18.3K |
| utoo-npm | 2.17s | 0.04s | 0.46s | 3.62s | 78M | 17.9K |
| utoo | 1.99s | 0.01s | 0.38s | 3.36s | 53M | 12.2K |
| PM | vCtx | iCtx | netRX | netTX | cache | node_mod | lock |
|---|---|---|---|---|---|---|---|
| bun | 210 | 28 | 5M | 13K | 1.91G | 1.75G | 1M |
| utoo-next | 40.7K | 18.2K | 5K | 23K | 1.70G | 1.70G | 2M |
| utoo-npm | 39.3K | 17.8K | 4K | 8K | 1.70G | 1.70G | 2M |
| utoo | 19.7K | 11.4K | 2K | 4K | 1.71G | 1.70G | 2M |
npmmirror.com: no output captured.
Summary
Verification