@@ -378,20 +378,15 @@ def tearDown(self):
378378 if is_test_result_ok (self ):
379379 for node in self .nodes_to_cleanup :
380380 node .cleanup ()
381- # we do clear refs to nodes to gather them by gc inside self.del_test_dir()
382- self .nodes_to_cleanup .clear ()
381+ self .del_test_dir (self .module_name , self .fname )
383382
384- if isinstance (self , unittest .TestCase ):
385- module_name = self .id ().split ('.' )[1 ]
386- fname = self .id ().split ('.' )[3 ]
387- self .del_test_dir (module_name , fname )
388383 else :
389384 for node in self .nodes_to_cleanup :
390- # TODO VERIFY do we want to remain failed test's db data for further investigations?
391- # TODO VERIFY or just to leave logs only without node/data?
392- # node._try_shutdown(max_attempts=1 )
393- node . cleanup ()
394- self .nodes_to_cleanup .clear ()
385+ # TODO make decorator with proper stop() vs cleanup()
386+ node . _try_shutdown ( max_attempts = 1 )
387+ # node.cleanup( )
388+
389+ self .nodes_to_cleanup .clear ()
395390
396391 @property
397392 def pg_config_version (self ):
@@ -1705,25 +1700,9 @@ def get_ptrack_version(self, node):
17051700 def get_bin_path (self , binary ):
17061701 return testgres .get_bin_path (binary )
17071702
1708- def clean_all (self ):
1709- # pre gc.collect() all dropped nodes
1710- for o in gc .get_referrers (testgres .PostgresNode ):
1711- if o .__class__ is testgres .PostgresNode :
1712- # removing node from slow_start enclosure
1713- # after this the node is collectable by gc
1714- o .slow_start = None
1715- gc .collect ()
1716-
1717- # only when there are unhandled nodes left we do the cleanup for them
1718- for o in gc .get_referrers (testgres .PostgresNode ):
1719- if o .__class__ is testgres .PostgresNode :
1720- o .cleanup ()
1721-
17221703 def del_test_dir (self , module_name , fname ):
17231704 """ Del testdir and optimistically try to del module dir"""
17241705
1725- self .clean_all ()
1726-
17271706 shutil .rmtree (
17281707 os .path .join (
17291708 self .tmp_path ,
0 commit comments