MCPcopy Create free account
hub / github.com/compozy/agh / TestManagerStartRunExecutionProfile

Function TestManagerStartRunExecutionProfile

internal/task/manager_test.go:8152–8224  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8150}
8151
8152func TestManagerStartRunExecutionProfile(t *testing.T) {
8153 t.Parallel()
8154
8155 t.Run(
8156 "Should pass the persisted execution profile to the session executor",
8157 func(t *testing.T) {
8158 t.Parallel()
8159
8160 store := newInMemoryManagerStore()
8161 executor := &recordingSessionExecutor{
8162 startRef: &SessionRef{SessionID: "sess-profiled-worker"},
8163 }
8164 manager := newTaskManagerForTestWithOptions(t, store, WithSessionExecutor(executor))
8165 actor := validActorContext()
8166
8167 taskRecord, err := manager.CreateTask(context.Background(), CreateTask{
8168 Scope: ScopeGlobal,
8169 Title: "Profiled start run",
8170 }, actor)
8171 if err != nil {
8172 t.Fatalf("CreateTask() error = %v", err)
8173 }
8174 _, err = manager.SetExecutionProfile(
8175 context.Background(),
8176 taskRecord.ID,
8177 &ExecutionProfile{
8178 Worker: WorkerProfile{
8179 Mode: WorkerModeSelect,
8180 AgentName: "builder",
8181 Provider: "codex",
8182 Model: "gpt-5.4",
8183 },
8184 },
8185 actor,
8186 )
8187 if err != nil {
8188 t.Fatalf("SetExecutionProfile() error = %v", err)
8189 }
8190 run, err := manager.EnqueueRun(
8191 context.Background(),
8192 EnqueueRun{TaskID: taskRecord.ID},
8193 actor,
8194 )
8195 if err != nil {
8196 t.Fatalf("EnqueueRun() error = %v", err)
8197 }
8198 run, err = manager.ClaimRun(context.Background(), run.ID, ClaimRun{}, actor)
8199 if err != nil {
8200 t.Fatalf("ClaimRun() error = %v", err)
8201 }
8202
8203 if _, err := manager.StartRun(context.Background(), run.ID, StartRun{}, actor); err != nil {
8204 t.Fatalf("StartRun() error = %v", err)
8205 }
8206 if got, want := len(executor.startCalls), 1; got != want {
8207 t.Fatalf("len(startCalls) = %d, want %d", got, want)
8208 }
8209 profile := executor.startCalls[0].ExecutionProfile

Callers

nothing calls this directly

Calls 10

newInMemoryManagerStoreFunction · 0.85
WithSessionExecutorFunction · 0.85
validActorContextFunction · 0.85
RunMethod · 0.65
CreateTaskMethod · 0.65
SetExecutionProfileMethod · 0.65
EnqueueRunMethod · 0.65
ClaimRunMethod · 0.65
StartRunMethod · 0.65

Tested by

no test coverage detected