snapshot of https://github.com/centrifugal/centrifugo.git (master, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
22
internal/metrics/graphite/graphite_test.go
Normal file
22
internal/metrics/graphite/graphite_test.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package graphite
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPreparePathComponent(t *testing.T) {
|
||||
testCases := []struct {
|
||||
in, out string
|
||||
}{
|
||||
{in: "service", out: "service"},
|
||||
{in: "service.local", out: "service_local"},
|
||||
{in: "service.prod.", out: "service_prod_"},
|
||||
{in: "приvет", out: "___v__"},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
if want, got := tc.out, PreparePathComponent(tc.in); want != got {
|
||||
t.Fatalf("error, got sanitized string %s, want %s", got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user