(t *testing.T)
| 4801 | } |
| 4802 | |
| 4803 | func TestManagerClearAndListTaskBlocks(t *testing.T) { |
| 4804 | t.Parallel() |
| 4805 | |
| 4806 | store := newInMemoryManagerStore() |
| 4807 | manager := newTaskManagerForTest(t, store) |
| 4808 | actor := validActorContext() |
| 4809 | target, err := manager.CreateTask(context.Background(), CreateTask{ |
| 4810 | Scope: ScopeWorkspace, |
| 4811 | WorkspaceID: "ws-block-list-target", |
| 4812 | Title: "Block list target", |
| 4813 | }, actor) |
| 4814 | if err != nil { |
| 4815 | t.Fatalf("CreateTask(target) error = %v", err) |
| 4816 | } |
| 4817 | other, err := manager.CreateTask(context.Background(), CreateTask{ |
| 4818 | Scope: ScopeWorkspace, |
| 4819 | WorkspaceID: "ws-block-list-other", |
| 4820 | Title: "Other workspace task", |
| 4821 | }, actor) |
| 4822 | if err != nil { |
| 4823 | t.Fatalf("CreateTask(other) error = %v", err) |
| 4824 | } |
| 4825 | |
| 4826 | openBlock, err := manager.BlockTask(context.Background(), BlockRequest{ |
| 4827 | TaskID: target.ID, |
| 4828 | Kind: BlockKindNeedsInput, |
| 4829 | Reason: "creator input required", |
| 4830 | }, actor) |
| 4831 | if err != nil { |
| 4832 | t.Fatalf("BlockTask(open) error = %v", err) |
| 4833 | } |
| 4834 | clearable, err := manager.BlockTask(context.Background(), BlockRequest{ |
| 4835 | TaskID: target.ID, |
| 4836 | Kind: BlockKindCapability, |
| 4837 | Reason: "missing connector", |
| 4838 | }, actor) |
| 4839 | if err != nil { |
| 4840 | t.Fatalf("BlockTask(clearable) error = %v", err) |
| 4841 | } |
| 4842 | if _, err := manager.BlockTask(context.Background(), BlockRequest{ |
| 4843 | TaskID: other.ID, |
| 4844 | Kind: BlockKindNeedsInput, |
| 4845 | Reason: "other workspace block", |
| 4846 | }, actor); err != nil { |
| 4847 | t.Fatalf("BlockTask(other) error = %v", err) |
| 4848 | } |
| 4849 | |
| 4850 | cleared, err := manager.ClearTaskBlock( |
| 4851 | context.Background(), |
| 4852 | target.ID, |
| 4853 | clearable.ID, |
| 4854 | "connector restored", |
| 4855 | actor, |
| 4856 | ) |
| 4857 | if err != nil { |
| 4858 | t.Fatalf("ClearTaskBlock() error = %v", err) |
| 4859 | } |
| 4860 | if cleared.ClearedAt.IsZero() { |
nothing calls this directly
no test coverage detected