Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix(tests): update reporting handlers tests to match new signature

rcourtman2e4e7b06a868
diff --git a/internal/api/reporting_handlers_test.go b/internal/api/reporting_handlers_test.go
index c04bab0f80..e31828a4ea 100644
--- a/internal/api/reporting_handlers_test.go
+++ b/internal/api/reporting_handlers_test.go
@@ -28,7 +28,7 @@ func (s *stubReportingEngine) Generate(req reporting.MetricReportRequest) ([]byt
}
func TestReportingHandlers_MethodNotAllowed(t *testing.T) {
- handler := NewReportingHandlers()
+ handler := NewReportingHandlers(nil)
req := httptest.NewRequest(http.MethodPost, "/api/reporting", nil)
rr := httptest.NewRecorder()
@@ -44,7 +44,7 @@ func TestReportingHandlers_EngineUnavailable(t *testing.T) {
reporting.SetEngine(nil)
t.Cleanup(func() { reporting.SetEngine(original) })
- handler := NewReportingHandlers()
+ handler := NewReportingHandlers(nil)
req := httptest.NewRequest(http.MethodGet, "/api/reporting?resourceType=node&resourceId=1", nil)
rr := httptest.NewRecorder()
@@ -69,7 +69,7 @@ func TestReportingHandlers_InvalidFormatAndParams(t *testing.T) {
reporting.SetEngine(engine)
t.Cleanup(func() { reporting.SetEngine(original) })
- handler := NewReportingHandlers()
+ handler := NewReportingHandlers(nil)
req := httptest.NewRequest(http.MethodGet, "/api/reporting?format=txt&resourceType=node&resourceId=1", nil)
rr := httptest.NewRecorder()
@@ -92,7 +92,7 @@ func TestReportingHandlers_GenerateReport(t *testing.T) {
reporting.SetEngine(engine)
t.Cleanup(func() { reporting.SetEngine(original) })
- handler := NewReportingHandlers()
+ handler := NewReportingHandlers(nil)
start := time.Now().Add(-2 * time.Hour).UTC().Format(time.RFC3339)
end := time.Now().UTC().Format(time.RFC3339)