No unit tests for transport modules (TCP, SSH, TLS) #55

Closed
opened 2026-07-20 17:14:08 +02:00 by TapTap · 0 comments
Owner

Description

The following transport modules have no dedicated unit tests:

  • src/shared/transport_tcp.c — TCP socket creation, binding, accepting, connecting, cleanup
  • src/shared/transport_ssh.c — SSH destination parsing, socketpair, fork/exec of ssh
  • src/shared/transport_tls.c — SSL context creation, certificate loading, TLS handshake

These modules contain complex logic (network I/O, forking, SSL) that would benefit from testing. The lack of tests means regressions in connectivity or security setup may go undetected.

Location

src/shared/transport_tcp.c, src/shared/transport_ssh.c, src/shared/transport_tls.c

Suggested Fix

Add unit tests for at least:

  1. transport_tcp.c: server_create() validation, client_create() validation, boundary cases
  2. transport_ssh.c: parse_remote_dest() for valid/invalid SSH destinations, edge cases
  3. transport_tls.c: SSL context creation with valid/invalid certificates (can use self-signed test certs)

For SSH and TLS, consider mocking the network layer or using loopback/localhost tests that don't require external dependencies.

Severity

Medium

Category

Quality

## Description The following transport modules have no dedicated unit tests: - `src/shared/transport_tcp.c` — TCP socket creation, binding, accepting, connecting, cleanup - `src/shared/transport_ssh.c` — SSH destination parsing, socketpair, fork/exec of ssh - `src/shared/transport_tls.c` — SSL context creation, certificate loading, TLS handshake These modules contain complex logic (network I/O, forking, SSL) that would benefit from testing. The lack of tests means regressions in connectivity or security setup may go undetected. ## Location `src/shared/transport_tcp.c`, `src/shared/transport_ssh.c`, `src/shared/transport_tls.c` ## Suggested Fix Add unit tests for at least: 1. `transport_tcp.c`: `server_create()` validation, `client_create()` validation, boundary cases 2. `transport_ssh.c`: `parse_remote_dest()` for valid/invalid SSH destinations, edge cases 3. `transport_tls.c`: SSL context creation with valid/invalid certificates (can use self-signed test certs) For SSH and TLS, consider mocking the network layer or using loopback/localhost tests that don't require external dependencies. ## Severity Medium ## Category Quality
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#55