summaryrefslogtreecommitdiff
path: root/test/test_consumer_integration.py
diff options
context:
space:
mode:
authorhaosdent <haosdent@gmail.com>2015-06-20 20:04:57 +0800
committerhaosdent <haosdent@gmail.com>2015-06-20 20:04:57 +0800
commit2028a232098abeb89a8125e26abc4f4a379ef1b9 (patch)
treebb2f25e6e3c8a4ef88e05912ace92e95067f30b4 /test/test_consumer_integration.py
parent915a9ce0d1c565fcc16621f5abb46fda310c4552 (diff)
downloadkafka-python-2028a232098abeb89a8125e26abc4f4a379ef1b9.tar.gz
fix #410 SimpleConsumer cannot seek to an absolute offset.
Diffstat (limited to 'test/test_consumer_integration.py')
-rw-r--r--test/test_consumer_integration.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_consumer_integration.py b/test/test_consumer_integration.py
index df2eeea..52b3e85 100644
--- a/test/test_consumer_integration.py
+++ b/test/test_consumer_integration.py
@@ -164,6 +164,20 @@ class TestConsumerIntegration(KafkaIntegrationTestCase):
consumer.seek(-13, 2)
self.assert_message_count([ message for message in consumer ], 13)
+ # Set absolute offset
+ consumer.seek(100)
+ self.assert_message_count([ message for message in consumer ], 0)
+ consumer.seek(100, partition=0)
+ self.assert_message_count([ message for message in consumer ], 0)
+ consumer.seek(101, partition=1)
+ self.assert_message_count([ message for message in consumer ], 0)
+ consumer.seek(90, partition=0)
+ self.assert_message_count([ message for message in consumer ], 10)
+ consumer.seek(20, partition=1)
+ self.assert_message_count([ message for message in consumer ], 80)
+ consumer.seek(0, partition=1)
+ self.assert_message_count([ message for message in consumer ], 100)
+
consumer.stop()
@kafka_versions("all")