Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7bc8f49

Browse files
committed
tests: added tests.backup.BackupTest.test_drop_db_during_full_backup
1 parent04d1ec9 commit7bc8f49

File tree

1 file changed

+68
-2
lines changed

1 file changed

+68
-2
lines changed

‎tests/backup.py‎

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,10 +1285,8 @@ def test_drop_rel_during_full_backup(self):
12851285

12861286
self.init_pb(backup_dir)
12871287
self.add_instance(backup_dir,'node',node)
1288-
self.set_archiving(backup_dir,'node',node)
12891288
node.slow_start()
12901289

1291-
12921290
foriinrange(1,512):
12931291
node.safe_psql(
12941292
"postgres",
@@ -1356,6 +1354,74 @@ def test_drop_rel_during_full_backup(self):
13561354
# Clean after yourself
13571355
self.del_test_dir(module_name,fname)
13581356

1357+
# @unittest.skip("skip")
1358+
deftest_drop_db_during_full_backup(self):
1359+
""""""
1360+
fname=self.id().split('.')[3]
1361+
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
1362+
node=self.make_simple_node(
1363+
base_dir=os.path.join(module_name,fname,'node'),
1364+
set_replication=True,
1365+
initdb_params=['--data-checksums'])
1366+
1367+
self.init_pb(backup_dir)
1368+
self.add_instance(backup_dir,'node',node)
1369+
node.slow_start()
1370+
1371+
foriinrange(1,100):
1372+
node.safe_psql(
1373+
"postgres",
1374+
"create database t_heap_{0}".format(i))
1375+
1376+
node.safe_psql(
1377+
"postgres",
1378+
"VACUUM")
1379+
1380+
# FULL backup
1381+
gdb=self.backup_node(
1382+
backup_dir,'node',node,gdb=True,
1383+
options=[
1384+
'--stream','--log-level-file=LOG',
1385+
'--log-level-console=LOG','--progress'])
1386+
1387+
gdb.set_breakpoint('backup_files')
1388+
gdb.run_until_break()
1389+
1390+
# REMOVE file
1391+
foriinrange(1,100):
1392+
node.safe_psql(
1393+
"postgres",
1394+
"drop database t_heap_{0}".format(i))
1395+
1396+
node.safe_psql(
1397+
"postgres",
1398+
"CHECKPOINT")
1399+
1400+
node.safe_psql(
1401+
"postgres",
1402+
"CHECKPOINT")
1403+
1404+
# File removed, we can proceed with backup
1405+
gdb.continue_execution_until_exit()
1406+
1407+
pgdata=self.pgdata_content(node.data_dir)
1408+
1409+
#with open(os.path.join(backup_dir, 'log', 'pg_probackup.log')) as f:
1410+
# log_content = f.read()
1411+
# self.assertTrue(
1412+
# 'LOG: File "{0}" is not found'.format(absolute_path) in log_content,
1413+
# 'File "{0}" should be deleted but it`s not'.format(absolute_path))
1414+
1415+
node.cleanup()
1416+
self.restore_node(backup_dir,'node',node)
1417+
1418+
# Physical comparison
1419+
pgdata_restored=self.pgdata_content(node.data_dir)
1420+
self.compare_pgdata(pgdata,pgdata_restored)
1421+
1422+
# Clean after yourself
1423+
self.del_test_dir(module_name,fname)
1424+
13591425
# @unittest.skip("skip")
13601426
deftest_drop_rel_during_backup_delta(self):
13611427
""""""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp