Skip to content

Commit 83e7df6

Browse files
committed
Handle groupped errors in summary
Signed-off-by: Florent Poinsard <[email protected]>
1 parent ed6e430 commit 83e7df6

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

go/keys/keys_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ import (
2121
"strings"
2222
"testing"
2323

24+
"github.com/stretchr/testify/require"
25+
2426
"github.com/vitessio/vt/go/data"
2527
"github.com/vitessio/vt/go/typ"
26-
27-
"github.com/stretchr/testify/require"
2828
)
2929

3030
func TestKeys(t *testing.T) {

go/summarize/summarize-keys.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type (
5858
FailuresSummary struct {
5959
Query string
6060
Error string
61+
Count int
6162
}
6263

6364
graphKey struct {
@@ -296,10 +297,10 @@ func renderFailures(md *markdown.MarkDown, failures []FailuresSummary) {
296297
}
297298
md.PrintHeader("Failures", 2)
298299

299-
headers := []string{"Query", "Error"}
300+
headers := []string{"Query", "Error", "Count"}
300301
var rows [][]string
301302
for _, failure := range failures {
302-
rows = append(rows, []string{failure.Query, failure.Error})
303+
rows = append(rows, []string{failure.Query, failure.Error, strconv.Itoa(failure.Count)})
303304
}
304305
md.PrintTable(headers, rows)
305306
}
@@ -368,6 +369,7 @@ func summarizeKeysQueries(queries *keys.Output) ([]TableSummary, []FailuresSumma
368369
failures = append(failures, FailuresSummary{
369370
Query: query.Query,
370371
Error: query.Error,
372+
Count: len(query.LineNumbers),
371373
})
372374
}
373375

go/summarize/testdata/keys-summary.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ partsupp ↔ supplier (Occurrences: 1)
148148
149149
```
150150
## Failures
151-
|Query|Error|
152-
|---|---|
153-
|I am a failing query;|syntax error at position 2 near 'I'|
154-
|I am a failing query;|syntax error at position 2 near 'I'|
151+
|Query|Error|Count|
152+
|---|---|---|
153+
|I am a failing query;|syntax error at position 2 near 'I'|2|
155154

0 commit comments

Comments
 (0)