Skip to content

Commit

Permalink
enhance: allow uses to disable broker heartbeats by not providing a t…
Browse files Browse the repository at this point in the history
…imeout (#1997,#1998)
  • Loading branch information
FrankK-1234 authored and auvipy committed Jun 1, 2024
1 parent cddc500 commit 83ad620
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions t/unit/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,27 @@ def se(*args, **kwargs):
c.connection.drain_events.side_effect = se
with pytest.raises(socket.error):
next(it)
c.connection.heartbeat_check.assert_called()

def test_consume_drain_no_heartbeat_check(self):
c, Acons, Bcons = self._context()
c.should_stop = False
it = c.consume(no_ack=True, timeout=None)

def se(*args, **kwargs):
c.should_stop = True
raise socket.timeout()
c.connection.drain_events.side_effect = se
with pytest.raises(StopIteration):
next(it)
c.connection.heartbeat_check.assert_not_called()

it = c.consume(no_ack=True, timeout=0)
c.connection.drain_events.side_effect = se
with pytest.raises(StopIteration):
next(it)
c.connection.heartbeat_check.assert_not_called()


def test_Consumer_context(self):
c, Acons, Bcons = self._context()
Expand Down

0 comments on commit 83ad620

Please sign in to comment.