diff --git a/tests/TCPImagePusherTest.cpp b/tests/TCPImagePusherTest.cpp index 9b04c63d..021b49ab 100644 --- a/tests/TCPImagePusherTest.cpp +++ b/tests/TCPImagePusherTest.cpp @@ -510,6 +510,11 @@ TEST_CASE("TCPImageCommTest_DisconnectMidWrite_NoHang", "[TCP]") { TCPStreamPusher pusher("tcp://127.0.0.1:*", 1); TCPImagePuller puller(pusher.GetAddress()[0], 64 * 1024 * 1024); + // Wait for the puller to connect before starting data collection + for (int attempt = 0; attempt < 100 && pusher.GetConnectedWriters() < 1; ++attempt) + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + REQUIRE(pusher.GetConnectedWriters() == 1); + std::thread receiver([&] { bool disconnected = false; while (!disconnected) {