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 CI test drift and SSE idle race

rcourtman55db13fc068a
diff --git a/internal/api/ai_handlers.go b/internal/api/ai_handlers.go
index 78010e2cf6..041b1510ad 100644
--- a/internal/api/ai_handlers.go
+++ b/internal/api/ai_handlers.go
@@ -3477,12 +3477,13 @@ func (s *legacyAssistantSSEWriter) startHeartbeat(ctx context.Context) {
}
func (s *legacyAssistantSSEWriter) startIdleProgress(ctx context.Context) {
- if chatStreamIdleProgressInterval <= 0 {
+ interval := chatStreamIdleProgressInterval
+ if interval <= 0 {
return
}
go func() {
- ticker := time.NewTicker(chatStreamIdleProgressInterval)
+ ticker := time.NewTicker(interval)
defer ticker.Stop()
for {
select {
@@ -3500,7 +3501,7 @@ func (s *legacyAssistantSSEWriter) startIdleProgress(ctx context.Context) {
return
}
lastEventAt := time.UnixMilli(s.lastClientEventUnixMS.Load())
- if time.Since(lastEventAt) < chatStreamIdleProgressInterval {
+ if time.Since(lastEventAt) < interval {
continue
}
progressEvent := ai.StreamEvent{
diff --git a/internal/monitoring/mock_metrics_history_test.go b/internal/monitoring/mock_metrics_history_test.go
index c191ea566d..14f0054141 100644
--- a/internal/monitoring/mock_metrics_history_test.go
+++ b/internal/monitoring/mock_metrics_history_test.go
@@ -764,9 +764,9 @@ func TestSeedMockMetricsHistory_UsesCanonicalMockFixtureGraphForLegacyAndProvide
sampleInterval := time.Minute
historyRetention := boundedMockHistoryProofWindow
if raceEnabled {
- seedDuration = 5 * time.Minute
+ seedDuration = 3 * time.Hour
sampleInterval = time.Minute
- historyRetention = 10 * time.Minute
+ historyRetention = 3 * time.Hour
}
cfg := metrics.DefaultConfig(t.TempDir())
diff --git a/scripts/tests/test-hot-dev-bg.sh b/scripts/tests/test-hot-dev-bg.sh
index 247aa3f910..18fa5c0fca 100755
--- a/scripts/tests/test-hot-dev-bg.sh
+++ b/scripts/tests/test-hot-dev-bg.sh
@@ -707,7 +707,13 @@ test_makefile_routes_managed_runtime_through_npm() {
test_hot_dev_script_advertises_foreground_escape_hatch() {
local output
- output="$(sed -n '1,40p' "${HOT_DEV}")"
+ output="$(
+ awk '
+ NR == 1 { print; next }
+ /^#/ || /^$/ { print; next }
+ { exit }
+ ' "${HOT_DEV}"
+ )"
assert_contains "hot-dev header identifies foreground escape hatch" "${output}" "hot-dev.sh - Foreground Pulse dev runtime escape hatch"
assert_contains "hot-dev usage points to managed runtime first" "${output}" "npm run dev # Canonical managed dev runtime"
@@ -821,7 +827,7 @@ test_hot_dev_health_monitor_probes_api_health() {
local output
output="$(cat "${HOT_DEV}")"
- assert_contains "hot-dev health monitor declares a configurable unhealthy streak threshold" "${output}" 'UNHEALTHY_THRESHOLD="${HOT_DEV_BACKEND_UNHEALTHY_THRESHOLD:-2}"'
+ assert_contains "hot-dev health monitor declares a configurable unhealthy streak threshold" "${output}" 'UNHEALTHY_THRESHOLD="${HOT_DEV_BACKEND_UNHEALTHY_THRESHOLD:-4}"'
assert_contains "hot-dev health monitor declares backend startup grace" "${output}" 'BACKEND_HEALTH_STARTUP_GRACE_SECONDS="${HOT_DEV_BACKEND_HEALTH_STARTUP_GRACE_SECONDS:-180}"'
assert_contains "hot-dev health monitor declares missing-process grace" "${output}" 'BACKEND_PROCESS_MISSING_GRACE_SECONDS="${HOT_DEV_BACKEND_PROCESS_MISSING_GRACE_SECONDS:-10}"'
assert_contains "hot-dev health monitor tracks backend restart time through a shared marker" "${output}" 'BACKEND_STARTED_AT_FILE="${HOT_DEV_BACKEND_STARTED_AT_FILE:-${ROOT_DIR}/tmp/hot-dev.backend.started-at}"'