Skip to content

Commit 29e96f8

Browse files
committed
Mock client.ready() call to test coordinator offset fetch request
1 parent 6a2466b commit 29e96f8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

kafka/coordinator/consumer.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,8 @@ def _send_offset_fetch_request(self, partitions):
563563

564564
# Verify node is ready
565565
if not self._client.ready(node_id):
566-
log.debug("Node %s not ready -- failing offset fetch request")
566+
log.debug("Node %s not ready -- failing offset fetch request",
567+
node_id)
567568
return Future().failure(Errors.NodeNotReadyError)
568569

569570
log.debug("Fetching committed offsets for partitions: %s", partitions)

test/test_coordinator.py

+1
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ def patched_coord(mocker, coordinator):
385385
coordinator.coordinator_id = 0
386386
mocker.patch.object(coordinator._client, 'least_loaded_node',
387387
return_value=1)
388+
mocker.patch.object(coordinator._client, 'ready', return_value=True)
388389
mocker.patch.object(coordinator._client, 'send')
389390
mocker.spy(coordinator, '_failed_request')
390391
mocker.spy(coordinator, '_handle_offset_commit_response')

0 commit comments

Comments
 (0)