From 38e75c8e5bf0834cfc7ddd8c0432a9ea4691b4ae Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sat, 17 Oct 2026 09:06:54 +0200 Subject: [PATCH] HDF5Writer_Socket: wait for the subscription before the first file is announced The test connected its SUB socket and wrote at once; file 1 is closed and announced on the PUB socket right after the second image, and PUB drops whatever it sends before the subscription has reached it (slow joiner). On a loaded CI runner the first notification was lost and the test read file 2 where it expected file 1. Wait 2 s after subscribing, as the preview and metadata socket tests already do. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PXc1zD1yxHqaR1DGdCTHL4 --- tests/HDF5WritingTest.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/HDF5WritingTest.cpp b/tests/HDF5WritingTest.cpp index bc18fc1a3..23e9fabb7 100644 --- a/tests/HDF5WritingTest.cpp +++ b/tests/HDF5WritingTest.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "../common/DiffractionExperiment.h" #include "../writer/HDF5Objects.h" @@ -573,6 +574,10 @@ TEST_CASE("HDF5Writer_Socket", "[HDF5][Full]") { s.SubscribeAll(); s.ReceiveTimeout(std::chrono::seconds(5)); + // PUB drops what it sends before the subscription has reached it, and the first file is closed + // (and announced) right after the second image - ensure sub socket is properly connected + std::this_thread::sleep_for(std::chrono::seconds(2)); + for (int i = 0; i < x.GetImageNum(); i++) { DataMessage message{}; message.image = CompressedImage(image, x.GetXPixelsNum(), x.GetYPixelsNum());