From 14e92b6b80736275a4cf88d97574e51230f3a513 Mon Sep 17 00:00:00 2001 From: Andrew Walker Date: Fri, 5 Jul 2024 04:21:44 -0700 Subject: [PATCH] Close persistent client connection at end of run (#13981) The persistent client connection increases our thread count beyond what this test expects. This commit closes it since the connection shouldn't be needed anymore by this point in the test run. --- tests/api2/test_zzz_tests_completed.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/api2/test_zzz_tests_completed.py b/tests/api2/test_zzz_tests_completed.py index 991ee67f94778..810ac9ccfb3ff 100644 --- a/tests/api2/test_zzz_tests_completed.py +++ b/tests/api2/test_zzz_tests_completed.py @@ -1,9 +1,16 @@ import faulthandler import threading +from middlewared.test.integration.utils.client import truenas_server + def test__thread_count(request): """Having outstanding threads can prevent python from exiting cleanly.""" + + # Tear down our persistent connection + truenas_server.client.close() + truenas_server._client = None + count = threading.active_count() if count > 1: faulthandler.dump_traceback()