diff options
author | John Newbery <john@johnnewbery.com> | 2017-06-07 16:30:38 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2017-06-12 09:13:03 -0400 |
commit | b1bac1cb7ea1560b46ff758864660a21a228ed67 (patch) | |
tree | 9a219b38230b35c222d36ee5341bf867bd2064a4 | |
parent | 5ebd5f9e1528e8c185e83981007dd6198c7f73dd (diff) |
[tests] in zmq test, timeout if message not received
-rwxr-xr-x | test/functional/zmq_test.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/functional/zmq_test.py b/test/functional/zmq_test.py index fd7cbc05da..c1ffecc77b 100755 --- a/test/functional/zmq_test.py +++ b/test/functional/zmq_test.py @@ -36,6 +36,7 @@ class ZMQTest (BitcoinTestFramework): self.zmqContext = zmq.Context() self.zmqSubSocket = self.zmqContext.socket(zmq.SUB) + self.zmqSubSocket.set(zmq.RCVTIMEO, 60000) self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock") self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx") ip_address = "tcp://127.0.0.1:28332" @@ -94,11 +95,10 @@ class ZMQTest (BitcoinTestFramework): msg = self.zmqSubSocket.recv_multipart() topic = msg[0] body = msg[1] - hashZMQ = "" - if topic == b"hashtx": - hashZMQ = bytes_to_hex_str(body) - msgSequence = struct.unpack('<I', msg[-1])[-1] - assert_equal(msgSequence, blockcount + 1) + assert_equal(topic, b"hashtx") + hashZMQ = bytes_to_hex_str(body) + msgSequence = struct.unpack('<I', msg[-1])[-1] + assert_equal(msgSequence, blockcount + 1) assert_equal(hashRPC, hashZMQ) # txid from sendtoaddress must be equal to the hash received over zmq |