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

Commit73efc0b

Browse files
committed
[Issue#203] test coverage
1 parent9b0922c commit73efc0b

File tree

4 files changed

+70
-5
lines changed

4 files changed

+70
-5
lines changed

‎tests/archive.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,10 @@ def test_basic_master_and_replica_concurrent_archiving(self):
977977

978978
replica.promote()
979979

980+
replica.safe_psql(
981+
'postgres',
982+
'CHECKPOINT')
983+
980984
master.pgbench_init(scale=10)
981985
replica.pgbench_init(scale=10)
982986

‎tests/backup.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2511,7 +2511,7 @@ def test_backup_with_less_privileges_role(self):
25112511
# Clean after yourself
25122512
self.del_test_dir(module_name,fname)
25132513

2514-
#@unittest.skip("skip")
2514+
@unittest.skip("skip")
25152515
deftest_issue_132(self):
25162516
"""
25172517
https://github.com/postgrespro/pg_probackup/issues/132
@@ -2546,6 +2546,8 @@ def test_issue_132(self):
25462546
pgdata_restored=self.pgdata_content(node.data_dir)
25472547
self.compare_pgdata(pgdata,pgdata_restored)
25482548

2549+
exit(1)
2550+
25492551
# Clean after yourself
25502552
self.del_test_dir(module_name,fname)
25512553

‎tests/config.py‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
importos
44
from .helpers.ptrack_helpersimportProbackupTest,ProbackupException
55
fromsysimportexit
6+
fromshutilimportcopyfile
67

78
module_name='config'
89

@@ -51,3 +52,61 @@ def test_remove_instance_config(self):
5152
e.message,
5253
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
5354
repr(e.message),self.cmd))
55+
56+
# @unittest.expectedFailure
57+
# @unittest.skip("skip")
58+
deftest_corrupt_backup_content(self):
59+
"""corrupt backup_content.control"""
60+
fname=self.id().split('.')[3]
61+
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
62+
node=self.make_simple_node(
63+
base_dir=os.path.join(module_name,fname,'node'),
64+
set_replication=True,
65+
initdb_params=['--data-checksums'])
66+
67+
self.init_pb(backup_dir)
68+
self.add_instance(backup_dir,'node',node)
69+
self.set_archiving(backup_dir,'node',node)
70+
node.slow_start()
71+
72+
full1_id=self.backup_node(backup_dir,'node',node)
73+
74+
node.safe_psql(
75+
'postgres',
76+
'create table t1()')
77+
78+
fulle2_id=self.backup_node(backup_dir,'node',node)
79+
80+
fulle1_conf_file=os.path.join(
81+
backup_dir,'backups','node',full1_id,'backup_content.control')
82+
83+
fulle2_conf_file=os.path.join(
84+
backup_dir,'backups','node',fulle2_id,'backup_content.control')
85+
86+
copyfile(fulle2_conf_file,fulle1_conf_file)
87+
88+
try:
89+
self.validate_pb(backup_dir,'node')
90+
self.assertEqual(
91+
1,0,
92+
"Expecting Error because pg_probackup.conf is missing. "
93+
".\n Output: {0}\n CMD: {1}".format(
94+
repr(self.output),self.cmd))
95+
exceptProbackupExceptionase:
96+
self.assertIn(
97+
"WARNING: Invalid CRC of backup control file '{0}':".format(fulle1_conf_file),
98+
e.message,
99+
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
100+
repr(e.message),self.cmd))
101+
102+
self.assertIn(
103+
"WARNING: Failed to get file list for backup {0}".format(full1_id),
104+
e.message,
105+
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
106+
repr(e.message),self.cmd))
107+
108+
self.assertIn(
109+
"WARNING: Backup {0} file list is corrupted".format(full1_id),
110+
e.message,
111+
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
112+
repr(e.message),self.cmd))

‎tests/merge.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,8 +1530,8 @@ def test_crash_after_opening_backup_control_2(self):
15301530
gdb.set_breakpoint('write_backup_filelist')
15311531
gdb.run_until_break()
15321532

1533-
gdb.set_breakpoint('fio_fwrite')
1534-
gdb.continue_execution_until_break(2)
1533+
gdb.set_breakpoint('sprintf')
1534+
gdb.continue_execution_until_break(20)
15351535

15361536
gdb._execute('signal SIGKILL')
15371537

@@ -1621,8 +1621,8 @@ def test_losing_file_after_failed_merge(self):
16211621
gdb.set_breakpoint('write_backup_filelist')
16221622
gdb.run_until_break()
16231623

1624-
gdb.set_breakpoint('fio_fwrite')
1625-
gdb.continue_execution_until_break(2)
1624+
gdb.set_breakpoint('sprintf')
1625+
gdb.continue_execution_until_break(20)
16261626

16271627
gdb._execute('signal SIGKILL')
16281628

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp