(t *testing.T)
| 480 | } |
| 481 | |
| 482 | func TestListTasksKindAll(t *testing.T) { |
| 483 | setupFlowRoot(t) |
| 484 | db := openFlowDB(t) |
| 485 | wd := t.TempDir() |
| 486 | if err := flowdb.UpsertPlaybook(db, &flowdb.Playbook{Slug: "pb", Name: "PB", WorkDir: wd}); err != nil { |
| 487 | t.Fatal(err) |
| 488 | } |
| 489 | insertTask(t, db, "regular-1", "Regular 1", "in-progress", "high", wd, nil) |
| 490 | now := flowdb.NowISO() |
| 491 | if _, err := db.Exec( |
| 492 | `INSERT INTO tasks (slug, name, status, kind, playbook_slug, priority, work_dir, session_id, created_at, updated_at) |
| 493 | VALUES ('pb--run', 'r', 'in-progress', 'playbook_run', 'pb', 'medium', ?, ?, ?, ?)`, |
| 494 | wd, fakeSessionID("pb--run"), now, now, |
| 495 | ); err != nil { |
| 496 | t.Fatal(err) |
| 497 | } |
| 498 | out := captureShowStdout(t, func() { |
| 499 | if rc := cmdList([]string{"tasks", "--kind", "all"}); rc != 0 { |
| 500 | t.Fatal() |
| 501 | } |
| 502 | }) |
| 503 | if !strings.Contains(out, "regular-1") || !strings.Contains(out, "pb--run") { |
| 504 | t.Errorf("--kind all should show both:\n%s", out) |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | func TestCmdListRuns(t *testing.T) { |
| 509 | setupFlowRoot(t) |
nothing calls this directly
no test coverage detected