Files
core/monitor/metric/metric_test.go
Jan Stabenow 9c0b535199 Add v16.7.2
2022-05-13 19:26:45 +02:00

27 lines
488 B
Go

package metric
import (
"testing"
)
func TestValue(t *testing.T) {
d := NewDesc("group", "", []string{"name"})
v := NewValue(d, 42, "foobar")
if v.L("name") != "foobar" {
t.Fatalf("label name doesn't have the expected value")
}
p1 := NewPattern("group")
if v.Match([]Pattern{p1}) == false {
t.Fatalf("pattern p1 should have matched")
}
p2 := NewPattern("group", "name", "foobar")
if v.Match([]Pattern{p2}) == false {
t.Fatalf("pattern p2 should have matched")
}
}