mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
test(mqe): adds test for double function usage
This commit is contained in:
parent
7dece3ff0c
commit
e3b53fe599
@ -49,6 +49,28 @@ func TestWildcardExpansion(t *testing.T) {
|
||||
So(expandeQueries[2].RawQuery, ShouldEqual, fmt.Sprintf("`os.cpu.1.idle`|aggregate.min {cpu} where cluster in ('demoapp-1', 'demoapp-2') and host in ('staples-lab-1', 'staples-lab-2') from %v to %v", from, to))
|
||||
})
|
||||
|
||||
Convey("With two aggregate functions", func() {
|
||||
query := &Query{
|
||||
Metrics: []Metric{
|
||||
Metric{Metric: "os.cpu.3.idle", Alias: ""},
|
||||
},
|
||||
Hosts: []string{"staples-lab-1", "staples-lab-2"},
|
||||
Cluster: []string{"demoapp-1", "demoapp-2"},
|
||||
AddClusterToAlias: false,
|
||||
AddHostToAlias: false,
|
||||
FunctionList: []Function{
|
||||
Function{Func: "aggregate.min"},
|
||||
Function{Func: "aggregate.max"},
|
||||
},
|
||||
TimeRange: &tsdb.TimeRange{Now: now, From: "5m", To: "now"},
|
||||
}
|
||||
|
||||
expandeQueries, err := query.Build(availableMetrics)
|
||||
So(err, ShouldBeNil)
|
||||
So(len(expandeQueries), ShouldEqual, 1)
|
||||
So(expandeQueries[0].RawQuery, ShouldEqual, fmt.Sprintf("`os.cpu.3.idle`|aggregate.min|aggregate.max where cluster in ('demoapp-1', 'demoapp-2') and host in ('staples-lab-1', 'staples-lab-2') from %v to %v", from, to))
|
||||
})
|
||||
|
||||
Convey("Containg wildcard series", func() {
|
||||
query := &Query{
|
||||
Metrics: []Metric{
|
||||
|
Loading…
Reference in New Issue
Block a user