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

Function TestCmdRunPlaybookAutoForwards

internal/app/run_test.go:149–185  ·  view source on GitHub ↗

TestCmdRunPlaybookAutoForwards: `flow run playbook --auto` creates the run task and launches it headlessly via the detached supervisor — no terminal tab.

(t *testing.T)

Source from the content-addressed store, hash-verified

147// creates the run task and launches it headlessly via the detached
148// supervisor — no terminal tab.
149func TestCmdRunPlaybookAutoForwards(t *testing.T) {
150 setupFlowRoot(t)
151 wd := t.TempDir()
152 if rc := cmdAdd([]string{"playbook", "Triage", "--slug", "tri", "--work-dir", wd}); rc != 0 {
153 t.Fatal()
154 }
155
156 itermCount, _ := stubITerm(t)
157 calls, gotSlug, _, _, _ := stubAutoLauncher(t, 7777)
158
159 if rc := cmdRun([]string{"playbook", "tri", "--auto"}); rc != 0 {
160 t.Fatalf("run playbook --auto rc=%d, want 0", rc)
161 }
162 if *itermCount != 0 {
163 t.Errorf("iterm spawn count = %d, want 0 (--auto must not open a tab)", *itermCount)
164 }
165 if *calls != 1 {
166 t.Fatalf("autoLauncher calls = %d, want 1", *calls)
167 }
168 if !strings.HasPrefix(*gotSlug, "tri--") {
169 t.Errorf("launcher slug = %q, want a tri-- run slug", *gotSlug)
170 }
171
172 db := openFlowDB(t)
173 var status, autoStatus string
174 if err := db.QueryRow(
175 `SELECT status, auto_run_status FROM tasks WHERE slug=?`, *gotSlug,
176 ).Scan(&status, &autoStatus); err != nil {
177 t.Fatal(err)
178 }
179 if status != "in-progress" {
180 t.Errorf("run status = %q, want in-progress", status)
181 }
182 if autoStatus != "running" {
183 t.Errorf("auto_run_status = %q, want running", autoStatus)
184 }
185}
186
187func TestCmdRunPlaybookSnapshotIsolation(t *testing.T) {
188 root := setupFlowRoot(t)

Callers

nothing calls this directly

Calls 6

setupFlowRootFunction · 0.85
cmdAddFunction · 0.85
stubITermFunction · 0.85
stubAutoLauncherFunction · 0.85
cmdRunFunction · 0.85
openFlowDBFunction · 0.85

Tested by

no test coverage detected