You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split the 962-line monolithic tests/unit_tests.cpp into per-concern files using a shared fixture base for the existing TCP messaging_server/messaging_client flow.
tests/unit_tests_original.cpp (572 lines, separate cleanup decision)
The non-TCP test files under tests/test_*.cpp and tests/unit/ (already split)
Why
Parallel test execution is currently disabled because the monolithic file's hard-coded ports collide. Splitting into per-concern files plus a fixture that requests an OS-assigned ephemeral port (:0) lets ctest -j N run safely and lets failures localize to the file under test.
Where
tests/unit_tests.cpp (split source)
tests/support/ (new TCP messaging fixture)
tests/CMakeLists.txt (register new executables)
How
Technical approach
Add tests/support/messaging_loopback_fixture.{h,cpp} — a GTest fixture that:
Each new file uses the fixture base; ports come from the fixture, never literals.
Update tests/CMakeLists.txt — register one add_executable per file, link network_system + GTest::gtest_main + Threads + test_support, register each via add_test.
Delete tests/unit_tests.cpp after successful migration.
Acceptance criteria
No port literals remain in the new test files (verified by grep)
ctest -j 8 passes locally and on CI without flakes (3 consecutive green runs)
tests/unit_tests.cpp removed
All 22 TEST_F + 2 TEST cases preserved (no behavior loss)
What
Split the 962-line monolithic
tests/unit_tests.cppinto per-concern files using a shared fixture base for the existing TCPmessaging_server/messaging_clientflow.Part of #1083.
Current state
tests/unit_tests.cpp— 962 lines, 22TEST_F(NetworkTest, ...)cases plus 2 freeTEST(NetworkStressTest, ...)cases, all reusing one ad-hocNetworkTestfixture that hard-codes ports.tests/CMakeLists.txtalready disables suite-level registration:# Don't add suite-level test to prevent port conflicts during parallel execution.tests/support/hermetic_transport_fixture(Issue infra: hermetic transport fixture for HTTP/2 / QUIC / WebSocket / gRPC unit tests #1060) exists but is wired for HTTP/2, gRPC, QUIC, WebSocket — not the plain TCPmessaging_*flow used byNetworkTest.Out of scope
tests/unit_tests_original.cpp(572 lines, separate cleanup decision)tests/test_*.cppandtests/unit/(already split)Why
Parallel test execution is currently disabled because the monolithic file's hard-coded ports collide. Splitting into per-concern files plus a fixture that requests an OS-assigned ephemeral port (
:0) letsctest -j Nrun safely and lets failures localize to the file under test.Where
tests/unit_tests.cpp(split source)tests/support/(new TCP messaging fixture)tests/CMakeLists.txt(register new executables)How
Technical approach
tests/support/messaging_loopback_fixture.{h,cpp}— a GTest fixture that:messaging_serverbound to127.0.0.1:0,TearDown().unit_tests.cppinto roughly:tests/unit/messaging_server_lifecycle_test.cpp(ServerConstruction/StartStop/PortInUse/DoubleStart)tests/unit/messaging_client_lifecycle_test.cpp(ClientConstruction/ConnectToNonExistentServer/SendWithoutConnection)tests/unit/messaging_transfer_test.cpp(BasicMessageTransfer/LargeMessageTransfer/MultipleMessageTransfer)tests/unit/messaging_session_test.cpp(ServerStopWhileClientsConnected/CleanupDeadSessions/WaitForStop*)tests/unit/messaging_id_test.cpp(ServerIdReturnsConstructorValue/EmptyStringIsValid/SetAndGetMonitor)tests/stress/messaging_stress_test.cpp(RapidConnectionDisconnection, ConcurrentClients)tests/CMakeLists.txt— register oneadd_executableper file, linknetwork_system + GTest::gtest_main + Threads + test_support, register each viaadd_test.tests/unit_tests.cppafter successful migration.Acceptance criteria
ctest -j 8passes locally and on CI without flakes (3 consecutive green runs)tests/unit_tests.cppremovedTEST_F+ 2TESTcases preserved (no behavior loss)