2021-01-22 18:21:40 +03:00
|
|
|
package meter
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNoopMeter(t *testing.T) {
|
2021-02-18 15:57:42 +03:00
|
|
|
m := NewMeter(Path("/noop"))
|
|
|
|
if "/noop" != m.Options().Path {
|
|
|
|
t.Fatalf("invalid options parsing: %v", m.Options())
|
2021-02-13 15:35:56 +03:00
|
|
|
}
|
2021-01-27 00:54:19 +03:00
|
|
|
|
2021-04-26 23:13:36 +03:00
|
|
|
cnt := m.Counter("counter", "server", "noop")
|
2021-01-27 00:54:19 +03:00
|
|
|
cnt.Inc()
|
|
|
|
}
|
|
|
|
|
2021-03-15 00:44:13 +03:00
|
|
|
func TestLabelsSort(t *testing.T) {
|
|
|
|
ls := []string{"server", "http", "register", "mdns", "broker", "broker1", "broker", "broker2", "server", "tcp"}
|
|
|
|
Sort(&ls)
|
2021-01-27 00:54:19 +03:00
|
|
|
|
2021-03-15 00:44:13 +03:00
|
|
|
if ls[0] != "broker" || ls[1] != "broker2" {
|
|
|
|
t.Fatalf("sort error: %v", ls)
|
2021-01-27 00:54:19 +03:00
|
|
|
}
|
2021-01-22 18:21:40 +03:00
|
|
|
}
|