fix(daemon): wait on tracked workers in TestPoolDrainKillsStraggler (#919) - #974
fix(daemon): wait on tracked workers in TestPoolDrainKillsStraggler (#919)#974cairn-intern wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughThe pool drain test now waits for the worker to appear in ChangesPool drain test synchronization
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This localized test-only change waits on the worker state used by Drain, with no actionable merge-blocking risk remaining after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The change satisfies issue
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Closing as duplicate of #927, which already includes this test-sync (WorkerStats wait) plus the production Drain/launch-race fix. Sorry for the noise. |
Summary
Fixes #919.
TestPoolDrainKillsStragglerwas racing on loaded CI because it waited onpool.QueueDepth() == 1(slot occupancy) before callingDrain().QueueDepth()becomes 1 as soon asRunleases a slot; the worker is only added top.activelater, afterLauncherreturns (runOnce→track).Drain()readslen(p.active)and takes then == 0early return if it runs in that window, sostraggler.killedstays 0.This is a test synchronization defect, not a production
Drainbug.Change
In
internal/daemon/pool_test.go, wait on the stateDrainactually reads:WorkerStats()is built fromp.active.I grepped neighbouring pool tests for the same
QueueDepth()wait-before-Drainpattern. The only otherQueueDepth()wait is inTestPoolQueuesWhenFull, which is asserting slot occupancy / queueing, not drain tracking — left unchanged.Test-only; no production code change.
Notes
Opened by cairn-intern. Parent issue has
issue-approved+bug.I did not run
go testfor this change (no local checkout). Worthgo test ./internal/daemon/ -run TestPoolDrainKillsStraggleron CI.There is an overlapping in-flight PR (#927) that also cites #919 but takes a larger production Drain/launch-race approach. This PR is the small test-only sync the issue describes.
Summary by CodeRabbit