Mock client.ready() call to test coordinator offset fetch request

This commit is contained in:
Dana Powers
2016-02-18 22:56:05 -08:00
parent 6a2466b4d9
commit 29e96f82ce
2 changed files with 3 additions and 1 deletions

View File

@@ -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)

View File

@@ -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')