Skip to content

Commit 4cf9cee

Browse files
committed
Enhance test results summary by adding rerun details and modifying short results table headers
1 parent 3879578 commit 4cf9cee

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

tools/flakeguard/cmd/run.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ var RunTestsCmd = &cobra.Command{
204204
flushSummaryAndExit(ErrorExitCode)
205205
}
206206

207+
fmt.Fprint(&summaryBuffer, "\nFailed Tests That Were Rerun:\n\n")
208+
reports.PrintTestResultsTable(&summaryBuffer, rerunResults, false, false, true)
209+
fmt.Fprintln(&summaryBuffer)
210+
207211
// Save the rerun test report to file
208212
if rerunResultsPath != "" && len(rerunResults) > 0 {
209213
if err := reports.SaveTestResultsToFile(rerunResults, rerunResultsPath); err != nil {
@@ -219,10 +223,6 @@ var RunTestsCmd = &cobra.Command{
219223
})
220224

221225
if len(failedAfterRerun) > 0 {
222-
fmt.Fprint(&summaryBuffer, "\nTests That Have 0 Success Rate After Reruns:\n\n")
223-
reports.PrintTestResultsTable(&summaryBuffer, failedAfterRerun, false, false, true)
224-
fmt.Fprintln(&summaryBuffer)
225-
226226
fmt.Fprint(&summaryBuffer, "\nLogs:\n\n")
227227
err := rerunReport.PrintGotestsumOutput(&summaryBuffer, "pkgname")
228228
if err != nil {

tools/flakeguard/reports/presentation.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ func generateShortTestResultsTable(
8282
) [][]string {
8383
p := message.NewPrinter(language.English)
8484

85-
// Define the columns you want
86-
headers := []string{"Name", "Path", "Runs", "Failures", "Code Owners"}
85+
headers := []string{"Name", "Ever Passed", "Runs", "Successes", "Code Owners", "Path"}
8786

8887
// Optionally format the headers for Markdown
8988
if markdown {
@@ -101,18 +100,25 @@ func generateShortTestResultsTable(
101100
continue
102101
}
103102

103+
// Determine whether the test has passed at least once
104+
passed := "NO"
105+
if r.Successes > 0 {
106+
passed = "YES"
107+
}
108+
104109
// Format the Code Owners
105110
owners := "Unknown"
106111
if len(r.CodeOwners) > 0 {
107112
owners = strings.Join(r.CodeOwners, ", ")
108113
}
109114

110115
row := []string{
111-
r.TestName,
112-
r.TestPath,
113-
p.Sprintf("%d", r.Runs),
114-
p.Sprintf("%d", r.Failures),
115-
owners,
116+
r.TestName, // "Name"
117+
passed, // "Passed"
118+
p.Sprintf("%d", r.Runs), // "Runs"
119+
p.Sprintf("%d", r.Successes), // "Passes"
120+
owners, // "Code Owners"
121+
r.TestPath, // "Path"
116122
}
117123

118124
table = append(table, row)

0 commit comments

Comments
 (0)