Skip to content

Commit

Permalink
Increased pubsub wait for response timeout to fix flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barshaul committed Nov 21, 2021
1 parent 78b48ea commit d5c14c8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ def test_cluster_pubsub_channels(self, r):
p = r.pubsub()
p.subscribe('foo', 'bar', 'baz', 'quux')
for i in range(4):
assert wait_for_message(p)['type'] == 'subscribe'
assert wait_for_message(p, timeout=0.5)['type'] == 'subscribe'
expected = [b'bar', b'baz', b'foo', b'quux']
assert all([channel in r.pubsub_channels(target_nodes='all')
for channel in expected])
Expand All @@ -792,14 +792,14 @@ def test_cluster_pubsub_numsub(self, r):
p1 = r.pubsub()
p1.subscribe('foo', 'bar', 'baz')
for i in range(3):
assert wait_for_message(p1)['type'] == 'subscribe'
assert wait_for_message(p1, timeout=0.5)['type'] == 'subscribe'
p2 = r.pubsub()
p2.subscribe('bar', 'baz')
for i in range(2):
assert wait_for_message(p2)['type'] == 'subscribe'
assert wait_for_message(p2, timeout=0.5)['type'] == 'subscribe'
p3 = r.pubsub()
p3.subscribe('baz')
assert wait_for_message(p3)['type'] == 'subscribe'
assert wait_for_message(p3, timeout=0.5)['type'] == 'subscribe'

channels = [(b'foo', 1), (b'bar', 2), (b'baz', 3)]
assert r.pubsub_numsub('foo', 'bar', 'baz', target_nodes='all') \
Expand Down

0 comments on commit d5c14c8

Please sign in to comment.