diff --git a/main_test.go b/main_test.go index dafd23e21..d4a7e4266 100644 --- a/main_test.go +++ b/main_test.go @@ -3,6 +3,7 @@ package main import ( "net/http" "net/http/httptest" + "strings" "testing" "github.com/prymitive/karma/internal/config" @@ -39,4 +40,15 @@ func TestMetrics(t *testing.T) { if resp.Code != http.StatusOK { t.Errorf("GET /metrics returned status %d", resp.Code) } + body := resp.Body.String() + for _, s := range []string{ + "karma_collected_alerts_count", + "karma_collected_alerts_count", + "karma_collect_cycles_total", + "karma_alertmanager_errors_total", + } { + if !strings.Contains(body, s) { + t.Errorf("Metric '%s' missing from /metrics response", s) + } + } }