problem: test_xpub_manual is flapping

The test assumed the subscriptions are arrived in some order, but occasionally the order is not as expected

Solution: fix it
This commit is contained in:
Doron Somech 2020-05-13 23:02:47 +03:00
parent e7f0090b16
commit ad3b36ab95
2 changed files with 17 additions and 10 deletions

View File

@ -297,11 +297,6 @@ void test_missing_subscriptions ()
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sub1, my_endpoint_backend));
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub1, ZMQ_SUBSCRIBE, topic1, 1));
// second subscriber
void *sub2 = test_context_socket (ZMQ_SUB);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sub2, my_endpoint_backend));
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub2, ZMQ_SUBSCRIBE, topic2, 1));
// wait
msleep (SETTLE_TIME);
@ -312,6 +307,14 @@ void test_missing_subscriptions ()
zmq_setsockopt (xpub_proxy, ZMQ_SUBSCRIBE, topic1, 1));
send_array_expect_success (xsub_proxy, subscription1, 0);
// second subscriber
void *sub2 = test_context_socket (ZMQ_SUB);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sub2, my_endpoint_backend));
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub2, ZMQ_SUBSCRIBE, topic2, 1));
// wait
msleep (SETTLE_TIME);
const uint8_t subscription2[] = {1, static_cast<uint8_t> (topic2[0])};
recv_array_expect_success (xpub_proxy, subscription2, ZMQ_DONTWAIT);
TEST_ASSERT_SUCCESS_ERRNO (

View File

@ -303,11 +303,6 @@ void test_missing_subscriptions ()
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sub1, my_endpoint_backend));
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub1, ZMQ_SUBSCRIBE, topic1, 1));
// second subscriber
void *sub2 = test_context_socket (ZMQ_SUB);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sub2, my_endpoint_backend));
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub2, ZMQ_SUBSCRIBE, topic2, 1));
// wait
msleep (SETTLE_TIME);
@ -318,6 +313,15 @@ void test_missing_subscriptions ()
zmq_setsockopt (xpub_proxy, ZMQ_SUBSCRIBE, topic1, 1));
send_array_expect_success (xsub_proxy, subscription1, 0);
// second subscriber
void *sub2 = test_context_socket (ZMQ_SUB);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sub2, my_endpoint_backend));
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub2, ZMQ_SUBSCRIBE, topic2, 1));
// wait
msleep (SETTLE_TIME);
// proxy now reroutes and confirms subscriptions
const uint8_t subscription2[] = {1, static_cast<uint8_t> (topic2[0])};
recv_array_expect_success (xpub_proxy, subscription2, ZMQ_DONTWAIT);
TEST_ASSERT_SUCCESS_ERRNO (