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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
test: Add handleHealth method tests
rcourtman24ae84671fad
diff --git a/internal/api/router_integration_test.go b/internal/api/router_integration_test.goindex 9921f35eb4..6bb5514e2c 100644--- a/internal/api/router_integration_test.go+++ b/internal/api/router_integration_test.go@@ -350,6 +350,46 @@ func TestServerInfoEndpointMethodNotAllowed(t *testing.T) {}}+func TestHealthEndpointMethodNotAllowed(t *testing.T) {+ srv := newIntegrationServer(t)++ for _, method := range []string{http.MethodPost, http.MethodPut, http.MethodDelete, http.MethodPatch} {+ req, err := http.NewRequest(method, srv.server.URL+"/api/health", nil)+ if err != nil {+ t.Fatalf("create request failed: %v", err)+ }++ res, err := http.DefaultClient.Do(req)+ if err != nil {+ t.Fatalf("health %s request failed: %v", method, err)+ }+ res.Body.Close()++ if res.StatusCode != http.StatusMethodNotAllowed {+ t.Errorf("%s: unexpected status: got %d want %d", method, res.StatusCode, http.StatusMethodNotAllowed)+ }+ }+}++func TestHealthEndpointHeadAllowed(t *testing.T) {+ srv := newIntegrationServer(t)++ req, err := http.NewRequest(http.MethodHead, srv.server.URL+"/api/health", nil)+ if err != nil {+ t.Fatalf("create request failed: %v", err)+ }++ res, err := http.DefaultClient.Do(req)+ if err != nil {+ t.Fatalf("health HEAD request failed: %v", err)+ }+ res.Body.Close()++ if res.StatusCode != http.StatusOK {+ t.Fatalf("HEAD: unexpected status: got %d want %d", res.StatusCode, http.StatusOK)+ }+}+func TestConfigNodesUsesMockTopology(t *testing.T) {srv := newIntegrationServer(t)