diff --git a/pkg/reconciler/pipelinerun/pipelinerun_test.go b/pkg/reconciler/pipelinerun/pipelinerun_test.go index c89ea65b49e..1cfdb4706cc 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun_test.go +++ b/pkg/reconciler/pipelinerun/pipelinerun_test.go @@ -1760,11 +1760,15 @@ 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{}) if err != nil { t.Fatalf("Expected a TaskRun to be created, but it wasn't: %s", err) } - if d := cmp.Diff(actual, expectedTaskRun); d != "" { - t.Errorf("expected to see TaskRun %v created. Diff %s", expectedTaskRunName, d) + for _, taskRun := range actual.Items { + if taskRun.Name == expectedTaskRunName { + if d := cmp.Diff(taskRun, *expectedTaskRun); d != "" { + t.Errorf("expected to see TaskRun %v created. (-want, +got) Diff %s", expectedTaskRunName, d) + } + } } }