summaryrefslogtreecommitdiff
path: root/internal/executor/executor_test.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-09 03:59:51 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-09 03:59:51 +0000
commit0fc0c1e6ee0f106da7b91da7847c163936128051 (patch)
treeeb4c137070c0b3e8d8ffe956645a41cc89ab2a8e /internal/executor/executor_test.go
parentad00e1865c19afd40c8d159dbb55668ed6b51b12 (diff)
style: gofmt executor.go, executor_test.go, task.go
Pre-existing gofmt debt on all three files (confirmed dirty before this session's nested-subtask-completion commit too, not a regression) -- cleaned up while already touching these files.
Diffstat (limited to 'internal/executor/executor_test.go')
-rw-r--r--internal/executor/executor_test.go32
1 files changed, 18 insertions, 14 deletions
diff --git a/internal/executor/executor_test.go b/internal/executor/executor_test.go
index d89a9eb..e2b9b44 100644
--- a/internal/executor/executor_test.go
+++ b/internal/executor/executor_test.go
@@ -109,7 +109,7 @@ func makeTask(id string) *task.Task {
now := time.Now().UTC()
return &task.Task{
ID: id, Name: "Test " + id,
- Agent: task.AgentConfig{Type: "claude", Instructions: "test"},
+ Agent: task.AgentConfig{Type: "claude", Instructions: "test"},
Priority: task.PriorityNormal,
Retry: task.RetryConfig{MaxAttempts: 1, Backoff: "linear"},
Tags: []string{},
@@ -1206,10 +1206,13 @@ func TestPool_Submit_ParentNotBlocked_NoTransition(t *testing.T) {
// minimalMockStore is a standalone Store implementation for unit-testing Pool
// methods that do not require a real SQLite database.
type minimalMockStore struct {
- mu sync.Mutex
- tasks map[string]*task.Task
- executions map[string]*storage.Execution
- stateUpdates []struct{ id string; state task.State }
+ mu sync.Mutex
+ tasks map[string]*task.Task
+ executions map[string]*storage.Execution
+ stateUpdates []struct {
+ id string
+ state task.State
+ }
questionUpdates []string
summaryUpdates []struct{ taskID, summary string }
changestatCalls []struct {
@@ -1245,7 +1248,7 @@ func (m *minimalMockStore) ListSubtasks(parentID string) ([]*task.Task, error) {
return nil, nil
}
func (m *minimalMockStore) ListExecutions(_ string) ([]*storage.Execution, error) { return nil, nil }
-func (m *minimalMockStore) CreateExecution(e *storage.Execution) error { return nil }
+func (m *minimalMockStore) CreateExecution(e *storage.Execution) error { return nil }
func (m *minimalMockStore) CreateExecutionAndSetRunning(e *storage.Execution) error {
return nil
}
@@ -1257,7 +1260,10 @@ func (m *minimalMockStore) UpdateTaskState(id string, newState task.State) error
return m.updateStateErr
}
m.mu.Lock()
- m.stateUpdates = append(m.stateUpdates, struct{ id string; state task.State }{id, newState})
+ m.stateUpdates = append(m.stateUpdates, struct {
+ id string
+ state task.State
+ }{id, newState})
if t, ok := m.tasks[id]; ok {
t.State = newState
}
@@ -1298,10 +1304,10 @@ func (m *minimalMockStore) UpdateExecutionChangestats(execID string, stats *task
m.mu.Unlock()
return nil
}
-func (m *minimalMockStore) RecordAgentEvent(_ storage.AgentEvent) error { return nil }
-func (m *minimalMockStore) GetProject(_ string) (*task.Project, error) { return nil, nil }
-func (m *minimalMockStore) CreateTask(_ *task.Task) error { return nil }
-func (m *minimalMockStore) CreateEvent(_ *event.Event) error { return nil }
+func (m *minimalMockStore) RecordAgentEvent(_ storage.AgentEvent) error { return nil }
+func (m *minimalMockStore) GetProject(_ string) (*task.Project, error) { return nil, nil }
+func (m *minimalMockStore) CreateTask(_ *task.Task) error { return nil }
+func (m *minimalMockStore) CreateEvent(_ *event.Event) error { return nil }
func (m *minimalMockStore) GetActiveRoleConfig(_ string) (*storage.RoleConfigRow, error) {
return nil, sql.ErrNoRows
}
@@ -1709,7 +1715,7 @@ func TestPool_MaxPerAgent_BlocksSecondTask(t *testing.T) {
runners := map[string]Runner{"claude": runner}
logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelError}))
pool := NewPool(2, runners, store, logger) // pool size 2, but maxPerAgent=1
- pool.requeueDelay = 50 * time.Millisecond // speed up test
+ pool.requeueDelay = 50 * time.Millisecond // speed up test
tk1 := makeTask("mpa-1")
tk2 := makeTask("mpa-2")
@@ -1838,7 +1844,6 @@ func TestPool_ConsecutiveFailures_ResetOnSuccess(t *testing.T) {
}
}
-
// TestPool_DependsOn_NoDeadlock verifies that a task waiting for a dependency
// does NOT hold the per-agent slot, allowing the dependency to run first.
func TestPool_DependsOn_NoDeadlock(t *testing.T) {
@@ -1975,4 +1980,3 @@ func TestPool_Shutdown_TimesOut(t *testing.T) {
}
close(unblock) // cleanup
}
-