mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-24 08:52:38 +02:00
tests: for basic smoke tests avoid crashish of PostgreSQL cluster when cleaning up test directories
This commit is contained in:
parent
3475ef6631
commit
6f89a53ce0
@ -988,7 +988,7 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
||||
self.backup_node(backup_dir, 'master', replica)
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, nodes=[master, replica])
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
|
@ -1068,7 +1068,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, nodes=[node])
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_tablespace_handling_1(self):
|
||||
@ -1646,7 +1646,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertEqual(show_backup['status'], "OK")
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, nodes=[node])
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_pg_11_adjusted_wal_segment_size(self):
|
||||
@ -1930,7 +1930,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
os.chmod(full_path, 700)
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, [node])
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_basic_missing_dir_permissions(self):
|
||||
@ -1973,7 +1973,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
os.chmod(full_path, 700)
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, [node])
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_backup_with_least_privileges_role(self):
|
||||
|
@ -348,7 +348,7 @@ class CheckdbTest(ProbackupTest, unittest.TestCase):
|
||||
log_file_content)
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, [node])
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_checkdb_block_validation_sanity(self):
|
||||
|
@ -115,10 +115,9 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
delta_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||
self.assertEqual(delta_result, delta_result_new)
|
||||
node.cleanup()
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, [node])
|
||||
|
||||
def test_compression_archive_zlib(self):
|
||||
"""
|
||||
|
@ -87,7 +87,7 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
|
||||
node_restored.slow_start()
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, [node])
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_delta_vacuum_truncate_1(self):
|
||||
|
@ -1448,13 +1448,16 @@ class ProbackupTest(object):
|
||||
def get_bin_path(self, binary):
|
||||
return testgres.get_bin_path(binary)
|
||||
|
||||
def del_test_dir(self, module_name, fname):
|
||||
def del_test_dir(self, module_name, fname, nodes=[]):
|
||||
""" Del testdir and optimistically try to del module dir"""
|
||||
try:
|
||||
testgres.clean_all()
|
||||
except:
|
||||
pass
|
||||
|
||||
for node in nodes:
|
||||
node.stop()
|
||||
|
||||
shutil.rmtree(
|
||||
os.path.join(
|
||||
self.tmp_path,
|
||||
|
@ -100,8 +100,7 @@ class MergeTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertEqual(count1, count2)
|
||||
|
||||
# Clean after yourself
|
||||
node.cleanup()
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, [node])
|
||||
|
||||
def test_merge_compressed_backups(self):
|
||||
"""
|
||||
|
@ -100,7 +100,7 @@ class PageTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertEqual(result1, result2)
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, [node, node_restored])
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_page_vacuum_truncate_1(self):
|
||||
|
@ -344,7 +344,7 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
options=['--archive-timeout=30s', '--stream'])
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, [master, replica])
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_take_backup_from_delayed_replica(self):
|
||||
|
@ -1009,7 +1009,7 @@ class RetentionTest(ProbackupTest, unittest.TestCase):
|
||||
'FULL')
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, [node])
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_basic_window_merge_multiple_descendants_1(self):
|
||||
@ -1276,7 +1276,7 @@ class RetentionTest(ProbackupTest, unittest.TestCase):
|
||||
'--delete-expired', '--log-level-console=log'])
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, [node])
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_window_chains(self):
|
||||
@ -2534,4 +2534,4 @@ class RetentionTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
self.validate_pb(backup_dir, 'node')
|
||||
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, [node])
|
||||
|
@ -298,7 +298,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
'Backup STATUS should be "ORPHAN"')
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
self.del_test_dir(module_name, fname, [node])
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_validate_corrupted_intermediate_backups(self):
|
||||
|
Loading…
Reference in New Issue
Block a user