Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Ensure all dashboard heatmaps use the same colorScheme and style #1884

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -871,3 +871,36 @@ func checkDashboardRefresh(t *testing.T, path string, data []byte) {
return true
})
}

func TestHeatmapSettings(t *testing.T) {
visitDashboards(
[]string{"../../../grafana/dashboards/cmode", "../../../grafana/dashboards/storagegrid"},
func(path string, data []byte) {
checkHeatmapSettings(t, shortPath(path), data)
},
)
}

func checkHeatmapSettings(t *testing.T, path string, data []byte) {
dashPath := shortPath(path)
const (
wantColorScheme = "interpolateRdYlGn"
wantColorMode = "spectrum"
)
visitAllPanels(data, func(path string, key, value gjson.Result) {
panelType := value.Get("type").String()
if panelType != "heatmap" {
return
}
colorScheme := value.Get("color.colorScheme").String()
colorMode := value.Get("color.mode").String()
if colorScheme != wantColorScheme {
t.Errorf(`dashboard=%s path=%s panel="%s" got color.scheme=%s, want=%s`,
dashPath, path, value.Get("title").String(), colorScheme, wantColorScheme)
}
if colorMode != wantColorMode {
t.Errorf(`dashboard=%s path=%s panel="%s" got color.mode=%s, want=%s`,
dashPath, path, value.Get("title").String(), colorMode, wantColorMode)
}
})
}
8 changes: 4 additions & 4 deletions grafana/dashboards/storagegrid/overview.json
Original file line number Diff line number Diff line change
Expand Up @@ -1995,9 +1995,9 @@
"color": {
"cardColor": "#b4ff00",
"colorScale": "sqrt",
"colorScheme": "interpolateTurbo",
"colorScheme": "interpolateRdYlGn",
"exponent": 0.5,
"mode": "opacity"
"mode": "spectrum"
},
"dataFormat": "tsbuckets",
"datasource": "${DS_PROMETHEUS}",
Expand Down Expand Up @@ -2061,9 +2061,9 @@
"color": {
"cardColor": "#b4ff00",
"colorScale": "sqrt",
"colorScheme": "interpolateTurbo",
"colorScheme": "interpolateRdYlGn",
"exponent": 0.5,
"mode": "opacity"
"mode": "spectrum"
},
"dataFormat": "tsbuckets",
"datasource": "${DS_PROMETHEUS}",
Expand Down
5 changes: 1 addition & 4 deletions pkg/conf/conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,7 @@ func TestFlowStyle(t *testing.T) {

func TestUniqueExportersByType(t *testing.T) {
path := "../../cmd/tools/doctor/testdata/testConfig.yml"
err := LoadHarvestConfig(path)
if err != nil {
panic(err)
}
TestLoadHarvestConfig(path)
poller2, _ := PollerNamed("overlapping")
t.Run("Exporters are unique by type", func(t *testing.T) {
exporters := GetUniqueExporters(poller2.Exporters)
Expand Down