Mock client.ready() call to test coordinator offset fetch request
This commit is contained in:
@@ -563,7 +563,8 @@ class ConsumerCoordinator(BaseCoordinator):
|
||||
|
||||
# Verify node is ready
|
||||
if not self._client.ready(node_id):
|
||||
log.debug("Node %s not ready -- failing offset fetch request")
|
||||
log.debug("Node %s not ready -- failing offset fetch request",
|
||||
node_id)
|
||||
return Future().failure(Errors.NodeNotReadyError)
|
||||
|
||||
log.debug("Fetching committed offsets for partitions: %s", partitions)
|
||||
|
@@ -385,6 +385,7 @@ def patched_coord(mocker, coordinator):
|
||||
coordinator.coordinator_id = 0
|
||||
mocker.patch.object(coordinator._client, 'least_loaded_node',
|
||||
return_value=1)
|
||||
mocker.patch.object(coordinator._client, 'ready', return_value=True)
|
||||
mocker.patch.object(coordinator._client, 'send')
|
||||
mocker.spy(coordinator, '_failed_request')
|
||||
mocker.spy(coordinator, '_handle_offset_commit_response')
|
||||
|
Reference in New Issue
Block a user