@@ -3511,7 +3511,7 @@ func TestApplyTaskResultsToPipelineResults_Success(t *testing.T) {
3511
3511
results []v1beta1.PipelineResult
3512
3512
taskResults map [string ][]v1beta1.TaskRunResult
3513
3513
runResults map [string ][]v1beta1.CustomRunResult
3514
- skippedTasks []v1beta1. SkippedTask
3514
+ taskstatus map [ string ] string
3515
3515
expectedResults []v1beta1.PipelineRunResult
3516
3516
}{{
3517
3517
description : "non-reference-results" ,
@@ -3788,13 +3788,38 @@ func TestApplyTaskResultsToPipelineResults_Success(t *testing.T) {
3788
3788
Value : * v1beta1 .NewStructuredValues ("rae" ),
3789
3789
}},
3790
3790
},
3791
- skippedTasks : []v1beta1.SkippedTask {{
3792
- Name : "skippedTask" ,
3791
+ taskstatus : map [string ]string {"tasks.skippedTask.status" : "None" },
3792
+ expectedResults : nil ,
3793
+ }, {
3794
+ description : "unsuccessful-taskrun-no-returned-result" ,
3795
+ results : []v1beta1.PipelineResult {{
3796
+ Name : "foo" ,
3797
+ Value : * v1beta1 .NewStructuredValues ("$(tasks.pt1.results.foo)" ),
3793
3798
}},
3799
+ taskResults : map [string ][]v1beta1.TaskRunResult {},
3800
+ taskstatus : map [string ]string {PipelineTaskStatusPrefix + "pt1" + PipelineTaskStatusSuffix : v1beta1 .TaskRunReasonFailed .String ()},
3794
3801
expectedResults : nil ,
3802
+ }, {
3803
+ description : "unsuccessful-taskrun-with-returned-result" ,
3804
+ results : []v1beta1.PipelineResult {{
3805
+ Name : "foo" ,
3806
+ Value : * v1beta1 .NewStructuredValues ("$(tasks.pt1.results.foo[*])" ),
3807
+ }},
3808
+ taskResults : map [string ][]v1beta1.TaskRunResult {
3809
+ "pt1" : {
3810
+ {
3811
+ Name : "foo" ,
3812
+ Value : * v1beta1 .NewStructuredValues ("do" , "rae" , "mi" ),
3813
+ },
3814
+ }},
3815
+ taskstatus : map [string ]string {PipelineTaskStatusPrefix + "pt1" + PipelineTaskStatusSuffix : v1beta1 .TaskRunReasonFailed .String ()},
3816
+ expectedResults : []v1beta1.PipelineRunResult {{
3817
+ Name : "foo" ,
3818
+ Value : * v1beta1 .NewStructuredValues ("do" , "rae" , "mi" ),
3819
+ }},
3795
3820
}} {
3796
3821
t .Run (tc .description , func (t * testing.T ) {
3797
- received , err := ApplyTaskResultsToPipelineResults (context .Background (), tc .results , tc .taskResults , tc .runResults , tc .skippedTasks )
3822
+ received , err := ApplyTaskResultsToPipelineResults (context .Background (), tc .results , tc .taskResults , tc .runResults , tc .taskstatus )
3798
3823
if err != nil {
3799
3824
t .Errorf ("Got unecpected error:%v" , err )
3800
3825
}
@@ -3811,6 +3836,7 @@ func TestApplyTaskResultsToPipelineResults_Error(t *testing.T) {
3811
3836
results []v1beta1.PipelineResult
3812
3837
taskResults map [string ][]v1beta1.TaskRunResult
3813
3838
runResults map [string ][]v1beta1.CustomRunResult
3839
+ taskstatus map [string ]string
3814
3840
expectedResults []v1beta1.PipelineRunResult
3815
3841
expectedError error
3816
3842
}{{
@@ -3920,15 +3946,6 @@ func TestApplyTaskResultsToPipelineResults_Error(t *testing.T) {
3920
3946
},
3921
3947
expectedResults : nil ,
3922
3948
expectedError : fmt .Errorf ("invalid pipelineresults [foo], the referred results don't exist" ),
3923
- }, {
3924
- description : "unsuccessful-taskrun-no-returned-result" ,
3925
- results : []v1beta1.PipelineResult {{
3926
- Name : "foo" ,
3927
- Value : * v1beta1 .NewStructuredValues ("$(tasks.pt1.results.foo)" ),
3928
- }},
3929
- taskResults : map [string ][]v1beta1.TaskRunResult {},
3930
- expectedResults : nil ,
3931
- expectedError : fmt .Errorf ("invalid pipelineresults [foo], the referred results don't exist" ),
3932
3949
}, {
3933
3950
description : "mixed-success-tasks-some-returned-results" ,
3934
3951
results : []v1beta1.PipelineResult {{
@@ -4010,9 +4027,10 @@ func TestApplyTaskResultsToPipelineResults_Error(t *testing.T) {
4010
4027
expectedError : fmt .Errorf ("invalid pipelineresults [foo], the referred results don't exist" ),
4011
4028
}} {
4012
4029
t .Run (tc .description , func (t * testing.T ) {
4013
- received , err := ApplyTaskResultsToPipelineResults (context .Background (), tc .results , tc .taskResults , tc .runResults , nil /*skipped tasks*/ )
4030
+ received , err := ApplyTaskResultsToPipelineResults (context .Background (), tc .results , tc .taskResults , tc .runResults , tc . taskstatus )
4014
4031
if err == nil {
4015
4032
t .Errorf ("Expect error but got nil" )
4033
+ return
4016
4034
}
4017
4035
4018
4036
if d := cmp .Diff (tc .expectedError .Error (), err .Error ()); d != "" {
0 commit comments