diff --git a/pkg/tsdb/mqe/types_test.go b/pkg/tsdb/mqe/types_test.go index 27b400b3c08..1138e0599e7 100644 --- a/pkg/tsdb/mqe/types_test.go +++ b/pkg/tsdb/mqe/types_test.go @@ -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{