diff --git a/pkg/reconciler/taskrun/taskrun_test.go b/pkg/reconciler/taskrun/taskrun_test.go index f81f95a95c7..09b107e0886 100644 --- a/pkg/reconciler/taskrun/taskrun_test.go +++ b/pkg/reconciler/taskrun/taskrun_test.go @@ -1770,7 +1770,8 @@ func makePod(taskRun *v1beta1.TaskRun, task *v1beta1.Task) (*corev1.Pod, error) } func TestReconcilePodUpdateStatus(t *testing.T) { - taskRun := tb.TaskRun("test-taskrun-run-success", tb.TaskRunNamespace("foo"), tb.TaskRunSpec(tb.TaskRunTaskRef("test-task"))) + const taskLabel = "test-task" + taskRun := tb.TaskRun("test-taskrun-run-success", tb.TaskRunNamespace("foo"), tb.TaskRunSpec(tb.TaskRunTaskRef(taskLabel))) pod, err := makePod(taskRun, simpleTask) if err != nil { @@ -1808,6 +1809,14 @@ func TestReconcilePodUpdateStatus(t *testing.T) { t.Fatalf("Did not get expected condition %s", diff.PrintWantGot(d)) } + trLabel, ok := newTr.ObjectMeta.Labels[taskNameLabelKey] + if !ok { + t.Errorf("Labels were not added to task run") + } + if ld := cmp.Diff(taskLabel, trLabel); ld != "" { + t.Errorf("Did not get expected label %s", diff.PrintWantGot(ld)) + } + // update pod status and trigger reconcile : build is completed pod.Status = corev1.PodStatus{ Phase: corev1.PodSucceeded,