Skip to content

Commit

Permalink
Fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
othomann committed Mar 2, 2020
1 parent 2a86059 commit ca3bb5c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkg/reconciler/pipelinerun/pipelinerun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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)
}
}

0 comments on commit ca3bb5c

Please sign in to comment.