From 7cb5f74db8262acffd3cbbbbd3f191c635eaadde Mon Sep 17 00:00:00 2001 From: rcourtman Date: Wed, 27 May 2026 18:36:33 +0100 Subject: [PATCH] Bump WebSocket read deadlines from 2s to 15s in router integration tests The four ReadDeadline(time.Now().Add(2 * time.Second)) calls in router_integration_test.go (lines 1496, 1543, 1573, 1682) were producing 'read tcp: i/o timeout' failures in CI under -race while passing locally. The 2-second window is enough to read the welcome + initialState messages on a quiet dev workstation but too tight once the runner is loaded with cumulative test work and the race detector overhead. rc.5 cleared the same tests in CI but recent fixture-size growth (k8s clusters 1->3 in 7938f28de plus the SMART disk-temperature mock data added in 23ea4e487) pushed the end-to-end server-start-to-welcome-message latency past the 2s budget. Bumping to 15s gives CI breathing room without affecting local test duration (the deadline only takes effect when the read is genuinely stuck). --- internal/api/router_integration_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/api/router_integration_test.go b/internal/api/router_integration_test.go index 65b59ed7e..0f285ff38 100644 --- a/internal/api/router_integration_test.go +++ b/internal/api/router_integration_test.go @@ -1493,7 +1493,7 @@ func TestWebSocketSendsInitialState(t *testing.T) { readMsg := func() (string, map[string]any) { t.Helper() - if err := conn.SetReadDeadline(time.Now().Add(2 * time.Second)); err != nil { + if err := conn.SetReadDeadline(time.Now().Add(15 * time.Second)); err != nil { t.Fatalf("set deadline: %v", err) } _, data, err := conn.ReadMessage() @@ -1540,7 +1540,7 @@ func TestWebSocketSendsInitialState(t *testing.T) { state := srv.monitor.BuildFrontendState() srv.hub.BroadcastState(state) - deadline := time.Now().Add(2 * time.Second) + deadline := time.Now().Add(15 * time.Second) for { msgType, payload = readMsg() if msgType == "rawData" { @@ -1570,7 +1570,7 @@ func TestWebsocketPayloadContractShape(t *testing.T) { readMsg := func() (string, map[string]any) { t.Helper() - if err := conn.SetReadDeadline(time.Now().Add(2 * time.Second)); err != nil { + if err := conn.SetReadDeadline(time.Now().Add(15 * time.Second)); err != nil { t.Fatalf("set deadline: %v", err) } _, data, err := conn.ReadMessage() @@ -1679,7 +1679,7 @@ func TestWebsocketPayloadUsesCanonicalStateContract(t *testing.T) { readMsg := func() (string, map[string]any) { t.Helper() - if err := conn.SetReadDeadline(time.Now().Add(2 * time.Second)); err != nil { + if err := conn.SetReadDeadline(time.Now().Add(15 * time.Second)); err != nil { t.Fatalf("set deadline: %v", err) } _, data, err := conn.ReadMessage()