aboutsummaryrefslogtreecommitdiff
path: root/src/protocol
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-01-13 17:27:39 -0800
committerGarrett D'Amore <garrett@damore.org>2020-01-13 17:27:39 -0800
commit01247035ba347af651719864f0b95ee06b561e53 (patch)
tree3da7ad6a740e7a189ed6d247cfb5c7b63dd4a76c /src/protocol
parent1f7c978359296c237e4e0e3cbb7f0592a408c3b6 (diff)
downloadnng-01247035ba347af651719864f0b95ee06b561e53.tar.gz
nng-01247035ba347af651719864f0b95ee06b561e53.tar.bz2
nng-01247035ba347af651719864f0b95ee06b561e53.zip
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.
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/pubsub0/sub_test.c10
1 files changed, 7 insertions, 3 deletions
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