Atlas › Test

TestNewSummaryFromReports_RendersAlertRow

Exact test identity: go.temporal.io/server/tools/testrunner/TestNewSummaryFromReports_RendersAlertRow

Package
go.temporal.io/server/tools/testrunner
Suite / test hierarchy
TestNewSummaryFromReports_RendersAlertRow
Test
TestNewSummaryFromReports_RendersAlertRow
Introduced at
summary.go ×2 Frontier kind: Joint frontier
Covered ranges
11
Covered lines
30
Covered files
2

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/tools/testrunner/summary.go 22 covered LOC · 8 ranges

Open complete file

17 }
18
19 > func newSummaryFromReports(reports []*junitReport) summary { summary.go
20 > return summary{
21 > Rows: newSummaryRowsFromReports(reports),
22 > }
23 > }
24
25 // Markdown renders the GitHub step summary HTML and enforces both the total
66 }
67
68 > func newSummaryRowsFromReports(reports []*junitReport) []summaryRow { summary.go
69 > var rows []summaryRow
70 > for _, report := range reports {
71 > for _, suite := range report.Suites {
72 > for _, tc := range suite.Testcases { summary.go
73 > if tc.Failure == nil {
74 continue
75 }
76 > rows = append(rows, newSummaryRow(failureType(tc.Failure.Type), tc.Name, tc.Failure.Data)) summary.go
77 }
78 }
79 }
80 > slices.SortFunc(rows, func(a, b summaryRow) int { summary.go
81 if byName := strings.Compare(a.Name, b.Name); byName != 0 {
82 return byName
87 return strings.Compare(a.Details, b.Details)
88 })
89 > return rows summary.go
90 }
91
92 > func newSummaryRow(kind failureType, name string, details string) summaryRow { summary.go
93 > if len(details) > summaryMaxDetailBytes {
94 headBytes := (summaryMaxDetailBytes - len(summaryTruncatedMarker)) / 2
95 tailBytes := summaryMaxDetailBytes - len(summaryTruncatedMarker) - headBytes
96 details = details[:headBytes] + summaryTruncatedMarker + details[len(details)-tailBytes:]
97 }
98 > return summaryRow{ summary.go
99 > Kind: kind,
100 > Name: name,
101 > Details: details,
102 > Final: strings.Contains(name, "(final)"),
103 > }
104 }
105
go.temporal.io/server/tools/testrunner/junit.go 8 covered LOC · 3 ranges

Open complete file

38 }
39
40 > func (j *junitReport) read() error { junit.go
41 > f, err := os.Open(j.path)
42 > if err != nil {
43 return fmt.Errorf("failed to open junit report file: %w", err)
44 }
45 > defer f.Close() junit.go
46 >
47 > decoder := xml.NewDecoder(f)
48 > if err = decoder.Decode(&j.Testsuites); err != nil {
49 return fmt.Errorf("failed to read junit report file: %w", err)
50 }
51 > return nil junit.go
52 }
53