Skip to content

Commit 6e82b1d

Browse files
committed
Rename artifacts
1 parent 1e6eecc commit 6e82b1d

File tree

1 file changed

+31
-14
lines changed

1 file changed

+31
-14
lines changed

tools/flakeguard/cmd/report.go

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ var ReportCmd = &cobra.Command{
9696
}
9797

9898
// Save the aggregated report (all tests)
99-
allTestsReportPath := filepath.Join(outputDir, "all-tests-report.json")
99+
allTestsReportPath := filepath.Join(outputDir, "all-test-results.json")
100100
if err := reports.SaveReport(fs, allTestsReportPath, *aggregatedReport); err != nil {
101101
return fmt.Errorf("error saving all tests report: %w", err)
102102
}
@@ -107,7 +107,7 @@ var ReportCmd = &cobra.Command{
107107
s.Suffix = " Generating GitHub summary markdown..."
108108
s.Start()
109109

110-
err = generateGitHubSummaryMarkdown(aggregatedReport, filepath.Join(outputDir, "all-tests"))
110+
err = generateGitHubSummaryMarkdown(aggregatedReport, filepath.Join(outputDir, "all-test"))
111111
if err != nil {
112112
s.Stop()
113113
return fmt.Errorf("error generating GitHub summary markdown: %w", err)
@@ -117,16 +117,16 @@ var ReportCmd = &cobra.Command{
117117

118118
// Generate all-tests-summary.json
119119
s = spinner.New(spinner.CharSets[11], 100*time.Millisecond)
120-
s.Suffix = " Generating all-tests-summary.json..."
120+
s.Suffix = " Generating all-test-summary.json..."
121121
s.Start()
122122

123-
err = generateAllTestsSummaryJSON(aggregatedReport, filepath.Join(outputDir, "all-tests-summary.json"), reportMaxPassRatio)
123+
err = generateAllTestsSummaryJSON(aggregatedReport, filepath.Join(outputDir, "all-test-summary.json"), reportMaxPassRatio)
124124
if err != nil {
125125
s.Stop()
126-
return fmt.Errorf("error generating all-tests-summary.json: %w", err)
126+
return fmt.Errorf("error generating all-test-summary.json: %w", err)
127127
}
128128
s.Stop()
129-
fmt.Println("all-tests-summary.json generated successfully.")
129+
fmt.Println("all-test-summary.json generated successfully.")
130130

131131
if generatePRComment {
132132
// Retrieve required flags
@@ -159,7 +159,7 @@ var ReportCmd = &cobra.Command{
159159
s.Suffix = " Generating PR comment markdown..."
160160
s.Start()
161161

162-
err = generatePRCommentMarkdown(aggregatedReport, filepath.Join(outputDir, "all-tests"), baseBranch, currentBranch, currentCommitSHA, repoURL, actionRunID)
162+
err = generatePRCommentMarkdown(aggregatedReport, filepath.Join(outputDir, "all-test"), baseBranch, currentBranch, currentCommitSHA, repoURL, actionRunID)
163163
if err != nil {
164164
s.Stop()
165165
return fmt.Errorf("error generating PR comment markdown: %w", err)
@@ -179,15 +179,32 @@ var ReportCmd = &cobra.Command{
179179
s.Stop()
180180
fmt.Println("Failed tests filtered successfully.")
181181

182-
// For failed tests, include outputs and package outputs
182+
// Create a new report for failed tests
183+
failedReportNoLogs := &reports.TestReport{
184+
GoProject: aggregatedReport.GoProject,
185+
TestRunCount: aggregatedReport.TestRunCount,
186+
RaceDetection: aggregatedReport.RaceDetection,
187+
ExcludedTests: aggregatedReport.ExcludedTests,
188+
SelectedTests: aggregatedReport.SelectedTests,
189+
Results: failedTests,
190+
}
191+
192+
// Save the failed tests report with no logs
193+
failedTestsReportNoLogsPath := filepath.Join(outputDir, "failed-test-results.json")
194+
if err := reports.SaveReport(fs, failedTestsReportNoLogsPath, *failedReportNoLogs); err != nil {
195+
return fmt.Errorf("error saving failed tests report: %w", err)
196+
}
197+
fmt.Printf("Failed tests report without logs saved to %s\n", failedTestsReportNoLogsPath)
198+
199+
// Retrieve outputs and package outputs for failed tests
183200
for i := range failedTests {
184201
// Retrieve outputs and package outputs from original reports
185202
failedTests[i].Outputs = getOriginalOutputs(testReports, failedTests[i].TestName, failedTests[i].TestPackage)
186203
failedTests[i].PackageOutputs = getOriginalPackageOutputs(testReports, failedTests[i].TestName, failedTests[i].TestPackage)
187204
}
188205

189206
// Create a new report for failed tests
190-
failedReport := &reports.TestReport{
207+
failedReportWithLogs := &reports.TestReport{
191208
GoProject: aggregatedReport.GoProject,
192209
TestRunCount: aggregatedReport.TestRunCount,
193210
RaceDetection: aggregatedReport.RaceDetection,
@@ -197,11 +214,11 @@ var ReportCmd = &cobra.Command{
197214
}
198215

199216
// Save the failed tests report
200-
failedTestsReportPath := filepath.Join(outputDir, "failed-tests-report.json")
201-
if err := reports.SaveReport(fs, failedTestsReportPath, *failedReport); err != nil {
217+
failedTestsReportWithLogsPath := filepath.Join(outputDir, "failed-test-results-with-logs.json")
218+
if err := reports.SaveReport(fs, failedTestsReportWithLogsPath, *failedReportWithLogs); err != nil {
202219
return fmt.Errorf("error saving failed tests report: %w", err)
203220
}
204-
fmt.Printf("Failed tests report saved to %s\n", failedTestsReportPath)
221+
fmt.Printf("Failed tests report with logs saved to %s\n", failedTestsReportWithLogsPath)
205222

206223
fmt.Printf("Reports generated at: %s\n", reportOutputPath)
207224

@@ -260,13 +277,13 @@ func generateAllTestsSummaryJSON(report *reports.TestReport, outputPath string,
260277
fs := reports.OSFileSystem{}
261278
jsonFile, err := fs.Create(outputPath)
262279
if err != nil {
263-
return fmt.Errorf("error creating all-tests-summary.json file: %w", err)
280+
return fmt.Errorf("error creating file: %w", err)
264281
}
265282
defer jsonFile.Close()
266283

267284
_, err = jsonFile.Write(data)
268285
if err != nil {
269-
return fmt.Errorf("error writing summary data to all-tests-summary.json: %w", err)
286+
return fmt.Errorf("error writing data to file: %w", err)
270287
}
271288

272289
return nil

0 commit comments

Comments
 (0)