diff options
author | Dana Powers <dana.powers@gmail.com> | 2016-02-18 22:56:05 -0800 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2016-02-19 07:56:44 -0800 |
commit | 29e96f82ce0b028c21dc35fed2f4c26da4c8efef (patch) | |
tree | c08580892a550ab479858deb8f817d11b1e5408c | |
parent | 6a2466b4d9616c328660301a875c4d199430b251 (diff) | |
download | kafka-python-29e96f82ce0b028c21dc35fed2f4c26da4c8efef.tar.gz |
Mock client.ready() call to test coordinator offset fetch request
-rw-r--r-- | kafka/coordinator/consumer.py | 3 | ||||
-rw-r--r-- | test/test_coordinator.py | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/kafka/coordinator/consumer.py b/kafka/coordinator/consumer.py index e7a687e..0e610c7 100644 --- a/kafka/coordinator/consumer.py +++ b/kafka/coordinator/consumer.py @@ -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) diff --git a/test/test_coordinator.py b/test/test_coordinator.py index e0906c7..94e0e66 100644 --- a/test/test_coordinator.py +++ b/test/test_coordinator.py @@ -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') |