Add a multi-thread producer test case (#102)
diff --git a/dev-requirements.txt b/dev-requirements.txt
index 08d8b97..c96c923 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -17,3 +17,4 @@
pytest-timeout
pytest-faulthandler
pytest-cov
+futures; python_version < '3'
diff --git a/tests/test_producer.py b/tests/test_producer.py
index ee71ac8..311bf71 100644
--- a/tests/test_producer.py
+++ b/tests/test_producer.py
@@ -16,6 +16,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+from concurrent.futures import ThreadPoolExecutor
import time
import threading
import sys
@@ -34,6 +35,16 @@
assert ret.status == SendStatus.OK
+def test_producer_send_sync_multi_thread(producer):
+ executor = ThreadPoolExecutor(max_workers=5)
+ futures = []
+ for _ in range(5):
+ futures.append(executor.submit(test_producer_send_sync, producer))
+
+ for future in futures:
+ _ret = future.result()
+
+
def test_producer_send_oneway(producer):
msg = Message('test')
msg.set_keys('send_oneway')