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).
This commit is contained in:
rcourtman 2026-05-27 18:36:33 +01:00
parent 89a1740241
commit 7cb5f74db8

View file

@ -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()