micro/meter/meter_test.go
Vasiliy Tolstov dbbdb24631 meter: rework labels
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-03-15 00:44:13 +03:00

25 lines
510 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", Labels("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)
}
}