summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDana Powers <dana.powers@rd.io>2014-08-26 23:03:53 -0700
committerDana Powers <dana.powers@rd.io>2014-08-26 23:03:53 -0700
commit67dd1214a4ae55a6c8ecb68446fc03ce682138e1 (patch)
treedd5c8854349cd0979fc420c4641b1f59acd8b1a5 /test
parentd107420bedc5c4ebdd8f53fd39883b88b7789ed4 (diff)
downloadkafka-python-67dd1214a4ae55a6c8ecb68446fc03ce682138e1.tar.gz
Add a test for Issue #135 (Spurious ConsumerFetchSizeTooSmall error)
Diffstat (limited to 'test')
-rw-r--r--test/test_consumer_integration.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_consumer_integration.py b/test/test_consumer_integration.py
index cb32669..44dafe4 100644
--- a/test/test_consumer_integration.py
+++ b/test/test_consumer_integration.py
@@ -240,6 +240,25 @@ class TestConsumerIntegration(KafkaIntegrationTestCase):
consumer1.stop()
consumer2.stop()
+ # TODO: Make this a unit test -- should not require integration
+ @kafka_versions("all")
+ def test_fetch_buffer_size(self):
+
+ # Test parameters (see issue 135 / PR 136)
+ TEST_MESSAGE_SIZE=1048
+ INIT_BUFFER_SIZE=1024
+ MAX_BUFFER_SIZE=2048
+ assert TEST_MESSAGE_SIZE > INIT_BUFFER_SIZE
+ assert TEST_MESSAGE_SIZE < MAX_BUFFER_SIZE
+ assert MAX_BUFFER_SIZE == 2 * INIT_BUFFER_SIZE
+
+ self.send_messages(0, [ "x" * 1048 ])
+ self.send_messages(1, [ "x" * 1048 ])
+
+ consumer = self.consumer(buffer_size=1024, max_buffer_size=2048)
+ messages = [ message for message in consumer ]
+ self.assertEquals(len(messages), 2)
+
def consumer(self, **kwargs):
if os.environ['KAFKA_VERSION'] == "0.8.0":
# Kafka 0.8.0 simply doesn't support offset requests, so hard code it being off