Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/daemon/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ func TestPoolDrainKillsStraggler(t *testing.T) {
_, _ = pool.Run(context.Background(), WorkerSpec{Session: "a"}, &collectSink{})
close(runDone)
}()
waitFor(t, func() bool { return pool.QueueDepth() == 1 })
// Drain reads p.active (exposed as WorkerStats), not QueueDepth/slot occupancy.
// QueueDepth can become 1 before track(), so Drain would take the n==0 early return.
waitFor(t, func() bool { return len(pool.WorkerStats()) == 1 })

pool.Drain() // KillTimeout elapses, straggler is force-killed
if atomic.LoadInt32(&straggler.killed) != 1 {
Expand Down