go.temporal.io/server/tools/testrunner/summary.go
127 LOC · 71 covered · 56 uncovered · 23 ranges · 21 concepts · 12 introducers · 16 tests
File neighbourhood
The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.
Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.
package testrunner
import (
"encoding/json"
"fmt"
"html"
"slices"
"strings"
)
const summaryMaxDetailBytes = 4 * 1024
const summaryMarkdownMaxBytes = 1000 * 1024
const summaryTruncatedMarker = "\n… (truncated - see full output in job logs)\n"
type summary struct {
Rows []summaryRow `json:"rows"`
}
return summary{
Rows: newSummaryRowsFromReports(reports),
}
}
// Markdown renders the GitHub step summary HTML and enforces both the total
// summary budget and per-row detail truncation.
if len(s.Rows) == 0 {
}
sb.WriteString("<table>\n<tr><th>Kind</th><th>Test</th></tr>\n")
// Reserve bytes for the closing tag so we can always finish the table.
const tableClose = "</table>\n"
budget := summaryMarkdownMaxBytes - sb.Len() - len(tableClose)
written := 0
for _, row := range s.Rows {
rendered := row.Markdown()
if len(rendered) > budget {
fmt.Fprintf(&sb, "<tr><td colspan=\"2\">… %d failure(s) not shown — see full output in job logs</td></tr>\n", omitted)
break
}
budget -= len(rendered)
written++
}
return sb.String()
}
return json.MarshalIndent(s, "", " ")
}
// summaryRow is a single failure entry rendered in both Markdown and JSON summaries.
type summaryRow struct {
Kind failureType `json:"kind"`
Name string `json:"name"` // test or alert name
Details string `json:"details,omitempty"` // failure body
Final bool `json:"final,omitempty"`
}
var rows []summaryRow
for _, report := range reports {
for _, suite := range report.Suites {
if tc.Failure == nil {
continue
}
rows = append(rows, newSummaryRow(failureType(tc.Failure.Type), tc.Name, tc.Failure.Data))
summary.go ×2
}
}
}
return byName
}
if byKind := strings.Compare(string(a.Kind), string(b.Kind)); byKind != 0 {
return byKind
}
return strings.Compare(a.Details, b.Details)
})
}
if len(details) > summaryMaxDetailBytes {
tailBytes := summaryMaxDetailBytes - len(summaryTruncatedMarker) - headBytes
details = details[:headBytes] + summaryTruncatedMarker + details[len(details)-tailBytes:]
}
Kind: kind,
Name: name,
Details: details,
Final: strings.Contains(name, "(final)"),
}
}
// Markdown renders one summary table row.
kind := string(row.Kind)
if row.Final {
}
fmt.Fprintf(&sb, "<tr><td>%s</td><td>", html.EscapeString(kind))
if row.Details != "" {
escaped := html.EscapeString(row.Details)
if strings.Contains(row.Details, summaryTruncatedMarker) {
}
html.EscapeString(row.Name), escaped)
} else {
sb.WriteString(html.EscapeString(row.Name))
}
return sb.String()
}