summaryrefslogtreecommitdiff
path: root/internal/executor
diff options
context:
space:
mode:
Diffstat (limited to 'internal/executor')
-rw-r--r--internal/executor/executor_test.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/internal/executor/executor_test.go b/internal/executor/executor_test.go
index 878a32d..d8a2b77 100644
--- a/internal/executor/executor_test.go
+++ b/internal/executor/executor_test.go
@@ -751,9 +751,19 @@ func TestPool_ActivePerAgent_DeletesZeroEntries(t *testing.T) {
pool.Submit(context.Background(), tk)
<-pool.Results()
- pool.mu.Lock()
- _, exists := pool.activePerAgent["claude"]
- pool.mu.Unlock()
+ // The deferred cleanup in execute() runs after resultCh is sent, so poll
+ // briefly for the map entry to be removed rather than checking immediately.
+ var exists bool
+ deadline := time.Now().Add(100 * time.Millisecond)
+ for time.Now().Before(deadline) {
+ pool.mu.Lock()
+ _, exists = pool.activePerAgent["claude"]
+ pool.mu.Unlock()
+ if !exists {
+ break
+ }
+ time.Sleep(time.Millisecond)
+ }
if exists {
t.Error("activePerAgent should not have a zero-count entry for claude after task completes")