Skip to content

Commit

Permalink
[tests] Remove rpc_zmq.py
Browse files Browse the repository at this point in the history
rpc_zmq.py is racy and fails intermittently. Remove that test file and
move the getzmqnotifications RPC test into interface_zmq.py
  • Loading branch information
jnewbery committed Oct 7, 2018
1 parent f504a14 commit 42a995a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 41 deletions.
16 changes: 13 additions & 3 deletions test/functional/interface_zmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
)
from io import BytesIO

ADDRESS = "tcp://127.0.0.1:28332"

class ZMQSubscriber:
def __init__(self, socket, topic):
Expand Down Expand Up @@ -51,11 +52,10 @@ def setup_nodes(self):
# that this test fails if the publishing order changes.
# Note that the publishing order is not defined in the documentation and
# is subject to change.
address = "tcp://127.0.0.1:28332"
self.zmq_context = zmq.Context()
socket = self.zmq_context.socket(zmq.SUB)
socket.set(zmq.RCVTIMEO, 60000)
socket.connect(address)
socket.connect(ADDRESS)

# Subscribe to all available topics.
self.hashblock = ZMQSubscriber(socket, b"hashblock")
Expand All @@ -64,7 +64,7 @@ def setup_nodes(self):
self.rawtx = ZMQSubscriber(socket, b"rawtx")

self.extra_args = [
["-zmqpub%s=%s" % (sub.topic.decode(), address) for sub in [self.hashblock, self.hashtx, self.rawblock, self.rawtx]],
["-zmqpub%s=%s" % (sub.topic.decode(), ADDRESS) for sub in [self.hashblock, self.hashtx, self.rawblock, self.rawtx]],
[],
]
self.add_nodes(self.num_nodes, self.extra_args)
Expand Down Expand Up @@ -117,5 +117,15 @@ def _zmq_test(self):
hex = self.rawtx.receive()
assert_equal(payment_txid, bytes_to_hex_str(hash256(hex)))

self.log.info("Test the getzmqnotifications RPC")
assert_equal(self.nodes[0].getzmqnotifications(), [
{"type": "pubhashblock", "address": ADDRESS},
{"type": "pubhashtx", "address": ADDRESS},
{"type": "pubrawblock", "address": ADDRESS},
{"type": "pubrawtx", "address": ADDRESS},
])

assert_equal(self.nodes[1].getzmqnotifications(), [])

if __name__ == '__main__':
ZMQTest().main()
37 changes: 0 additions & 37 deletions test/functional/rpc_zmq.py

This file was deleted.

1 change: 0 additions & 1 deletion test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
'feature_versionbits_warning.py',
'rpc_preciousblock.py',
'wallet_importprunedfunds.py',
'rpc_zmq.py',
'rpc_signmessage.py',
'feature_nulldummy.py',
'mempool_accept.py',
Expand Down

0 comments on commit 42a995a

Please sign in to comment.