test(events): synchronize saturated pool cancellation - #6852
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The updated test can leak/hang under synctest if a require.* assertion fails before unblocking worker goroutines; it should close the release channel via t.Cleanup (with sync.Once) to ensure cleanup on early exits.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the server/events test suite to make the “saturated worker pool cancellation” scenario deterministic by synchronizing goroutine progress using worker events and testing/synctest, rather than relying on scheduler timing.
Changes:
- Reworks
TestRunProjectCmdsParallel_CancelledWhileExceedingPoolSizeto block the first two workers explicitly and trigger cancellation while the submitter is blocked inwg.Add(). - Uses
synctest.Wait()to ensure the test reaches the intended blocked state before cancelling and unblocking.
File summaries
| File | Description |
|---|---|
server/events/project_command_pool_executor_test.go |
Makes the saturated-pool cancellation test deterministic using synctest and worker synchronization channels. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Go Go / code-coverage/goThe overall line coverage in commit c3d7b48 in the Show a line coverage summary of the most covered files.
Updated |
769bb12 to
575581b
Compare
Block active workers and wait for the submission loop to exhaust the pool before cancelling. Verify which projects finish and which are cancelled without wall-clock scheduling assumptions. Assisted-by: OpenAI Signed-off-by: Rui Chen <rui@chenrui.dev>
575581b to
c3d7b48
Compare
What
Synchronize the saturated-pool cancellation test using worker events and synctest.
Why
The test must cancel while workers occupy the pool, without relying on scheduler timing.
Testing
100 race-enabled repetitions and the full events package, including -race, pass.