From 432f00eb669550c75fa75e8efa56d5d80cda18a5 Mon Sep 17 00:00:00 2001 From: Harel Ben-Attia Date: Tue, 28 Feb 2017 20:13:28 +0200 Subject: Fail-fast on timeout constraint violations during KafkaConsumer creation (#986) --- test/test_consumer.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/test_consumer.py') diff --git a/test/test_consumer.py b/test/test_consumer.py index f3dad16..073a3af 100644 --- a/test/test_consumer.py +++ b/test/test_consumer.py @@ -16,6 +16,14 @@ class TestKafkaConsumer(unittest.TestCase): with self.assertRaises(AssertionError): SimpleConsumer(MagicMock(), 'group', 'topic', partitions = [ '0' ]) + def test_session_timeout_larger_than_request_timeout_raises(self): + with self.assertRaises(KafkaConfigurationError): + KafkaConsumer(bootstrap_servers='localhost:9092', session_timeout_ms=60000, request_timeout_ms=40000) + + def test_fetch_max_wait_larger_than_request_timeout_raises(self): + with self.assertRaises(KafkaConfigurationError): + KafkaConsumer(bootstrap_servers='localhost:9092', fetch_max_wait_ms=41000, request_timeout_ms=40000) + class TestMultiProcessConsumer(unittest.TestCase): @unittest.skipIf(sys.platform.startswith('win'), 'test mocking fails on windows') -- cgit v1.2.1