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
Keep E2E validation isolated from rate limits
pulse-triage[bot]10550628f95c
diff --git a/internal/api/rate_limit_config.go b/internal/api/rate_limit_config.goindex 89e14735fa..575364fc53 100644--- a/internal/api/rate_limit_config.go+++ b/internal/api/rate_limit_config.go@@ -2,11 +2,17 @@ package apiimport ("net/http"+ "os""strconv""strings""time")+const (+ defaultGeneralAPIRateLimit = 500+ maxDevGeneralAPIRateLimit = 100000+)+// EndpointRateLimitConfig defines rate limiting configuration for different endpoint categoriestype EndpointRateLimitConfig struct {AuthEndpoints *RateLimiter // Login, logout, password change@@ -41,14 +47,28 @@ func newEndpointRateLimitConfig() *EndpointRateLimitConfig {// WebSocket connections: per-connection limitsWebSocketEndpoints: NewRateLimiter(30, 1*time.Minute), // 30 new connections per minute- // General API: higher limits for normal operations- GeneralAPI: NewRateLimiter(500, 1*time.Minute), // 500 requests per minute+ // General API: higher limits for normal operations. Browser E2E runs can+ // explicitly raise this in PULSE_DEV because many isolated test sessions+ // share one Docker bridge address; production always keeps the default.+ GeneralAPI: NewRateLimiter(generalAPIRateLimit(), 1*time.Minute),// Public endpoints: very high limits (health checks, etc.)PublicEndpoints: NewRateLimiter(1000, 1*time.Minute), // 1000 requests per minute}}+func generalAPIRateLimit() int {+ if os.Getenv("PULSE_DEV") != "true" {+ return defaultGeneralAPIRateLimit+ }++ configured, err := strconv.Atoi(strings.TrimSpace(os.Getenv("PULSE_DEV_GENERAL_API_RATE_LIMIT")))+ if err != nil || configured < defaultGeneralAPIRateLimit || configured > maxDevGeneralAPIRateLimit {+ return defaultGeneralAPIRateLimit+ }+ return configured+}+func ensureGlobalRateLimitConfig() *EndpointRateLimitConfig {if globalRateLimitConfig == nil {InitializeRateLimiters()diff --git a/internal/api/rate_limit_config_test.go b/internal/api/rate_limit_config_test.goindex 525c9de172..6f81451df2 100644--- a/internal/api/rate_limit_config_test.go+++ b/internal/api/rate_limit_config_test.go@@ -7,6 +7,32 @@ import ("testing")+func TestGeneralAPIRateLimitDevelopmentOverride(t *testing.T) {+ tests := []struct {+ name string+ devMode string+ configured string+ want int+ }{+ {name: "default", want: defaultGeneralAPIRateLimit},+ {name: "production ignores override", configured: "5000", want: defaultGeneralAPIRateLimit},+ {name: "development accepts bounded override", devMode: "true", configured: "5000", want: 5000},+ {name: "development rejects lower limit", devMode: "true", configured: "499", want: defaultGeneralAPIRateLimit},+ {name: "development rejects excessive limit", devMode: "true", configured: "100001", want: defaultGeneralAPIRateLimit},+ {name: "development rejects malformed limit", devMode: "true", configured: "many", want: defaultGeneralAPIRateLimit},+ }++ for _, tt := range tests {+ t.Run(tt.name, func(t *testing.T) {+ t.Setenv("PULSE_DEV", tt.devMode)+ t.Setenv("PULSE_DEV_GENERAL_API_RATE_LIMIT", tt.configured)+ if got := generalAPIRateLimit(); got != tt.want {+ t.Fatalf("generalAPIRateLimit() = %d, want %d", got, tt.want)+ }+ })+ }+}+func TestGetRateLimiterForEndpoint(t *testing.T) {// Ensure rate limiters are initializedInitializeRateLimiters()diff --git a/tests/integration/docker-compose.test.yml b/tests/integration/docker-compose.test.ymlindex 4693778261..c8bddec06e 100644--- a/tests/integration/docker-compose.test.yml+++ b/tests/integration/docker-compose.test.yml@@ -86,6 +86,10 @@ services:# Dev-only endpoints the suite depends on (first-run reset in the# first-session specs) are gated on development mode.- PULSE_DEV=true+ # Each shard's isolated browser sessions share one Docker bridge IP.+ # Keep production's universal limit intact while preventing that synthetic+ # aggregation from starving later tests in this development-only stack.+ - PULSE_DEV_GENERAL_API_RATE_LIMIT=5000- PULSE_MULTI_TENANT_ENABLED=${PULSE_MULTI_TENANT_ENABLED:-false}- PULSE_ALLOW_DOCKER_UPDATES=true- PULSE_UPDATE_STAGE_DELAY_MS=250diff --git a/tests/integration/tests/65-offline-proxmox-node-visibility.spec.ts b/tests/integration/tests/65-offline-proxmox-node-visibility.spec.tsindex feb8f426a5..08eea0eb6d 100644--- a/tests/integration/tests/65-offline-proxmox-node-visibility.spec.ts+++ b/tests/integration/tests/65-offline-proxmox-node-visibility.spec.ts@@ -263,8 +263,14 @@ test.describe("Offline Proxmox node visibility", () => {expect(linkBox!.width).toBeGreaterThanOrEqual(24);expect(linkBox!.height).toBeGreaterThanOrEqual(24);- // Opening the adjacent control must not bubble into the selectable row.- await expect(offlineRow).toHaveAttribute("aria-expanded", "false");+ // Opening the adjacent control must not toggle the row's native+ // disclosure button. The static table row intentionally owns no+ // keyboard or expanded-state semantics.+ const disclosureButton = offlineRow.getByRole("button", {+ name: "Expand details for Disaster Recovery B",+ });+ expect(await offlineRow.getAttribute("aria-expanded")).toBeNull();+ await expect(disclosureButton).toHaveAttribute("aria-expanded", "false");const webInterfaceUrl = await webInterfaceLink.getAttribute("href");expect(webInterfaceUrl).toBeTruthy();const popupPromise = page.context().waitForEvent("page");@@ -273,7 +279,7 @@ test.describe("Offline Proxmox node visibility", () => {await popup.waitForLoadState("domcontentloaded");expect(popup.url()).toBe(`${webInterfaceUrl}/`);await popup.close();- await expect(offlineRow).toHaveAttribute("aria-expanded", "false");+ await expect(disclosureButton).toHaveAttribute("aria-expanded", "false");}const viewportContainment = await page.evaluate(() => ({