( _ context.Context, mutation BlockTaskAndReleaseRunMutation, )
| 905 | } |
| 906 | |
| 907 | func (s *inMemoryManagerStore) BlockTaskAndReleaseRun( |
| 908 | _ context.Context, |
| 909 | mutation BlockTaskAndReleaseRunMutation, |
| 910 | ) (BlockTaskAndReleaseRunResult, error) { |
| 911 | run, err := s.requireCurrentTestLease(mutation.RunID, mutation.ClaimToken, mutation.Now) |
| 912 | if err != nil { |
| 913 | return BlockTaskAndReleaseRunResult{}, err |
| 914 | } |
| 915 | if strings.TrimSpace(run.TaskID) != strings.TrimSpace(mutation.Block.TaskID) { |
| 916 | return BlockTaskAndReleaseRunResult{}, ErrInvalidStatusTransition |
| 917 | } |
| 918 | blockResult, err := s.createTaskBlockForTest(mutation.Block, mutation.RecurrenceLimit) |
| 919 | if err != nil { |
| 920 | return BlockTaskAndReleaseRunResult{}, err |
| 921 | } |
| 922 | |
| 923 | updated := requeuedTestRun(run) |
| 924 | s.runs[updated.ID] = cloneTaskRun(updated) |
| 925 | taskRecord := s.tasks[updated.TaskID] |
| 926 | if strings.TrimSpace(taskRecord.CurrentRunID) == updated.ID { |
| 927 | taskRecord.CurrentRunID = "" |
| 928 | s.tasks[taskRecord.ID] = cloneTask(taskRecord) |
| 929 | } |
| 930 | return BlockTaskAndReleaseRunResult{ |
| 931 | Block: cloneTaskBlock(blockResult.Block), |
| 932 | Run: cloneTaskRun(updated), |
| 933 | Recurrence: blockResult.Recurrence, |
| 934 | EscalatedTask: blockResult.EscalatedTask, |
| 935 | ReleaseReason: "blocked", |
| 936 | PreviousRun: cloneTaskRun(run), |
| 937 | ClaimTokenHash: run.ClaimTokenHash, |
| 938 | }, nil |
| 939 | } |
| 940 | |
| 941 | func blockRecurrenceTestKey(taskID string, kind BlockKind) string { |
| 942 | return strings.TrimSpace(taskID) + "\x00" + string(kind.Normalize()) |
nothing calls this directly
no test coverage detected