Testing: transport layer has 0% unit test coverage (TCP, TLS, SSH) #131

Closed
opened 2026-07-21 16:26:50 +02:00 by TapTap · 0 comments
Owner

The three transport modules have zero code coverage from unit tests:

  • transport_tcp.c — 0% (111 lines, all uncovered)
  • transport_tls.c — 0% (94 lines, all uncovered)
  • transport_ssh.c — 0% (106 lines, all uncovered)

All functions are completely untested: server_create, client_connect, accept_loop, create_ssl_ctx, wrap_fd_with_ssl, client_connect_tls, parse_remote_dest, client_connect_ssh, etc.

Root cause

Test files exist (test_transport_tcp.c, test_transport_ssh.c, test_transport_tls.c) but they either:

  • Skip tests conditionally (e.g., require SSH binary, TLS certs)
  • Only test trivial helper functions
  • Are empty/dummy placeholders

Suggested fix

  1. Make transport tests self-contained by creating loopback connections (use socketpair for TCP, mock SSL for TLS, fork+exec for SSH)
  2. Add tests for:
    • server_create + client_connect with loopback
    • set_socket_timeouts with various values
    • parse_remote_dest with valid/invalid SSH destinations
    • create_ssl_ctx with/without CA cert
    • wrap_fd_with_ssl basic wrapping
  3. Run transport tests in CI even without SSH/TLS infrastructure using loopback and self-signed certs

Labels: testing, coverage, transport

The three transport modules have **zero code coverage** from unit tests: - `transport_tcp.c` — 0% (111 lines, all uncovered) - `transport_tls.c` — 0% (94 lines, all uncovered) - `transport_ssh.c` — 0% (106 lines, all uncovered) All functions are completely untested: `server_create`, `client_connect`, `accept_loop`, `create_ssl_ctx`, `wrap_fd_with_ssl`, `client_connect_tls`, `parse_remote_dest`, `client_connect_ssh`, etc. ## Root cause Test files exist (`test_transport_tcp.c`, `test_transport_ssh.c`, `test_transport_tls.c`) but they either: - Skip tests conditionally (e.g., require SSH binary, TLS certs) - Only test trivial helper functions - Are empty/dummy placeholders ## Suggested fix 1. Make transport tests self-contained by creating loopback connections (use socketpair for TCP, mock SSL for TLS, fork+exec for SSH) 2. Add tests for: - `server_create` + `client_connect` with loopback - `set_socket_timeouts` with various values - `parse_remote_dest` with valid/invalid SSH destinations - `create_ssl_ctx` with/without CA cert - `wrap_fd_with_ssl` basic wrapping 3. Run transport tests in CI even without SSH/TLS infrastructure using loopback and self-signed certs **Labels**: testing, coverage, transport
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#131