Skip to content

Commit cc14522

Browse files
committed
added testdata scenario for null data and stacking, also updated testdata dashbord, grafana#2912
1 parent bf4c3f3 commit cc14522

File tree

4 files changed

+325
-72
lines changed

4 files changed

+325
-72
lines changed

pkg/tsdb/testdata/scenarios.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"strings"
77
"time"
88

9+
"gopkg.in/guregu/null.v3"
10+
911
"github.com/grafana/grafana/pkg/log"
1012
"github.com/grafana/grafana/pkg/tsdb"
1113
)
@@ -88,10 +90,13 @@ func init() {
8890
queryRes := tsdb.NewQueryResult()
8991

9092
stringInput := query.Model.Get("stringInput").MustString()
91-
values := []float64{}
93+
values := []null.Float{}
9294
for _, strVal := range strings.Split(stringInput, ",") {
95+
if strVal == "null" {
96+
values = append(values, null.FloatFromPtr(nil))
97+
}
9398
if val, err := strconv.ParseFloat(strVal, 64); err == nil {
94-
values = append(values, val)
99+
values = append(values, null.FloatFrom(val))
95100
}
96101
}
97102

@@ -105,7 +110,7 @@ func init() {
105110
step := (endTime - startTime) / int64(len(values)-1)
106111

107112
for _, val := range values {
108-
series.Points = append(series.Points, tsdb.NewTimePoint(val, float64(startTime)))
113+
series.Points = append(series.Points, tsdb.TimePoint{val, null.FloatFrom(float64(startTime))})
109114
startTime += step
110115
}
111116

0 commit comments

Comments
 (0)