From 7b0c725c594f9f0ee85c02dc20bd8adce7d9ac85 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sat, 23 Jan 2021 22:19:15 +0100 Subject: [PATCH] merge bitcoin#21008: fix zmq test flakiness, improve speed --- test/functional/interface_zmq.py | 76 +++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 22 deletions(-) diff --git a/test/functional/interface_zmq.py b/test/functional/interface_zmq.py index b7b3acdd65..2d11984ea5 100755 --- a/test/functional/interface_zmq.py +++ b/test/functional/interface_zmq.py @@ -33,28 +33,31 @@ def dashhash_reversed(byte_str): class ZMQSubscriber: def __init__(self, socket, topic): - self.sequence = 0 + self.sequence = None # no sequence number received yet self.socket = socket self.topic = topic self.socket.setsockopt(zmq.SUBSCRIBE, self.topic) - def receive(self): + # Receive message from publisher and verify that topic and sequence match + def _receive_from_publisher_and_check(self): topic, body, seq = self.socket.recv_multipart() # Topic should match the subscriber topic. assert_equal(topic, self.topic) # Sequence should be incremental. - assert_equal(struct.unpack('