summaryrefslogtreecommitdiff
path: root/test/test_producer.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_producer.py')
-rw-r--r--test/test_producer.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/test/test_producer.py b/test/test_producer.py
index b57dfd8..627178d 100644
--- a/test/test_producer.py
+++ b/test/test_producer.py
@@ -53,15 +53,29 @@ class TestKafkaProducer(unittest.TestCase):
assert client.send_produce_request.called
@patch('kafka.producer.base.Process')
- def test_producer_batch_send_queue_overfilled(self, process_mock):
+ def test_producer_async_queue_overfilled_batch_send(self, process_mock):
queue_size = 2
producer = Producer(MagicMock(), batch_send=True,
- batch_send_queue_maxsize=queue_size)
+ async_queue_maxsize=queue_size)
topic = b'test-topic'
partition = 0
+ message = b'test-message'
+
+ with self.assertRaises(BatchQueueOverfilledError):
+ message_list = [message] * (queue_size + 1)
+ producer.send_messages(topic, partition, *message_list)
+ @patch('kafka.producer.base.Process')
+ def test_producer_async_queue_overfilled(self, process_mock):
+ queue_size = 2
+ producer = Producer(MagicMock(), async=True,
+ async_queue_maxsize=queue_size)
+
+ topic = b'test-topic'
+ partition = 0
message = b'test-message'
+
with self.assertRaises(BatchQueueOverfilledError):
message_list = [message] * (queue_size + 1)
producer.send_messages(topic, partition, *message_list)