@@ -378,20 +378,15 @@ def tearDown(self):
378
378
if is_test_result_ok (self ):
379
379
for node in self .nodes_to_cleanup :
380
380
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 )
383
382
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 )
388
383
else :
389
384
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 ()
395
390
396
391
@property
397
392
def pg_config_version (self ):
@@ -1705,25 +1700,9 @@ def get_ptrack_version(self, node):
1705
1700
def get_bin_path (self , binary ):
1706
1701
return testgres .get_bin_path (binary )
1707
1702
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
-
1722
1703
def del_test_dir (self , module_name , fname ):
1723
1704
""" Del testdir and optimistically try to del module dir"""
1724
1705
1725
- self .clean_all ()
1726
-
1727
1706
shutil .rmtree (
1728
1707
os .path .join (
1729
1708
self .tmp_path ,
0 commit comments