MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestAutoExecFinalizesDead

Function TestAutoExecFinalizesDead

internal/app/auto_test.go:236–259  ·  view source on GitHub ↗

TestAutoExecFinalizesDead: a runner error (or a session that never marks itself done) finalizes as 'dead'.

(t *testing.T)

Source from the content-addressed store, hash-verified

234// TestAutoExecFinalizesDead: a runner error (or a session that never marks
235// itself done) finalizes as 'dead'.
236func TestAutoExecFinalizesDead(t *testing.T) {
237 setupFlowRoot(t)
238 seedTask(t, "auto-task")
239 seedRunningAuto(t, "auto-task", 4242)
240
241 stubAutoRunner(t, func(h harness.Harness, sessionID, prompt string, opts harness.LaunchOpts) error {
242 return errors.New("harness exploded")
243 })
244
245 if rc := cmdAutoExec([]string{"auto-task"}); rc != 1 {
246 t.Fatalf("cmdAutoExec rc=%d, want 1 on runner error", rc)
247 }
248 db := openFlowDB(t)
249 task, err := flowdb.GetTask(db, "auto-task")
250 if err != nil {
251 t.Fatal(err)
252 }
253 if task.AutoRunStatus.String != "dead" {
254 t.Errorf("auto_run_status = %q, want dead", task.AutoRunStatus.String)
255 }
256 if !task.AutoRunFinished.Valid {
257 t.Error("auto_run_finished should be set even for dead runs")
258 }
259}
260
261// TestReconcileAutoRunDeadPid: a 'running' row whose supervisor pid is no
262// longer alive is reconciled to 'dead' on read.

Callers

nothing calls this directly

Calls 8

GetTaskFunction · 0.92
setupFlowRootFunction · 0.85
seedTaskFunction · 0.85
seedRunningAutoFunction · 0.85
stubAutoRunnerFunction · 0.85
cmdAutoExecFunction · 0.85
openFlowDBFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected