Skip to content

Commit 50c268e

Browse files
committed
Merge branch 'main' into fund-testnet
2 parents 6a57a44 + d3bffaf commit 50c268e

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

tools/flakeguard/cmd/aggregate_results.go

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ var AggregateResultsCmd = &cobra.Command{
2424
maxPassRatio, _ := cmd.Flags().GetFloat64("max-pass-ratio")
2525
codeOwnersPath, _ := cmd.Flags().GetString("codeowners-path")
2626
repoPath, _ := cmd.Flags().GetString("repo-path")
27+
repoURL, _ := cmd.Flags().GetString("repo-url")
28+
headSHA, _ := cmd.Flags().GetString("head-sha")
29+
baseSHA, _ := cmd.Flags().GetString("base-sha")
30+
githubWorkflowName, _ := cmd.Flags().GetString("github-workflow-name")
2731

2832
// Ensure the output directory exists
2933
if err := fs.MkdirAll(outputDir, 0755); err != nil {
@@ -51,6 +55,13 @@ var AggregateResultsCmd = &cobra.Command{
5155

5256
// Aggregate the reports
5357
aggregatedReport, err := reports.Aggregate(testReports...)
58+
59+
// Add metadata to the aggregated report
60+
aggregatedReport.HeadSHA = headSHA
61+
aggregatedReport.BaseSHA = baseSHA
62+
aggregatedReport.RepoURL = repoURL
63+
aggregatedReport.GitHubWorkflowName = githubWorkflowName
64+
5465
if err != nil {
5566
s.Stop()
5667
return fmt.Errorf("error aggregating test reports: %w", err)
@@ -98,12 +109,15 @@ var AggregateResultsCmd = &cobra.Command{
98109

99110
// Create a new report for failed tests with logs
100111
failedReportWithLogs := &reports.TestReport{
101-
GoProject: aggregatedReport.GoProject,
102-
TestRunCount: aggregatedReport.TestRunCount,
103-
RaceDetection: aggregatedReport.RaceDetection,
104-
ExcludedTests: aggregatedReport.ExcludedTests,
105-
SelectedTests: aggregatedReport.SelectedTests,
106-
Results: failedTests,
112+
GoProject: aggregatedReport.GoProject,
113+
TestRunCount: aggregatedReport.TestRunCount,
114+
RaceDetection: aggregatedReport.RaceDetection,
115+
ExcludedTests: aggregatedReport.ExcludedTests,
116+
SelectedTests: aggregatedReport.SelectedTests,
117+
HeadSHA: aggregatedReport.HeadSHA,
118+
BaseSHA: aggregatedReport.BaseSHA,
119+
GitHubWorkflowName: aggregatedReport.GitHubWorkflowName,
120+
Results: failedTests,
107121
}
108122

109123
// Save the failed tests report with logs
@@ -171,6 +185,10 @@ func init() {
171185
AggregateResultsCmd.Flags().Float64P("max-pass-ratio", "", 1.0, "The maximum pass ratio threshold for a test to be considered flaky")
172186
AggregateResultsCmd.Flags().StringP("codeowners-path", "", "", "Path to the CODEOWNERS file")
173187
AggregateResultsCmd.Flags().StringP("repo-path", "", ".", "The path to the root of the repository/project")
188+
AggregateResultsCmd.Flags().String("repo-url", "", "The repository URL")
189+
AggregateResultsCmd.Flags().String("head-sha", "", "Head commit SHA for the test report")
190+
AggregateResultsCmd.Flags().String("base-sha", "", "Base commit SHA for the test report")
191+
AggregateResultsCmd.Flags().String("github-workflow-name", "", "GitHub workflow name for the test report")
174192

175193
AggregateResultsCmd.MarkFlagRequired("results-path")
176194
}

tools/flakeguard/reports/data.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ import (
1111
// Data Structures
1212

1313
type TestReport struct {
14-
GoProject string
15-
TestRunCount int
16-
RaceDetection bool
17-
ExcludedTests []string
18-
SelectedTests []string
19-
Results []TestResult
14+
GoProject string
15+
HeadSHA string
16+
BaseSHA string
17+
RepoURL string
18+
GitHubWorkflowName string
19+
TestRunCount int
20+
RaceDetection bool
21+
ExcludedTests []string
22+
SelectedTests []string
23+
Results []TestResult
2024
}
2125

2226
type TestResult struct {

0 commit comments

Comments
 (0)