This is an automated email from the ASF dual-hosted git repository.

dcapwell pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b355b84c Python DTest does not release CQL connections, which can 
cause containers to hang for 2 hours trying to connect to a server thats 
already gone
b355b84c is described below

commit b355b84c5f7b53d390822332215e3751df562559
Author: David Capwell <dcapw...@apache.org>
AuthorDate: Wed Nov 15 13:09:06 2023 -0500

    Python DTest does not release CQL connections, which can cause containers 
to hang for 2 hours trying to connect to a server thats already gone
    
    patch by David Capwell; reviewed by Brandon Williams for CASSANDRA-19028
---
 dtest.py       | 6 ++++++
 dtest_setup.py | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/dtest.py b/dtest.py
index 6d753d36..da7b31a7 100644
--- a/dtest.py
+++ b/dtest.py
@@ -249,6 +249,12 @@ class Tester(object):
         self.dtest_config = fixture_dtest_setup.dtest_config
         return None
 
+    @pytest.fixture(autouse=True)
+    def cleanup_connections(self):
+        yield None
+        logger.info('Cleaning up CQL Connections...')
+        self.fixture_dtest_setup.cleanup_connections()
+
     def assert_supported_upgrade_path(self, from_version, to_version):
         for path in build_upgrade_pairs():
             if from_version.startswith(path.starting_meta.family) and 
to_version.startswith(path.upgrade_meta.family):
diff --git a/dtest_setup.py b/dtest_setup.py
index 1a82555b..a1f661ac 100644
--- a/dtest_setup.py
+++ b/dtest_setup.py
@@ -417,11 +417,14 @@ class DTestSetup(object):
                     os.rmdir(self.test_path)
                     self.cleanup_last_test_dir()
 
-    def cleanup_and_replace_cluster(self):
+    def cleanup_connections(self):
         for con in self.connections:
             con.cluster.shutdown()
         self.connections = []
 
+    def cleanup_and_replace_cluster(self):
+        self.cleanup_connections()
+
         self.cleanup_cluster()
         self.test_path = self.get_test_path()
         self.initialize_cluster(self.create_cluster_func)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to