diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-01-23 22:33:48 +0100 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-02-09 22:54:01 +0100 |
commit | 8666033630eeaf851ec69e018bb53eb23093f4b9 (patch) | |
tree | 6f39c6844571062e7f244405a4de7c37942b460e /test/functional/interface_zmq.py | |
parent | 6014d6e1b5a0dda6e20c2721f0bdb7e6a63ece81 (diff) |
zmq test: accept arbitrary sequence start number in ZMQSubscriber
The ZMQSubscriber reception methods currently assert that the first
received publisher message has a sequence number of zero. In order to
fix the current test flakiness via "syncing up" to nodes in the setup
phase, we have to cope with the situation that messages get lost and the
first actual received message has a sequence number larger than zero.
Diffstat (limited to 'test/functional/interface_zmq.py')
-rwxr-xr-x | test/functional/interface_zmq.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/functional/interface_zmq.py b/test/functional/interface_zmq.py index 4c23c4d30c..527126fac3 100755 --- a/test/functional/interface_zmq.py +++ b/test/functional/interface_zmq.py @@ -27,7 +27,7 @@ def hash256_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 @@ -39,7 +39,11 @@ class ZMQSubscriber: # Topic should match the subscriber topic. assert_equal(topic, self.topic) # Sequence should be incremental. - assert_equal(struct.unpack('<I', seq)[-1], self.sequence) + received_seq = struct.unpack('<I', seq)[-1] + if self.sequence is None: + self.sequence = received_seq + else: + assert_equal(received_seq, self.sequence) self.sequence += 1 return body |