micro/meter/meter_test.go
Vasiliy Tolstov 3bdfdd8fd2 meter: fix labels
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-04-27 00:03:18 +03:00

25 lines
502 B
Go

package meter
import (
"testing"
)
func TestNoopMeter(t *testing.T) {
m := NewMeter(Path("/noop"))
if "/noop" != m.Options().Path {
t.Fatalf("invalid options parsing: %v", m.Options())
}
cnt := m.Counter("counter", "server", "noop")
cnt.Inc()
}
func TestLabelsSort(t *testing.T) {
ls := []string{"server", "http", "register", "mdns", "broker", "broker1", "broker", "broker2", "server", "tcp"}
Sort(&ls)
if ls[0] != "broker" || ls[1] != "broker2" {
t.Fatalf("sort error: %v", ls)
}
}