diff options
| author | Claudomator Agent <agent@claudomator> | 2026-03-14 07:03:55 +0000 |
|---|---|---|
| committer | Claudomator Agent <agent@claudomator> | 2026-03-14 07:03:55 +0000 |
| commit | e5864d941e31a0e4ce59e31bee13e9c7c43909f4 (patch) | |
| tree | 96f73ec7a6345177b82f233ba5b6afb4e7e4e0c7 /internal/executor | |
| parent | 2ee988ccc04c09ceb6de7cdb75c94114e85d01b9 (diff) | |
test
Diffstat (limited to 'internal/executor')
| -rw-r--r-- | internal/executor/executor_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/internal/executor/executor_test.go b/internal/executor/executor_test.go index 17982f8..f6d0179 100644 --- a/internal/executor/executor_test.go +++ b/internal/executor/executor_test.go @@ -964,6 +964,7 @@ func (m *minimalMockStore) UpdateTaskSummary(taskID, summary string) error func (m *minimalMockStore) AppendTaskInteraction(taskID string, _ task.Interaction) error { return nil } +func (m *minimalMockStore) UpdateTaskAgent(id string, agent task.AgentConfig) error { return nil } func (m *minimalMockStore) lastStateUpdate() (string, task.State, bool) { m.mu.Lock() @@ -1159,3 +1160,34 @@ func TestPool_SpecificAgent_SkipsLoadBalancing(t *testing.T) { t.Errorf("expected claude runner to NOT be called, got %d", claudeRunner.callCount()) } } + +// TestPool_SpecificAgent_PersistsToDB verifies that if a specific agent +// is requested, it is persisted to the database before the task runs. +func TestPool_SpecificAgent_PersistsToDB(t *testing.T) { + store := testStore(t) + geminiRunner := &mockRunner{} + runners := map[string]Runner{ + "gemini": geminiRunner, + } + logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelError})) + pool := NewPool(4, runners, store, logger) + + tk := makeTask("persist-gemini") + tk.Agent.Type = "gemini" + store.CreateTask(tk) + + if err := pool.Submit(context.Background(), tk); err != nil { + t.Fatalf("submit: %v", err) + } + + <-pool.Results() + + // Check the task in the database. + reloaded, err := store.GetTask(tk.ID) + if err != nil { + t.Fatalf("get task: %v", err) + } + if reloaded.Agent.Type != "gemini" { + t.Errorf("expected agent type gemini in DB, got %q", reloaded.Agent.Type) + } +} |
