Repository: NetApp/harvest
Pull request #1849 (2023-03-22 19:37:44)

feat: Harvest should turn dashboard refresh off


Patch:
diff --git a/grafana/dashboards/cmode/aggregate.json b/grafana/dashboards/cmode/aggregate.json
index e9418326..a08106e7 100644
--- a/grafana/dashboards/cmode/aggregate.json
+++ b/grafana/dashboards/cmode/aggregate.json
@@ -4255,7 +4255,7 @@
       "type": "row"
     }
   ],
-  "refresh": "1m",
+  "refresh": "",
   "schemaVersion": 30,
   "style": "dark",
   "tags": [
diff --git a/grafana/dashboards/cmode/lun.json b/grafana/dashboards/cmode/lun.json
index 55e92eb5..9864a7f1 100644
--- a/grafana/dashboards/cmode/lun.json
+++ b/grafana/dashboards/cmode/lun.json
@@ -4473,7 +4473,7 @@
       "type": "row"
     }
   ],
-  "refresh": "1m",
+  "refresh": "",
   "schemaVersion": 30,
   "style": "dark",
   "tags": [
diff --git a/grafana/dashboards/cmode/metadata.json b/grafana/dashboards/cmode/metadata.json
index c67d8bca..bc9a6b41 100644
--- a/grafana/dashboards/cmode/metadata.json
+++ b/grafana/dashboards/cmode/metadata.json
@@ -4030,7 +4030,7 @@
       "type": "row"
     }
   ],
-  "refresh": "1m",
+  "refresh": "",
   "schemaVersion": 30,
   "style": "dark",
   "tags": [
diff --git a/grafana/dashboards/cmode/nfs4storePool.json b/grafana/dashboards/cmode/nfs4storePool.json
index 4d1fe344..b00265f0 100644
--- a/grafana/dashboards/cmode/nfs4storePool.json
+++ b/grafana/dashboards/cmode/nfs4storePool.json
@@ -2003,7 +2003,7 @@
       "type": "row"
     }
   ],
-  "refresh": false,
+  "refresh": "",
   "schemaVersion": 30,
   "style": "dark",
   "tags": [
diff --git a/grafana/dashboards/cmode/node.json b/grafana/dashboards/cmode/node.json
index 454f1397..ab5fd98d 100644
--- a/grafana/dashboards/cmode/node.json
+++ b/grafana/dashboards/cmode/node.json
@@ -4618,7 +4618,7 @@
       "type": "row"
     }
   ],
-  "refresh": false,
+  "refresh": "",
   "schemaVersion": 30,
   "style": "dark",
   "tags": [
diff --git a/grafana/dashboards/cmode/qtree.json b/grafana/dashboards/cmode/qtree.json
index d7f3c224..a2cf2bd3 100644
--- a/grafana/dashboards/cmode/qtree.json
+++ b/grafana/dashboards/cmode/qtree.json
@@ -722,7 +722,7 @@
       "type": "row"
     }
   ],
-  "refresh": false,
+  "refresh": "",
   "schemaVersion": 30,
   "style": "dark",
   "tags": [
diff --git a/grafana/dashboards/cmode/shelf.json b/grafana/dashboards/cmode/shelf.json
index 0768cc93..ddcf7dec 100644
--- a/grafana/dashboards/cmode/shelf.json
+++ b/grafana/dashboards/cmode/shelf.json
@@ -1844,7 +1844,7 @@
       "type": "row"
     }
   ],
-  "refresh": "1m",
+  "refresh": "",
   "schemaVersion": 30,
   "style": "dark",
   "tags": [
diff --git a/grafana/dashboards/cmode/snapmirror.json b/grafana/dashboards/cmode/snapmirror.json
index 9989ef69..11efee77 100644
--- a/grafana/dashboards/cmode/snapmirror.json
+++ b/grafana/dashboards/cmode/snapmirror.json
@@ -4399,7 +4399,7 @@
       "type": "row"
     }
   ],
-  "refresh": "1m",
+  "refresh": "",
   "schemaVersion": 30,
   "style": "dark",
   "tags": [
diff --git a/grafana/dashboards/cmode/volume.json b/grafana/dashboards/cmode/volume.json
index 6bdfe319..facd6b8c 100644
--- a/grafana/dashboards/cmode/volume.json
+++ b/grafana/dashboards/cmode/volume.json
@@ -5176,7 +5176,7 @@
       "type": "row"
     }
   ],
-  "refresh": "1m",
+  "refresh": "",
   "schemaVersion": 30,
   "style": "dark",
   "tags": [
diff --git a/grafana/dashboards/cmode/workload.json b/grafana/dashboards/cmode/workload.json
index 410d5837..fc690188 100644
--- a/grafana/dashboards/cmode/workload.json
+++ b/grafana/dashboards/cmode/workload.json
@@ -1874,7 +1874,7 @@
       "type": "timeseries"
     }
   ],
-  "refresh": "1m",
+  "refresh": "",
   "schemaVersion": 30,
   "style": "dark",
   "tags": [


Test patch:
diff --git a/cmd/tools/grafana/dashboard_test.go b/cmd/tools/grafana/dashboard_test.go
index 99420a0a..34f30ba2 100644
--- a/cmd/tools/grafana/dashboard_test.go
+++ b/cmd/tools/grafana/dashboard_test.go
@@ -839,3 +839,21 @@ func checkPercentHasMinMax(t *testing.T, path string, data []byte) {
 		}
 	})
 }
+
+func TestRefreshIsOff(t *testing.T) {
+	visitDashboards(
+		[]string{"../../../grafana/dashboards/cmode", "../../../grafana/dashboards/storagegrid"},
+		func(path string, data []byte) {
+			checkDashboardRefresh(t, shortPath(path), data)
+		},
+	)
+}
+
+func checkDashboardRefresh(t *testing.T, path string, data []byte) {
+	gjson.GetBytes(data, "refresh").ForEach(func(key, value gjson.Result) bool {
+		if value.String() != "" {
+			t.Errorf(`dashboard=%s, got refresh=%s, want refresh="" (off)`, path, value.String())
+		}
+		return true
+	})
+}