From 369f53b364352e2520fd451a579cbc429e7188e2 Mon Sep 17 00:00:00 2001 From: "E. Scott Daniels" Date: Wed, 2 Oct 2019 08:28:58 -0400 Subject: [PATCH] Correct unit test bug in rmr-python With RMR 1.8.x connections are forced to be asynch by default to prevent kubernetes blocking the attempt for minutes. However, the asynch nature of connections makes unit tests concerned with the ability to send and receive messages non-deterministic as some connections are established before the first message is sent, and others are not. This change ensures that unit tests establish connections in a synchronous manner which ensures that the first send will not be rejected by NNG due to a pending connection. Signed-off-by: E. Scott Daniels Change-Id: Ic72c48480d68e0aa8ba1bc0110b6222c3707ceaa --- src/bindings/rmr-python/setup.py | 2 +- src/bindings/rmr-python/tests/test_rmr.py | 6 +++--- src/bindings/rmr-python/tox.ini | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bindings/rmr-python/setup.py b/src/bindings/rmr-python/setup.py index 8679211..59368d4 100644 --- a/src/bindings/rmr-python/setup.py +++ b/src/bindings/rmr-python/setup.py @@ -32,7 +32,7 @@ def _long_descr(): setup( name="rmr", - version="0.13.0", + version="0.13.1", packages=find_packages(), author="Tommy Carpenter, E. Scott Daniels", description="Python wrapper for RIC RMR", diff --git a/src/bindings/rmr-python/tests/test_rmr.py b/src/bindings/rmr-python/tests/test_rmr.py index 87b6c94..dfc1364 100644 --- a/src/bindings/rmr-python/tests/test_rmr.py +++ b/src/bindings/rmr-python/tests/test_rmr.py @@ -150,7 +150,7 @@ def test_rmr_set_get(): def test_rcv_timeout(): """ test torcv; this is a scary test because if it fails... it doesn't fail, it will run forever! - We recieve a message (though nothing has been sent) and make sure the function doesn't block forever. + We receive a message (though nothing has been sent) and make sure the function doesn't block forever. There is no unit test for rmr_rcv_msg; too dangerous, that is a blocking call that may never return. """ @@ -185,12 +185,12 @@ def test_send_rcv(): assert send_summary["message status"] == rcv_summary["message status"] == "RMR_OK" # send an ACK back - ack_pay = b"message recieved" + ack_pay = b"message received" rmr.set_payload_and_length(ack_pay, sbuf_rcv) sbuf_rcv = rmr.rmr_rts_msg(MRC_RCV, sbuf_rcv) rcv_ack_summary = rmr.message_summary(sbuf_rcv) - # have the sender recieve it + # have the sender receive it sbuf_send = rmr.rmr_torcv_msg(MRC_SEND, sbuf_send, 2000) send_ack_summary = rmr.message_summary(sbuf_send) diff --git a/src/bindings/rmr-python/tox.ini b/src/bindings/rmr-python/tox.ini index f67ca14..aeac89e 100644 --- a/src/bindings/rmr-python/tox.ini +++ b/src/bindings/rmr-python/tox.ini @@ -25,6 +25,7 @@ deps= setenv = LD_LIBRARY_PATH = /usr/local/lib/:/usr/local/lib64 RMR_SEED_RT = tests/fixtures/test_local.rt + RMR_ASYNC_CONN = 0 commands=pytest --verbose --cov {envsitepackagesdir}/rmr --cov-report term-missing --cov-report html -- 2.16.6