TestCmdShowTaskAutoRunStatus: `flow show task` surfaces the autonomous run status for a task that was launched with --auto.
(t *testing.T)
| 114 | // TestCmdShowTaskAutoRunStatus: `flow show task` surfaces the autonomous |
| 115 | // run status for a task that was launched with --auto. |
| 116 | func TestCmdShowTaskAutoRunStatus(t *testing.T) { |
| 117 | root, db := showListEditDB(t) |
| 118 | insertTask(t, db, "auto-task", "Auto", "in-progress", "high", filepath.Join(root, "repo"), nil) |
| 119 | now := flowdb.NowISO() |
| 120 | if _, err := db.Exec( |
| 121 | `UPDATE tasks SET auto_run_status='running', auto_run_pid=4242, auto_run_started=?, auto_run_log='/x/run.log' WHERE slug='auto-task'`, |
| 122 | now, |
| 123 | ); err != nil { |
| 124 | t.Fatal(err) |
| 125 | } |
| 126 | |
| 127 | // Keep the pid "alive" so reconcile doesn't flip it to dead. |
| 128 | oldAlive := processAlive |
| 129 | processAlive = func(pid int) bool { return true } |
| 130 | t.Cleanup(func() { processAlive = oldAlive }) |
| 131 | |
| 132 | out := captureStdout(t, func() { |
| 133 | if rc := cmdShow([]string{"task", "auto-task"}); rc != 0 { |
| 134 | t.Errorf("rc=%d", rc) |
| 135 | } |
| 136 | }) |
| 137 | if !strings.Contains(out, "auto_run:") { |
| 138 | t.Errorf("missing auto_run line; out=%q", out) |
| 139 | } |
| 140 | if !strings.Contains(out, "running") { |
| 141 | t.Errorf("auto_run line should show running; out=%q", out) |
| 142 | } |
| 143 | if !strings.Contains(out, "4242") { |
| 144 | t.Errorf("auto_run line should show pid; out=%q", out) |
| 145 | } |
| 146 | if !strings.Contains(out, "/x/run.log") { |
| 147 | t.Errorf("auto_run log path should show; out=%q", out) |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | func TestCmdShowTaskFloating(t *testing.T) { |
| 152 | root, db := showListEditDB(t) |
nothing calls this directly
no test coverage detected