Skip to content

Commit d551457

Browse files
committed
Add mapping of report ID to each test result in NewTestReport function
1 parent 7d381ab commit d551457

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tools/flakeguard/reports/test_report.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,25 @@ func NewTestReport(results []TestResult, opts ...TestReportOption) (TestReport,
187187

188188
r.GenerateSummaryData()
189189

190+
// Map test results to paths
190191
err := MapTestResultsToPaths(&r, r.ProjectPath)
191192
if err != nil {
192193
return r, fmt.Errorf("error mapping test results to paths: %w", err)
193194
}
194195

196+
// Map test results to code owners if a codeowners file is provided
195197
if defaultOpts.codeownersPath != "" {
196198
err = MapTestResultsToOwners(&r, defaultOpts.codeownersPath)
197199
if err != nil {
198200
return r, fmt.Errorf("error mapping test results to code owners: %w", err)
199201
}
200202
}
201203

204+
// Set the report ID for each test result
205+
for i := range r.Results {
206+
r.Results[i].ReportID = r.ID
207+
}
208+
202209
return r, nil
203210
}
204211

0 commit comments

Comments
 (0)