mirror of https://github.com/grafana/grafana
parent
43d8bd5a25
commit
4c88db3e43
@ -0,0 +1,26 @@ |
||||
package prometheus |
||||
|
||||
import ( |
||||
"testing" |
||||
|
||||
p "github.com/prometheus/common/model" |
||||
. "github.com/smartystreets/goconvey/convey" |
||||
) |
||||
|
||||
func TestPrometheus(t *testing.T) { |
||||
Convey("Prometheus", t, func() { |
||||
|
||||
Convey("converting metric name", func() { |
||||
metric := map[p.LabelName]p.LabelValue{ |
||||
p.LabelName("app"): p.LabelValue("backend"), |
||||
p.LabelName("device"): p.LabelValue("mobile"), |
||||
} |
||||
|
||||
query := PrometheusQuery{ |
||||
LegendFormat: "legend {{app}} {{device}} {{broken}}", |
||||
} |
||||
|
||||
So(formatLegend(metric, query), ShouldEqual, "legend backend mobile {{broken}}") |
||||
}) |
||||
}) |
||||
} |
@ -1 +1,9 @@ |
||||
package prometheus |
||||
|
||||
import "time" |
||||
|
||||
type PrometheusQuery struct { |
||||
Expr string |
||||
Step time.Duration |
||||
LegendFormat string |
||||
} |
||||
|
Loading…
Reference in new issue