Skip to content

Commit

Permalink
Add a test for Issue #135 (Spurious ConsumerFetchSizeTooSmall error)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dana Powers committed Aug 27, 2014
1 parent d107420 commit 67dd121
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/test_consumer_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,25 @@ def test_offset_behavior__resuming_behavior(self):
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
Expand Down

0 comments on commit 67dd121

Please sign in to comment.