29 lines
547 B
Go
29 lines
547 B
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"lingniu-vehicle-ingest/go/vehicle-gateway/internal/loadsim"
|
|
)
|
|
|
|
func TestFormatStatsIncludesCapacityCounters(t *testing.T) {
|
|
out := formatStats(loadsim.Stats{
|
|
ConnectionsOpened: 10,
|
|
ConnectionsFailed: 2,
|
|
FramesWritten: 300,
|
|
WriteErrors: 1,
|
|
})
|
|
|
|
for _, want := range []string{
|
|
"connections_opened=10",
|
|
"connections_failed=2",
|
|
"frames_written=300",
|
|
"write_errors=1",
|
|
} {
|
|
if !strings.Contains(out, want) {
|
|
t.Fatalf("formatStats() = %q, missing %q", out, want)
|
|
}
|
|
}
|
|
}
|