(t *testing.T)
| 6485 | } |
| 6486 | |
| 6487 | func TestManagerCancelTaskPropagatesAcrossTree(t *testing.T) { |
| 6488 | t.Parallel() |
| 6489 | |
| 6490 | store := newInMemoryManagerStore() |
| 6491 | executor := &recordingSessionExecutor{} |
| 6492 | manager := newTaskManagerForTestWithOptions( |
| 6493 | t, |
| 6494 | store, |
| 6495 | WithSessionExecutor(executor), |
| 6496 | WithCancelGracePeriod(0), |
| 6497 | ) |
| 6498 | actor := validActorContext() |
| 6499 | |
| 6500 | parent, err := manager.CreateTask(context.Background(), CreateTask{ |
| 6501 | Scope: ScopeGlobal, |
| 6502 | Title: "Parent task", |
| 6503 | }, actor) |
| 6504 | if err != nil { |
| 6505 | t.Fatalf("CreateTask(parent) error = %v", err) |
| 6506 | } |
| 6507 | queuedChild, err := manager.CreateChildTask(context.Background(), parent.ID, CreateTask{ |
| 6508 | Scope: ScopeGlobal, |
| 6509 | Title: "Queued child", |
| 6510 | }, actor) |
| 6511 | if err != nil { |
| 6512 | t.Fatalf("CreateChildTask(queued child) error = %v", err) |
| 6513 | } |
| 6514 | activeChild, err := manager.CreateChildTask(context.Background(), parent.ID, CreateTask{ |
| 6515 | Scope: ScopeGlobal, |
| 6516 | Title: "Active child", |
| 6517 | }, actor) |
| 6518 | if err != nil { |
| 6519 | t.Fatalf("CreateChildTask(active child) error = %v", err) |
| 6520 | } |
| 6521 | |
| 6522 | queuedRun, err := manager.EnqueueRun( |
| 6523 | context.Background(), |
| 6524 | EnqueueRun{TaskID: queuedChild.ID}, |
| 6525 | actor, |
| 6526 | ) |
| 6527 | if err != nil { |
| 6528 | t.Fatalf("EnqueueRun(queued child) error = %v", err) |
| 6529 | } |
| 6530 | activeRun, err := manager.EnqueueRun( |
| 6531 | context.Background(), |
| 6532 | EnqueueRun{TaskID: activeChild.ID}, |
| 6533 | actor, |
| 6534 | ) |
| 6535 | if err != nil { |
| 6536 | t.Fatalf("EnqueueRun(active child) error = %v", err) |
| 6537 | } |
| 6538 | activeRun, err = manager.ClaimRun(context.Background(), activeRun.ID, ClaimRun{}, actor) |
| 6539 | if err != nil { |
| 6540 | t.Fatalf("ClaimRun(active child) error = %v", err) |
| 6541 | } |
| 6542 | activeRun, err = manager.StartRun(context.Background(), activeRun.ID, StartRun{}, actor) |
| 6543 | if err != nil { |
| 6544 | t.Fatalf("StartRun(active child) error = %v", err) |
nothing calls this directly
no test coverage detected