Skip to content

Commit 42a995a

Browse files
committed
[tests] Remove rpc_zmq.py
rpc_zmq.py is racy and fails intermittently. Remove that test file and move the getzmqnotifications RPC test into interface_zmq.py
1 parent f504a14 commit 42a995a

File tree

3 files changed

+13
-41
lines changed

3 files changed

+13
-41
lines changed

test/functional/interface_zmq.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
)
1515
from io import BytesIO
1616

17+
ADDRESS = "tcp://127.0.0.1:28332"
1718

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

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

6666
self.extra_args = [
67-
["-zmqpub%s=%s" % (sub.topic.decode(), address) for sub in [self.hashblock, self.hashtx, self.rawblock, self.rawtx]],
67+
["-zmqpub%s=%s" % (sub.topic.decode(), ADDRESS) for sub in [self.hashblock, self.hashtx, self.rawblock, self.rawtx]],
6868
[],
6969
]
7070
self.add_nodes(self.num_nodes, self.extra_args)
@@ -117,5 +117,15 @@ def _zmq_test(self):
117117
hex = self.rawtx.receive()
118118
assert_equal(payment_txid, bytes_to_hex_str(hash256(hex)))
119119

120+
self.log.info("Test the getzmqnotifications RPC")
121+
assert_equal(self.nodes[0].getzmqnotifications(), [
122+
{"type": "pubhashblock", "address": ADDRESS},
123+
{"type": "pubhashtx", "address": ADDRESS},
124+
{"type": "pubrawblock", "address": ADDRESS},
125+
{"type": "pubrawtx", "address": ADDRESS},
126+
])
127+
128+
assert_equal(self.nodes[1].getzmqnotifications(), [])
129+
120130
if __name__ == '__main__':
121131
ZMQTest().main()

test/functional/rpc_zmq.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

test/functional/test_runner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@
152152
'feature_versionbits_warning.py',
153153
'rpc_preciousblock.py',
154154
'wallet_importprunedfunds.py',
155-
'rpc_zmq.py',
156155
'rpc_signmessage.py',
157156
'feature_nulldummy.py',
158157
'mempool_accept.py',

0 commit comments

Comments
 (0)