Skip to content

test(http): expand websocket_server.cpp coverage to 70%/50% #1124

Description

@kcenon

What

Expand unit test coverage for http/websocket_server.cpp from current 39.9% line / 19.7% branch to >=70% line / >=50% branch.

Part of #953.

Why

  • File is 308 LOC. WebSocket server has many protocol-level branches (frame types, control frames, fragmented messages) that are typically under-tested.
  • v1.0 readiness gate requires >=80% line coverage ecosystem-wide (see Prepare network_system for v1.0 release #964).

Where

  • Source: http/websocket_server.cpp (308 LOC)
  • Tests: tests/unit/http/

How

Approach

  1. Audit existing websocket_server tests for uncovered branches.
  2. Add tests for control frames: PING/PONG, CLOSE with various status codes, unsolicited control frames.
  3. Add tests for fragmented messages: continuation frames, interleaved control frames between fragments, max fragment size.
  4. Add tests for protocol violations: invalid opcodes, masked-from-server frames, payload size violations, RSV bit misuse.
  5. Add tests for connection lifecycle: handshake failures, abrupt disconnects, idle timeout.
  6. Re-run coverage workflow to verify thresholds met.

Acceptance Criteria

  • http/websocket_server.cpp line coverage >= 70%
  • http/websocket_server.cpp branch coverage >= 50%
  • All new tests pass on Ubuntu/macOS/Windows CI
  • All sanitizer builds (ASAN, TSAN, UBSAN) pass
  • Coverage workflow re-measurement attached as a comment on this issue

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions