mirror of
https://github.com/prymitive/karma
synced 2026-08-17 11:27:01 +00:00
chore(tests): add more asserts in metrics tests
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user