From ca3bb5c891b44b0bde892b773892e61de392897c Mon Sep 17 00:00:00 2001 From: Olivier Thomann Date: Mon, 2 Mar 2020 14:19:19 -0500 Subject: [PATCH] Fix test failures --- pkg/reconciler/pipelinerun/pipelinerun_test.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/reconciler/pipelinerun/pipelinerun_test.go b/pkg/reconciler/pipelinerun/pipelinerun_test.go index c89ea65b49e..9be141a5458 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun_test.go +++ b/pkg/reconciler/pipelinerun/pipelinerun_test.go @@ -1709,7 +1709,7 @@ func TestReconcileWithTaskResults(t *testing.T) { ), tb.TaskRunLabel("tekton.dev/pipeline", "test-pipeline"), tb.TaskRunLabel("tekton.dev/pipelineRun", "test-pipeline-run-different-service-accs"), - tb.TaskRunLabel("tekton.dev/pipelineTask", "bTask"), + tb.TaskRunLabel("tekton.dev/pipelineTask", "aTask"), tb.TaskRunSpec( tb.TaskRunTaskRef("hello-world"), tb.TaskRunServiceAccountName("test-sa"), @@ -1760,11 +1760,19 @@ func TestReconcileWithTaskResults(t *testing.T) { ), ) // Check that the expected TaskRun was created - actual, err := clients.Pipeline.TektonV1alpha1().TaskRuns("foo").Get(expectedTaskRunName, metav1.GetOptions{}) + actual, err := clients.Pipeline.TektonV1alpha1().TaskRuns("foo").List(metav1.ListOptions{ + LabelSelector: "tekton.dev/pipelineTask=bTask,tekton.dev/pipelineRun=test-pipeline-run-different-service-accs", + Limit: 1, + }) + if err != nil { - t.Fatalf("Expected a TaskRun to be created, but it wasn't: %s", err) + t.Fatalf("Failure to list TaskRun's %s", err) } - if d := cmp.Diff(actual, expectedTaskRun); d != "" { + if len(actual.Items) != 1 { + t.Fatalf("Expected 1 TaskRuns got %d", len(actual.Items)) + } + actualTaskRun := actual.Items[0] + if d := cmp.Diff(&actualTaskRun, expectedTaskRun); d != "" { t.Errorf("expected to see TaskRun %v created. Diff %s", expectedTaskRunName, d) } }