test(metrics): improve test coverage (#7538)

Add more unit tests for metrics plugin, around registration
deduplication, zone management, restart/shutdown behavior and
context helpers.

Increases test coverage from 54.8% to 76.1%.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
Ville Vesilehto
2025-09-14 01:15:25 +03:00
committed by GitHub
parent a72a14d88b
commit ba7d5ff55a
2 changed files with 95 additions and 0 deletions

View File

@@ -40,3 +40,10 @@ func TestPrometheusParse(t *testing.T) {
}
}
}
func TestSetupBasic(t *testing.T) {
c := caddy.NewTestController("dns", "prometheus localhost:9153")
if err := setup(c); err != nil {
t.Fatalf("setup returned error: %v", err)
}
}