@@ -164,10 +164,10 @@ jobs:
164
164
165
165
func TestJobNeedsMatrix (t * testing.T ) {
166
166
testCases := []struct {
167
- treePath string
168
- fileContent string
169
- execPolicies map [string ]* taskExecPolicy
170
- expectedOutputs map [string ]map [ string ] string // jobID(string) => output(map[string]string)
167
+ treePath string
168
+ fileContent string
169
+ execPolicies map [string ]* taskExecPolicy
170
+ expectedTaskNeeds map [string ]* runnerv1. TaskNeed // jobID => TaskNeed
171
171
}{
172
172
{
173
173
treePath : ".gitea/workflows/jobs-outputs-with-matrix.yml" ,
@@ -224,11 +224,14 @@ jobs:
224
224
},
225
225
},
226
226
},
227
- expectedOutputs : map [string ]map [ string ] string {
227
+ expectedTaskNeeds : map [string ]* runnerv1. TaskNeed {
228
228
"job1" : {
229
- "output_1" : "1" ,
230
- "output_2" : "2" ,
231
- "output_3" : "3" ,
229
+ Result : runnerv1 .Result_RESULT_SUCCESS ,
230
+ Outputs : map [string ]string {
231
+ "output_1" : "1" ,
232
+ "output_2" : "2" ,
233
+ "output_3" : "3" ,
234
+ },
232
235
},
233
236
},
234
237
},
@@ -255,12 +258,12 @@ jobs:
255
258
runner .execTask (t , task , policy )
256
259
}
257
260
258
- job2Task := runner .fetchTask (t )
259
- needs := job2Task .Needs
260
- assert .Len (t , needs , len (tc .expectedOutputs ))
261
- for jobID , outputs := range tc .expectedOutputs {
262
- assert .Len (t , needs [jobID ].Outputs , len (outputs ))
263
- for outputKey , outputValue := range outputs {
261
+ task := runner .fetchTask (t )
262
+ needs := task .Needs
263
+ assert .Len (t , needs , len (tc .expectedTaskNeeds ))
264
+ for jobID , tn := range tc .expectedTaskNeeds {
265
+ assert .Len (t , needs [jobID ].Outputs , len (tn . Outputs ))
266
+ for outputKey , outputValue := range tn . Outputs {
264
267
assert .Equal (t , outputValue , needs [jobID ].Outputs [outputKey ])
265
268
}
266
269
}
0 commit comments