From 4b6a042e4a4e97a916cef47b1b7e2cedd8146e3b Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Sun, 10 May 2026 16:40:11 +0200 Subject: [PATCH] jfjoch_test: Fix TCPImagePusherTest to ensure it is more stable --- tests/TCPImagePusherTest.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/TCPImagePusherTest.cpp b/tests/TCPImagePusherTest.cpp index 6c675824..7b558518 100644 --- a/tests/TCPImagePusherTest.cpp +++ b/tests/TCPImagePusherTest.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only #include +#include #include #include "../image_pusher/TCPStreamPusher.h" @@ -425,7 +426,10 @@ TEST_CASE("TCPImageCommTest_AutoPort_StarBind", "[TCP]") { TCPStreamPusher pusher("tcp://127.0.0.1:*", 1); TCPImagePuller puller(pusher.GetAddress()[0], 64 * 1024 * 1024); - std::thread receiver([&] { + std::this_thread::sleep_for(std::chrono::seconds(2)); + REQUIRE(pusher.GetConnectedWriters() == 1); + + std::future receiver = std::async(std::launch::async, [&] { bool seen_end = false; uint64_t processed = 0; @@ -474,7 +478,7 @@ TEST_CASE("TCPImageCommTest_AutoPort_StarBind", "[TCP]") { } REQUIRE(pusher.EndDataCollection(end)); - receiver.join(); + REQUIRE_NOTHROW(receiver.get()); puller.Disconnect(); }