Kaynağa Gözat

feat(testdata): added test case for ms resolution data

Torkel Ödegaard 9 yıl önce
ebeveyn
işleme
460160cfa4

+ 2 - 3
pkg/tsdb/testdata/scenarios.go

@@ -28,8 +28,8 @@ func init() {
 		Name: "Random Walk",
 
 		Handler: func(query *tsdb.Query, context *tsdb.QueryContext) *tsdb.QueryResult {
-			timeWalkerMs := context.TimeRange.MustGetFrom().Unix() * 1000
-			to := context.TimeRange.MustGetTo().Unix() * 1000
+			to := context.TimeRange.MustGetTo().UnixNano() / int64(time.Millisecond)
+			timeWalkerMs := context.TimeRange.MustGetFrom().UnixNano() / int64(time.Millisecond)
 
 			series := newSeriesForQuery(query)
 
@@ -81,7 +81,6 @@ func init() {
 			return queryRes
 		},
 	})
-
 }
 
 func registerScenario(scenario *Scenario) {

+ 95 - 20
public/app/plugins/app/testdata/dashboards/graph_last_1h.json

@@ -1,5 +1,5 @@
 {
-  "revision": 2,
+  "revision": 3,
   "title": "TestData - Graph Panel Last 1h",
   "tags": [
     "grafana-test"
@@ -35,6 +35,7 @@
           },
           "lines": true,
           "linewidth": 2,
+          "links": [],
           "nullPointMode": "connected",
           "percentage": false,
           "pointradius": 5,
@@ -48,8 +49,8 @@
             {
               "refId": "A",
               "scenario": "random_walk",
-              "target": "",
-              "scenarioId": "no_data_points"
+              "scenarioId": "no_data_points",
+              "target": ""
             }
           ],
           "thresholds": [],
@@ -86,8 +87,7 @@
               "min": null,
               "show": true
             }
-          ],
-          "links": []
+          ]
         },
         {
           "aliasColors": {},
@@ -109,6 +109,7 @@
           },
           "lines": true,
           "linewidth": 2,
+          "links": [],
           "nullPointMode": "connected",
           "percentage": false,
           "pointradius": 5,
@@ -122,8 +123,8 @@
             {
               "refId": "A",
               "scenario": "random_walk",
-              "target": "",
-              "scenarioId": "datapoints_outside_range"
+              "scenarioId": "datapoints_outside_range",
+              "target": ""
             }
           ],
           "thresholds": [],
@@ -160,17 +161,89 @@
               "min": null,
               "show": true
             }
+          ]
+        },
+        {
+          "aliasColors": {},
+          "bars": false,
+          "datasource": "Grafana TestData",
+          "editable": true,
+          "error": false,
+          "fill": 1,
+          "id": 3,
+          "isNew": true,
+          "legend": {
+            "avg": false,
+            "current": false,
+            "max": false,
+            "min": false,
+            "show": true,
+            "total": false,
+            "values": false
+          },
+          "lines": true,
+          "linewidth": 2,
+          "links": [],
+          "nullPointMode": "connected",
+          "percentage": false,
+          "pointradius": 5,
+          "points": false,
+          "renderer": "flot",
+          "seriesOverrides": [],
+          "span": 4,
+          "stack": false,
+          "steppedLine": false,
+          "targets": [
+            {
+              "refId": "A",
+              "scenario": "random_walk",
+              "scenarioId": "random_walk",
+              "target": ""
+            }
           ],
-          "links": []
+          "thresholds": [],
+          "timeFrom": null,
+          "timeShift": null,
+          "title": "Random walk series",
+          "tooltip": {
+            "msResolution": false,
+            "shared": true,
+            "sort": 0,
+            "value_type": "cumulative"
+          },
+          "type": "graph",
+          "xaxis": {
+            "mode": "time",
+            "name": null,
+            "show": true,
+            "values": []
+          },
+          "yaxes": [
+            {
+              "format": "short",
+              "label": null,
+              "logBase": 1,
+              "max": null,
+              "min": null,
+              "show": true
+            },
+            {
+              "format": "short",
+              "label": null,
+              "logBase": 1,
+              "max": null,
+              "min": null,
+              "show": true
+            }
+          ]
         }
       ],
       "title": "New row"
     },
     {
-      "title": "New row",
-      "height": "250px",
-      "editable": true,
       "collapse": false,
+      "editable": true,
+      "height": "250px",
       "panels": [
         {
           "aliasColors": {},
@@ -179,7 +252,7 @@
           "editable": true,
           "error": false,
           "fill": 1,
-          "id": 3,
+          "id": 4,
           "isNew": true,
           "legend": {
             "avg": false,
@@ -192,6 +265,7 @@
           },
           "lines": true,
           "linewidth": 2,
+          "links": [],
           "nullPointMode": "connected",
           "percentage": false,
           "pointradius": 5,
@@ -205,14 +279,14 @@
             {
               "refId": "A",
               "scenario": "random_walk",
-              "target": "",
-              "scenarioId": "random_walk"
+              "scenarioId": "random_walk",
+              "target": ""
             }
           ],
           "thresholds": [],
-          "timeFrom": null,
+          "timeFrom": "5d",
           "timeShift": null,
-          "title": "Random walk series",
+          "title": "Millisecond res x-axis and tooltip",
           "tooltip": {
             "msResolution": false,
             "shared": true,
@@ -243,14 +317,14 @@
               "min": null,
               "show": true
             }
-          ],
-          "links": []
+          ]
         }
-      ]
+      ],
+      "title": "New row"
     }
   ],
   "time": {
-    "from": "now-6h",
+    "from": "now-1h",
     "to": "now"
   },
   "timepicker": {
@@ -284,6 +358,7 @@
   "annotations": {
     "list": []
   },
+  "refresh": false,
   "schemaVersion": 13,
   "version": 4,
   "links": [],

+ 1 - 1
public/app/plugins/app/testdata/plugin.json

@@ -9,7 +9,7 @@
       "name": "Grafana Project",
       "url": "http://grafana.org"
     },
-    "version": "1.0.5",
+    "version": "1.0.6",
     "updated": "2016-09-26"
   },