From 01247035ba347af651719864f0b95ee06b561e53 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 13 Jan 2020 17:27:39 -0800 Subject: Remove the old PUB/SUB tests. The new tests are more exhaustive, and cover everything. We also added a case for testing that posting messages that we didn't subscribe too doesn't raise the pollable flag. --- src/protocol/pubsub0/sub_test.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/protocol') diff --git a/src/protocol/pubsub0/sub_test.c b/src/protocol/pubsub0/sub_test.c index 4690ad23..3edf1d16 100644 --- a/src/protocol/pubsub0/sub_test.c +++ b/src/protocol/pubsub0/sub_test.c @@ -94,7 +94,7 @@ test_sub_poll_readable(void) TEST_NNG_PASS(nng_sub0_open(&sub)); TEST_NNG_PASS(nng_pub0_open(&pub)); - TEST_NNG_PASS(nng_setopt(sub, NNG_OPT_SUB_SUBSCRIBE, "", 0)); + TEST_NNG_PASS(nng_setopt(sub, NNG_OPT_SUB_SUBSCRIBE, "a", 1)); TEST_NNG_PASS(nng_setopt_ms(sub, NNG_OPT_RECVTIMEO, 1000)); TEST_NNG_PASS(nng_setopt_ms(pub, NNG_OPT_SENDTIMEO, 1000)); TEST_NNG_PASS(nng_getopt_int(sub, NNG_OPT_RECVFD, &fd)); @@ -107,11 +107,15 @@ test_sub_poll_readable(void) TEST_NNG_PASS(testutil_marry(pub, sub)); TEST_CHECK(testutil_pollfd(fd) == false); + // If we send a message we didn't subscribe to, that doesn't matter. + TEST_NNG_SEND_STR(pub, "def"); + testutil_sleep(100); + TEST_CHECK(testutil_pollfd(fd) == false); + // But once we send messages, it is. // We have to send a request, in order to send a reply. TEST_NNG_SEND_STR(pub, "abc"); - testutil_sleep(200); - + testutil_sleep(100); TEST_CHECK(testutil_pollfd(fd) == true); // and receiving makes it no longer ready -- cgit v1.2.3-70-g09d2