|
|
@@ -72,6 +72,32 @@ func TestQueryCondition(t *testing.T) {
|
|
|
So(ctx.result.Error, ShouldBeNil)
|
|
|
So(ctx.result.Firing, ShouldBeTrue)
|
|
|
})
|
|
|
+
|
|
|
+ Convey("Empty series", func() {
|
|
|
+ Convey("Should set NoDataFound both series are empty", func() {
|
|
|
+ ctx.series = tsdb.TimeSeriesSlice{
|
|
|
+ tsdb.NewTimeSeries("test1", [][2]*float64{}),
|
|
|
+ tsdb.NewTimeSeries("test2", [][2]*float64{}),
|
|
|
+ }
|
|
|
+ ctx.exec()
|
|
|
+
|
|
|
+ So(ctx.result.Error, ShouldBeNil)
|
|
|
+ So(ctx.result.NoDataFound, ShouldBeTrue)
|
|
|
+ })
|
|
|
+
|
|
|
+ Convey("Should not set NoDataFound if one serie is empty", func() {
|
|
|
+ one := float64(120)
|
|
|
+ two := float64(0)
|
|
|
+ ctx.series = tsdb.TimeSeriesSlice{
|
|
|
+ tsdb.NewTimeSeries("test1", [][2]*float64{}),
|
|
|
+ tsdb.NewTimeSeries("test2", [][2]*float64{{&one, &two}}),
|
|
|
+ }
|
|
|
+ ctx.exec()
|
|
|
+
|
|
|
+ So(ctx.result.Error, ShouldBeNil)
|
|
|
+ So(ctx.result.NoDataFound, ShouldBeFalse)
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
})
|
|
|
}
|