From 99f836a1abe847a166a316691b02f42746399ca4 Mon Sep 17 00:00:00 2001 From: Rahul Gupta Date: Mon, 21 Aug 2023 17:37:58 +0530 Subject: [PATCH] feat: address review comments --- cmd/tools/grafana/dashboard_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/tools/grafana/dashboard_test.go b/cmd/tools/grafana/dashboard_test.go index acc0f1c13..d7d151b39 100644 --- a/cmd/tools/grafana/dashboard_test.go +++ b/cmd/tools/grafana/dashboard_test.go @@ -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() @@ -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",