From 5c5e2791082a23018999ad38940374983b8867d4 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sat, 27 Jun 2020 18:26:09 +0100 Subject: [PATCH] Problem: test_req_relaxed occasionally fails Solution: instead of relying on timing to get the order of connected rep sockets just right, wait for each connection --- tests/test_req_relaxed.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/test_req_relaxed.cpp b/tests/test_req_relaxed.cpp index 7165ce91..3ec31dfa 100644 --- a/tests/test_req_relaxed.cpp +++ b/tests/test_req_relaxed.cpp @@ -27,8 +27,6 @@ along with this program. If not, see . */ -#include "testutil.hpp" - #include "testutil.hpp" #include "testutil_unity.hpp" @@ -63,11 +61,12 @@ void setUp () zmq_setsockopt (rep[peer], ZMQ_RCVTIMEO, &timeout, sizeof (int))); TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (rep[peer], my_endpoint)); + + // These tests require strict ordering, so wait for the connections to + // happen before opening the next, so that messages flow in the + // expected direction + msleep (SETTLE_TIME); } - // We have to give the connects time to finish otherwise the requests - // will not properly round-robin. We could alternatively connect the - // REQ sockets to the REP sockets. - msleep (SETTLE_TIME); } void tearDown ()