Skip to content

Commit

Permalink
feat: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulguptajss committed Aug 21, 2023
1 parent 1b90e86 commit 99f836a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ func checkDashboardForDatasource(t *testing.T, path string, data []byte) {
// Check that the variable DS_PROMETHEUS exist
doesDsPromExist := false
// This is a list of names that are exempt from the check for a 'true' selected status.
excludedNames := []string{"TopResources", "Interval", "IncludeRoot"}
excludedNames := map[string]bool{
"TopResources": true,
"Interval": true,
"IncludeRoot": true,
}

gjson.GetBytes(data, "templating.list").ForEach(func(key, value gjson.Result) bool {
name := value.Get("name").String()
Expand All @@ -181,7 +185,7 @@ func checkDashboardForDatasource(t *testing.T, path string, data []byte) {
}
}

if !slices.Contains(excludedNames, name) {
if !excludedNames[name] {
if value.Get("current.selected").String() == "true" {
t.Errorf(
"dashboard=%s var=current.selected query want=false got=%s text=%s value=%s name= %s",
Expand Down

0 comments on commit 99f836a

Please sign in to comment.