@@ -21,6 +21,7 @@ import (
2121 "testing"
2222
2323 "github.com/google/go-cmp/cmp"
24+ "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod"
2425 v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
2526 "github.com/tektoncd/pipeline/pkg/reconciler/taskrun/resources"
2627 "github.com/tektoncd/pipeline/pkg/workspace"
@@ -173,6 +174,17 @@ var (
173174 },
174175 },
175176 }},
177+ PodTemplate : & pod.PodTemplate {
178+ NodeSelector : map [string ]string {"key-$(params.FOO)" : "value-$(params.FOO)" },
179+ Tolerations : []corev1.Toleration {{
180+ Key : "key-$(params.FOO)" ,
181+ Value : "value-$(params.FOO)" ,
182+ Effect : corev1 .TaintEffect ("effect-$(params.FOO)" ),
183+ Operator : corev1 .TolerationOperator ("operator-$(params.FOO)" ),
184+ }},
185+ SchedulerName : "name-$(params.FOO)" ,
186+ // TODO: the rest of the fields
187+ },
176188 }
177189
178190 stepParamTaskSpec = & v1.TaskSpec {
@@ -333,6 +345,17 @@ var (
333345 },
334346 },
335347 }},
348+ PodTemplate : & pod.PodTemplate {
349+ NodeSelector : map [string ]string {"$(params.myObject.key1)" : "$(params.myObject.key2)" },
350+ Tolerations : []corev1.Toleration {{
351+ Key : "$(params.myObject.key1)" ,
352+ Value : "$(params.myObject.key1)" ,
353+ Effect : corev1 .TaintEffect ("$(params.myObject.key2)" ),
354+ Operator : corev1 .TolerationOperator ("$(params.myObject.key2)" ),
355+ }},
356+ SchedulerName : "$(params.myObject.key1)" ,
357+ // TODO: the rest of the fields
358+ },
336359 }
337360
338361 simpleTaskSpecArrayIndexing = & v1.TaskSpec {
@@ -475,6 +498,17 @@ var (
475498 },
476499 },
477500 }},
501+ PodTemplate : & pod.PodTemplate {
502+ NodeSelector : map [string ]string {"key2-$(params.FOO[1])" : "value2-$(params.FOO[1])" },
503+ Tolerations : []corev1.Toleration {{
504+ Key : "key2-$(params.FOO[1])" ,
505+ Value : "value2-$(params.FOO[1])" ,
506+ Effect : corev1 .TaintEffect ("effect2-$(params.FOO[1])" ),
507+ Operator : corev1 .TolerationOperator ("operator2-$(params.FOO[1])" ),
508+ }},
509+ SchedulerName : "name2-$(params.FOO[1])" ,
510+ // TODO: the rest of the fields
511+ },
478512 }
479513
480514 arrayParamTaskSpec = & v1.TaskSpec {
@@ -834,6 +868,15 @@ func TestApplyParameters(t *testing.T) {
834868
835869 spec .Sidecars [0 ].Image = "bar"
836870 spec .Sidecars [0 ].Env [0 ].Value = "world"
871+
872+ spec .PodTemplate .NodeSelector = map [string ]string {"key-world" : "value-world" }
873+ spec .PodTemplate .Tolerations [0 ].Effect = "effect-world"
874+ spec .PodTemplate .Tolerations [0 ].Operator = "operator-world"
875+ spec .PodTemplate .Tolerations [0 ].Key = "key-world"
876+ spec .PodTemplate .Tolerations [0 ].Value = "value-world"
877+ spec .PodTemplate .SchedulerName = "name-world"
878+ // TODO: the rest of the fields
879+
837880 })
838881 got := resources .ApplyParameters (simpleTaskSpec , tr , dp ... )
839882 if d := cmp .Diff (want , got ); d != "" {
@@ -900,6 +943,15 @@ func TestApplyParameters_ArrayIndexing(t *testing.T) {
900943
901944 spec .Sidecars [0 ].Image = "bar"
902945 spec .Sidecars [0 ].Env [0 ].Value = "world"
946+
947+ spec .PodTemplate .NodeSelector = map [string ]string {"key2-world" : "value2-world" }
948+ spec .PodTemplate .Tolerations [0 ].Effect = "effect2-world"
949+ spec .PodTemplate .Tolerations [0 ].Operator = "operator2-world"
950+ spec .PodTemplate .Tolerations [0 ].Key = "key2-world"
951+ spec .PodTemplate .Tolerations [0 ].Value = "value2-world"
952+ spec .PodTemplate .SchedulerName = "name2-world"
953+ // TODO: the rest of the fields
954+
903955 })
904956 got := resources .ApplyParameters (simpleTaskSpecArrayIndexing , tr , dp ... )
905957 if d := cmp .Diff (want , got ); d != "" {
@@ -966,6 +1018,15 @@ func TestApplyObjectParameters(t *testing.T) {
9661018 spec .Volumes [2 ].VolumeSource .Projected .Sources [0 ].ServiceAccountToken .Audience = "taskrun-value-for-key2"
9671019 spec .Volumes [3 ].VolumeSource .CSI .VolumeAttributes ["secretProviderClass" ] = "taskrun-value-for-key1"
9681020 spec .Volumes [3 ].VolumeSource .CSI .NodePublishSecretRef .Name = "taskrun-value-for-key1"
1021+
1022+ spec .PodTemplate .NodeSelector = map [string ]string {"taskrun-value-for-key1" : "taskrun-value-for-key2" }
1023+ spec .PodTemplate .Tolerations [0 ].Effect = "taskrun-value-for-key2"
1024+ spec .PodTemplate .Tolerations [0 ].Operator = "taskrun-value-for-key2"
1025+ spec .PodTemplate .Tolerations [0 ].Key = "taskrun-value-for-key1"
1026+ spec .PodTemplate .Tolerations [0 ].Value = "taskrun-value-for-key1"
1027+ spec .PodTemplate .SchedulerName = "taskrun-value-for-key1"
1028+ // TODO: the rest of the fields
1029+
9691030 })
9701031 got := resources .ApplyParameters (objectParamTaskSpec , tr , dp ... )
9711032 if d := cmp .Diff (want , got ); d != "" {
0 commit comments