|
|
@@ -35,15 +35,18 @@ func TestWildcardExpansion(t *testing.T) {
|
|
|
Cluster: []string{"demoapp-1", "demoapp-2"},
|
|
|
AddClusterToAlias: false,
|
|
|
AddHostToAlias: false,
|
|
|
- TimeRange: &tsdb.TimeRange{Now: now, From: "5m", To: "now"},
|
|
|
+ FunctionList: []Function{
|
|
|
+ Function{Func: "aggregate.min"},
|
|
|
+ },
|
|
|
+ TimeRange: &tsdb.TimeRange{Now: now, From: "5m", To: "now"},
|
|
|
}
|
|
|
|
|
|
expandeQueries, err := query.Build(availableMetrics)
|
|
|
So(err, ShouldBeNil)
|
|
|
So(len(expandeQueries), ShouldEqual, 3)
|
|
|
- So(expandeQueries[0].RawQuery, ShouldEqual, fmt.Sprintf("`os.cpu.3.idle` where cluster in ('demoapp-1', 'demoapp-2') and host in ('staples-lab-1', 'staples-lab-2') from %v to %v", from, to))
|
|
|
- So(expandeQueries[1].RawQuery, ShouldEqual, fmt.Sprintf("`os.cpu.2.idle` where cluster in ('demoapp-1', 'demoapp-2') and host in ('staples-lab-1', 'staples-lab-2') from %v to %v", from, to))
|
|
|
- So(expandeQueries[2].RawQuery, ShouldEqual, fmt.Sprintf("`os.cpu.1.idle` {cpu} where cluster in ('demoapp-1', 'demoapp-2') and host in ('staples-lab-1', 'staples-lab-2') from %v to %v", from, to))
|
|
|
+ So(expandeQueries[0].RawQuery, ShouldEqual, fmt.Sprintf("`os.cpu.3.idle`|aggregate.min where cluster in ('demoapp-1', 'demoapp-2') and host in ('staples-lab-1', 'staples-lab-2') from %v to %v", from, to))
|
|
|
+ So(expandeQueries[1].RawQuery, ShouldEqual, fmt.Sprintf("`os.cpu.2.idle`|aggregate.min where cluster in ('demoapp-1', 'demoapp-2') and host in ('staples-lab-1', 'staples-lab-2') from %v to %v", from, to))
|
|
|
+ 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("Containg wildcard series", func() {
|