metriccontract: read the moved dashboards and rendered rules

The metric reference test globbed dashboard/*.json and picked up the
rendered rules by walking contrib/mixin; both moved to contrib/.

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2026-10-17 19:32:56 +00:00
parent 273b12447a
commit 5368f8216e
+8 -2
View File
@@ -189,7 +189,7 @@ type reference struct {
}
// metricReferences returns the windows_ metric names in the collector
// documentation, the mixin sources and the generated dashboards.
// documentation, the mixin sources, the rendered rules and the generated dashboards.
func metricReferences(t *testing.T) []reference {
t.Helper()
@@ -209,11 +209,16 @@ func metricReferences(t *testing.T) []reference {
files = append(files, runbooks...)
dashboards, err := filepath.Glob(filepath.Join(repoRoot, "dashboard", "*.json"))
dashboards, err := filepath.Glob(filepath.Join(repoRoot, "contrib", "dashboard", "*.json"))
require.NoError(t, err)
files = append(files, dashboards...)
rules, err := filepath.Glob(filepath.Join(repoRoot, "contrib", "monitoring", "*.yaml"))
require.NoError(t, err)
files = append(files, rules...)
err = filepath.WalkDir(filepath.Join(repoRoot, "contrib", "mixin"), func(path string, entry fs.DirEntry, err error) error {
if err != nil {
return err
@@ -239,6 +244,7 @@ func metricReferences(t *testing.T) []reference {
require.NoError(t, err)
require.NotEmpty(t, docs)
require.NotEmpty(t, dashboards)
require.NotEmpty(t, rules)
var refs []reference