1
0
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:
Grigory Smolkin 2020-06-19 10:39:29 +03:00
parent 3475ef6631
commit 6f89a53ce0
11 changed files with 19 additions and 18 deletions

View File

@ -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")

View File

@ -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):

View File

@ -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):

View File

@ -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):
"""

View File

@ -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):

View File

@ -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,

View File

@ -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):
"""

View File

@ -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):

View File

@ -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):

View File

@ -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])

View File

@ -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):