change fillmode from last to previous

This commit is contained in:
Sven Klemm
2018-08-07 21:01:41 +02:00
parent 83d7ec1da2
commit ee7602ec1f
10 changed files with 21 additions and 22 deletions

View File

@@ -102,8 +102,8 @@ func (m *msSqlMacroEngine) evaluateMacro(name string, args []string) (string, er
switch args[2] {
case "NULL":
m.query.Model.Set("fillMode", "null")
case "last":
m.query.Model.Set("fillMode", "last")
case "previous":
m.query.Model.Set("fillMode", "previous")
default:
m.query.Model.Set("fillMode", "value")
floatVal, err := strconv.ParseFloat(args[2], 64)

View File

@@ -85,8 +85,8 @@ func TestMacroEngine(t *testing.T) {
So(fillInterval, ShouldEqual, 5*time.Minute.Seconds())
})
Convey("interpolate __timeGroup function with fill (value = last)", func() {
_, err := engine.Interpolate(query, timeRange, "GROUP BY $__timeGroup(time_column,'5m', last)")
Convey("interpolate __timeGroup function with fill (value = previous)", func() {
_, err := engine.Interpolate(query, timeRange, "GROUP BY $__timeGroup(time_column,'5m', previous)")
fill := query.Model.Get("fill").MustBool()
fillMode := query.Model.Get("fillMode").MustString()
@@ -94,7 +94,7 @@ func TestMacroEngine(t *testing.T) {
So(err, ShouldBeNil)
So(fill, ShouldBeTrue)
So(fillMode, ShouldEqual, "last")
So(fillMode, ShouldEqual, "previous")
So(fillInterval, ShouldEqual, 5*time.Minute.Seconds())
})