From 3596c39e49a7779d5c3ea8aa6fcfb9fb1c41f58b Mon Sep 17 00:00:00 2001 From: Chris Grindstaff Date: Wed, 7 Dec 2022 14:17:02 -0500 Subject: [PATCH] test: ensure dashboards use spanNull = true --- cmd/tools/grafana/dashboard_test.go | 21 +++++++++++++++++++++ grafana/dashboards/cmode/headroom.json | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/cmd/tools/grafana/dashboard_test.go b/cmd/tools/grafana/dashboard_test.go index aba22cb5f..7ce9269ab 100644 --- a/cmd/tools/grafana/dashboard_test.go +++ b/cmd/tools/grafana/dashboard_test.go @@ -619,3 +619,24 @@ func checkLegendCalculations(t *testing.T, gotLegendCalculations []string, dashP } } } + +func TestConnectNullValues(t *testing.T) { + dir := "../../../grafana/dashboards/cmode" + visitDashboards(dir, func(path string, data []byte) { + checkConnectNullValues(t, path, data) + }) +} + +func checkConnectNullValues(t *testing.T, path string, data []byte) { + dashPath := shortPath(path) + + visitAllPanels(data, func(path string, key, value gjson.Result) { + spanNulls := value.Get("fieldConfig.defaults.custom.spanNulls") + if !spanNulls.Exists() { + return + } + if !spanNulls.Bool() { + t.Errorf(`dashboard=%s panel="%s got=[%s] want=true`, dashPath, value.Get("title").String(), spanNulls.String()) + } + }) +} diff --git a/grafana/dashboards/cmode/headroom.json b/grafana/dashboards/cmode/headroom.json index 4c7cb4315..dd6c9d69a 100644 --- a/grafana/dashboards/cmode/headroom.json +++ b/grafana/dashboards/cmode/headroom.json @@ -112,7 +112,7 @@ "type": "linear" }, "showPoints": "auto", - "spanNulls": false, + "spanNulls": true, "stacking": { "group": "A", "mode": "none" @@ -199,7 +199,7 @@ "type": "linear" }, "showPoints": "auto", - "spanNulls": false, + "spanNulls": true, "stacking": { "group": "A", "mode": "none" @@ -2545,5 +2545,5 @@ "timezone": "", "title": "ONTAP: Headroom", "uid": "", - "version": 5 + "version": 6 }