From 69b5b9b82f44ed33bec2ed4148203113bdb45c28 Mon Sep 17 00:00:00 2001 From: Varun Singhai Date: Thu, 11 Aug 2022 13:30:05 -0400 Subject: [PATCH] Reformat CustomTask within Test Prior to this commit, the previous iteration of this test had `task-b` as a "custom task" but was of type `Task`. In this commit, we changed `task-b` to be of type `Run`, with its kind being `Example`. This allows `task-b` to be a true `Custom Task` as intended. /cc @jerop /kind feature --- .../pipelinerun/pipelinerun_test.go | 89 +++++++++---------- 1 file changed, 43 insertions(+), 46 deletions(-) diff --git a/pkg/reconciler/pipelinerun/pipelinerun_test.go b/pkg/reconciler/pipelinerun/pipelinerun_test.go index 2e7f9905313..a2e78942f79 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun_test.go +++ b/pkg/reconciler/pipelinerun/pipelinerun_test.go @@ -4806,6 +4806,8 @@ spec: name: a-task - name: b-task taskRef: + apiVersion: example.dev/v0 + kind: Example name: b-task `)} trs := []*v1beta1.TaskRun{mustParseTaskRunWithObjectMeta(t, @@ -4823,8 +4825,8 @@ status: - name: a-Result value: aResultValue `), mustParseTaskRunWithObjectMeta(t, - taskRunObjectMeta("test-pipeline-run-finally-results-task-run-b", "foo", - "test-pipeline-run-finally-results", "test-pipeline", "b-task", true), + taskRunObjectMeta("test-pipeline-run-finally-results-task-run-c", "foo", + "test-pipeline-run-finally-results", "test-pipeline", "c-task", true), ` spec: taskRef: @@ -4833,20 +4835,22 @@ status: conditions: - status: "True" type: Succeeded - taskResults: - - name: b-Result - value: bResultValue -`), mustParseTaskRunWithObjectMeta(t, - taskRunObjectMeta("test-pipeline-run-finally-results-task-run-c", "foo", - "test-pipeline-run-finally-results", "test-pipeline", "c-task", true), +`)} + rs := []*v1alpha1.Run{mustParseRunWithObjectMeta(t, + taskRunObjectMeta("test-pipeline-run-finally-results-task-run-b", "foo", + "test-pipeline-run-finally-results", "test-pipeline", "b-task", true), ` spec: - taskRef: - name: hello-world + ref: + apiVersion: example.dev/v0 + kind: Example status: conditions: - status: "True" type: Succeeded + results: + - name: b-Result + value: bResultValue `)} prs := []*v1beta1.PipelineRun{parse.MustParsePipelineRun(t, ` metadata: @@ -4863,17 +4867,6 @@ status: `)} ts := []*v1beta1.Task{ parse.MustParseTask(t, ` -metadata: - name: b-task - namespace: foo -spec: - taskRef: - apiVersion: example.dev/v0 - kind: Example - results: - - name: b-Result -`), - parse.MustParseTask(t, ` metadata: name: a-task namespace: foo @@ -4900,7 +4893,8 @@ spec: Pipelines: ps, Tasks: ts, TaskRuns: trs, - ConfigMaps: []*corev1.ConfigMap{withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus)}, + Runs: rs, + ConfigMaps: []*corev1.ConfigMap{withCustomTasks(withEmbeddedStatus(newFeatureFlagsConfigMap(), embeddedStatus))}, } prt := newPipelineRunTest(d, t) defer prt.Cancel() @@ -4917,7 +4911,6 @@ spec: pipelineRef: name: test-pipeline status: - runs: {} pipelineSpec: results: - description: pipeline result @@ -4938,8 +4931,9 @@ status: kind: Task - name: b-task taskRef: - name: b-task - kind: Task + apiVersion: example.dev/v0 + kind: Example + name: b-task conditions: - status: "True" type: Succeeded @@ -4960,21 +4954,22 @@ status: taskResults: - name: a-Result value: aResultValue - test-pipeline-run-finally-results-task-run-b: - pipelineTaskName: b-task + test-pipeline-run-finally-results-task-run-c: + pipelineTaskName: c-task status: conditions: - status: "True" type: Succeeded - taskResults: - - name: b-Result - value: bResultValue - test-pipeline-run-finally-results-task-run-c: - pipelineTaskName: c-task + runs: + test-pipeline-run-finally-results-task-run-b: + pipelineTaskName: b-task status: conditions: - status: "True" type: Succeeded + results: + - name: b-Result + value: bResultValue `) expectedPrBothStatus := parse.MustParsePipelineRun(t, ` @@ -4988,7 +4983,6 @@ spec: pipelineRef: name: test-pipeline status: - runs: {} pipelineSpec: results: - description: pipeline result @@ -5010,7 +5004,8 @@ status: - name: b-task taskRef: name: b-task - kind: Task + apiVersion: example.dev/v0 + kind: Example conditions: - status: "True" type: Succeeded @@ -5030,8 +5025,8 @@ status: kind: TaskRun name: test-pipeline-run-finally-results-task-run-a pipelineTaskName: a-task - - apiVersion: tekton.dev/v1beta1 - kind: TaskRun + - apiVersion: tekton.dev/v1alpha1 + kind: Run name: test-pipeline-run-finally-results-task-run-b pipelineTaskName: b-task taskRuns: @@ -5044,21 +5039,22 @@ status: taskResults: - name: a-Result value: aResultValue - test-pipeline-run-finally-results-task-run-b: - pipelineTaskName: b-task + test-pipeline-run-finally-results-task-run-c: + pipelineTaskName: c-task status: conditions: - status: "True" type: Succeeded - taskResults: - - name: b-Result - value: bResultValue - test-pipeline-run-finally-results-task-run-c: - pipelineTaskName: c-task + runs: + test-pipeline-run-finally-results-task-run-b: + pipelineTaskName: b-task status: conditions: - status: "True" type: Succeeded + results: + - name: b-Result + value: bResultValue `) expectedPrMinimalStatus := parse.MustParsePipelineRun(t, ` @@ -5094,7 +5090,8 @@ status: - name: b-task taskRef: name: b-task - kind: Task + apiVersion: example.dev/v0 + kind: Example conditions: - status: "True" type: Succeeded @@ -5115,8 +5112,8 @@ status: kind: TaskRun name: test-pipeline-run-finally-results-task-run-a pipelineTaskName: a-task - - apiVersion: tekton.dev/v1beta1 - kind: TaskRun + - apiVersion: tekton.dev/v1alpha1 + kind: Run name: test-pipeline-run-finally-results-task-run-b pipelineTaskName: b-task `)