package main
import (
"strings"
"testing"
)
func TestFormatDBStatOutputSummarizesHavePT(t *testing.T) {
output := formatDBStatOutput(strings.Join([]string{
"db.have.pt 1024 bytes",
"db.have.pt 2048 bytes",
"db.have.ptx 4096 bytes",
"db.user 512 bytes",
}, "\n"))
for _, expected := range []string{
"db.have.pt summary:",
"Count: 3",
"Total size: 7 KiB",
"Average size: 2.3 KiB",
"Max size: 4 KiB",
} {
if !strings.Contains(output, expected) {
t.Errorf("expected output to contain %q, got:\n%s", expected, output)
}
}
for _, excluded := range []string{
"db.have.pt 1024 bytes",
"db.have.pt 2048 bytes",
"db.have.ptx 4096 bytes",
} {
if strings.Contains(output, excluded) {
t.Errorf("expected raw db.have.pt line %q to be excluded, got:\n%s", excluded, output)
}
}
}
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #1 | 33206 | Robert Cowham |
Don't gzip Windows binaries. Handle partitioned tables. |