listTaskRunAndTaskUIDs returns every task_run UID and the set of task UIDs underneath a plan's rollout. Both come from parsing task_run names (projects/X/plans/Y/rollout/stages/Z/tasks/{taskUID}/taskRuns/{taskRunUID}), so one ListTaskRuns call covers both composite-PK tables without needing a separa
(ctx context.Context, t *testing.T, ctl *controller, planName string)
| 435 | // so one ListTaskRuns call covers both composite-PK tables without needing |
| 436 | // a separate ListTasks gRPC (which doesn't exist). |
| 437 | func listTaskRunAndTaskUIDs(ctx context.Context, t *testing.T, ctl *controller, planName string) (taskRunUIDs, taskUIDs []int64) { |
| 438 | t.Helper() |
| 439 | a := require.New(t) |
| 440 | resp, err := ctl.rolloutServiceClient.ListTaskRuns(ctx, connect.NewRequest(&v1pb.ListTaskRunsRequest{ |
| 441 | Parent: planName + "/rollout/stages/-/tasks/-", |
| 442 | })) |
| 443 | a.NoError(err, "ListTaskRuns(%s)", planName) |
| 444 | seenTasks := make(map[int64]bool) |
| 445 | for _, tr := range resp.Msg.TaskRuns { |
| 446 | _, _, _, taskUID, trUID, err := common.GetProjectIDPlanIDStageIDTaskIDTaskRunID(tr.Name) |
| 447 | a.NoError(err, "parse task_run name %q", tr.Name) |
| 448 | taskRunUIDs = append(taskRunUIDs, trUID) |
| 449 | if !seenTasks[taskUID] { |
| 450 | seenTasks[taskUID] = true |
| 451 | taskUIDs = append(taskUIDs, taskUID) |
| 452 | } |
| 453 | } |
| 454 | return taskRunUIDs, taskUIDs |
| 455 | } |
| 456 | |
| 457 | // createSQLiteInstance provisions and registers a SQLite instance for test use. |
| 458 | func createSQLiteInstance(ctx context.Context, t *testing.T, ctl *controller, titlePrefix string) *v1pb.Instance { |
no test coverage detected