|
20 | 20 |
|
21 | 21 |
|
22 | 22 | import random |
23 | | -import threading |
24 | | -import logging |
25 | 23 | from typing import Optional |
26 | 24 | from unittest import TestCase, main |
27 | 25 | import time |
@@ -1529,34 +1527,6 @@ def test_json_schema_encode(self): |
1529 | 1527 | self.assertEqual(first_encode, second_encode) |
1530 | 1528 |
|
1531 | 1529 |
|
1532 | | - def test_logger_thread_leaks(self): |
1533 | | - def _do_connect(close): |
1534 | | - logger = logging.getLogger(str(threading.current_thread().ident)) |
1535 | | - logger.setLevel(logging.INFO) |
1536 | | - client = pulsar.Client( |
1537 | | - service_url="pulsar://localhost:6650", |
1538 | | - io_threads=4, |
1539 | | - message_listener_threads=4, |
1540 | | - operation_timeout_seconds=1, |
1541 | | - log_conf_file_path=None, |
1542 | | - authentication=None, |
1543 | | - logger=logger, |
1544 | | - ) |
1545 | | - client.get_topic_partitions("persistent://public/default/partitioned_topic_name_test") |
1546 | | - if close: |
1547 | | - client.close() |
1548 | | - |
1549 | | - for should_close in (True, False): |
1550 | | - self.assertEqual(threading.active_count(), 1, "Explicit close: {}; baseline is 1 thread".format(should_close)) |
1551 | | - _do_connect(should_close) |
1552 | | - self.assertEqual(threading.active_count(), 1, "Explicit close: {}; synchronous connect doesn't leak threads".format(should_close)) |
1553 | | - threads = [] |
1554 | | - for _ in range(10): |
1555 | | - threads.append(threading.Thread(target=_do_connect, args=(should_close))) |
1556 | | - threads[-1].start() |
1557 | | - for thread in threads: |
1558 | | - thread.join() |
1559 | | - assert threading.active_count() == 1, "Explicit close: {}; threaded connect in parallel doesn't leak threads".format(should_close) |
1560 | 1530 |
|
1561 | 1531 | def test_chunking(self): |
1562 | 1532 | client = Client(self.serviceUrl) |
|
0 commit comments