Skip to content

Commit cf4d2b7

Browse files
committed
tests: fixes for 'incr_restore' module
1 parent 20796bc commit cf4d2b7

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

tests/incr_restore.py

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def test_basic_incr_restore(self):
7070
node.stop()
7171

7272
self.restore_node(
73-
backup_dir, 'node', node, options=["-j", "4", "--incremental"])
73+
backup_dir, 'node', node,
74+
options=["-j", "4", "--incremental-mode=checksum"])
7475

7576
pgdata_restored = self.pgdata_content(node.data_dir)
7677
self.compare_pgdata(pgdata, pgdata_restored)
@@ -128,7 +129,7 @@ def test_checksum_corruption_detection(self):
128129
# corrupt block
129130

130131
self.restore_node(
131-
backup_dir, 'node', node, options=["-j", "4", "--incremental"])
132+
backup_dir, 'node', node, options=["-j", "4", "--incremental-mode=checksum"])
132133

133134
pgdata_restored = self.pgdata_content(node.data_dir)
134135
self.compare_pgdata(pgdata, pgdata_restored)
@@ -138,7 +139,8 @@ def test_checksum_corruption_detection(self):
138139

139140
# @unittest.skip("skip")
140141
def test_incr_restore_with_tablespace(self):
141-
"""recovery to target timeline"""
142+
"""
143+
"""
142144
fname = self.id().split('.')[3]
143145
node = self.make_simple_node(
144146
base_dir=os.path.join(module_name, fname, 'node'),
@@ -154,6 +156,7 @@ def test_incr_restore_with_tablespace(self):
154156
tblspace = self.get_tblspace_path(node, 'tblspace')
155157
some_directory = self.get_tblspace_path(node, 'some_directory')
156158

159+
# stuff new destination with garbage
157160
self.restore_node(backup_dir, 'node', node, data_dir=some_directory)
158161

159162
self.create_tblspace_in_node(node, 'tblspace')
@@ -167,12 +170,14 @@ def test_incr_restore_with_tablespace(self):
167170
self.restore_node(
168171
backup_dir, 'node', node,
169172
options=[
170-
"-j", "4", "--incremental",
173+
"-j", "4", "--incremental-mode=checksum",
171174
"-T{0}={1}".format(tblspace, some_directory)])
172175

173176
pgdata_restored = self.pgdata_content(node.data_dir)
174177
self.compare_pgdata(pgdata, pgdata_restored)
175178

179+
exit(1)
180+
176181
# Clean after yourself
177182
self.del_test_dir(module_name, fname)
178183

@@ -226,7 +231,7 @@ def test_incr_restore_with_tablespace_1(self):
226231

227232
self.restore_node(
228233
backup_dir, 'node', node,
229-
options=["-j", "4", "--incremental"])
234+
options=["-j", "4", "--incremental-mode=checksum"])
230235

231236
pgdata_restored = self.pgdata_content(node.data_dir)
232237
self.compare_pgdata(pgdata, pgdata_restored)
@@ -257,6 +262,8 @@ def test_incr_restore_with_tablespace_2(self):
257262

258263
self.backup_node(backup_dir, 'node', node, options=['--stream'])
259264

265+
pgdata = self.pgdata_content(node.data_dir)
266+
260267
node_1 = self.make_simple_node(
261268
base_dir=os.path.join(module_name, fname, 'node_1'))
262269

@@ -265,18 +272,14 @@ def test_incr_restore_with_tablespace_2(self):
265272
self.restore_node(
266273
backup_dir, 'node', node,
267274
data_dir=node_1.data_dir,
268-
options=['--incremental'])
275+
options=['--incremental-mode=checksum'])
269276

270277
self.restore_node(
271278
backup_dir, 'node', node,
272279
data_dir=node_1.data_dir,
273-
options=['--incremental', '-T{0}={1}'.format(tblspace, tblspace)])
280+
options=['--incremental-mode=checksum', '-T{0}={1}'.format(tblspace, tblspace)])
274281

275-
exit(1)
276-
277-
pgdata = self.pgdata_content(node.data_dir)
278-
279-
pgdata_restored = self.pgdata_content(node.data_dir)
282+
pgdata_restored = self.pgdata_content(node_1.data_dir)
280283
self.compare_pgdata(pgdata, pgdata_restored)
281284

282285
# Clean after yourself
@@ -301,7 +304,7 @@ def test_incr_restore_sanity(self):
301304
try:
302305
self.restore_node(
303306
backup_dir, 'node', node,
304-
options=["-j", "4", "--incremental"])
307+
options=["-j", "4", "--incremental-mode=checksum"])
305308
# we should die here because exception is what we expect to happen
306309
self.assertEqual(
307310
1, 0,
@@ -327,7 +330,7 @@ def test_incr_restore_sanity(self):
327330
try:
328331
self.restore_node(
329332
backup_dir, 'node', node_1, data_dir=node_1.data_dir,
330-
options=["-j", "4", "--incremental"])
333+
options=["-j", "4", "--incremental-mode=checksum"])
331334
# we should die here because exception is what we expect to happen
332335
self.assertEqual(
333336
1, 0,
@@ -426,7 +429,7 @@ def test_incr_checksum_restore(self):
426429

427430
print(self.restore_node(
428431
backup_dir, 'node', node,
429-
options=["-j", "4", "--incremental"]))
432+
options=["-j", "4", "--incremental-mode=checksum"]))
430433

431434
pgdata_restored = self.pgdata_content(node.data_dir)
432435

@@ -515,7 +518,7 @@ def test_incr_lsn_restore(self):
515518
pgdata = self.pgdata_content(node_1.data_dir)
516519

517520
print(self.restore_node(
518-
backup_dir, 'node', node, options=["-j", "4", "--incremental-lsn"]))
521+
backup_dir, 'node', node, options=["-j", "4", "--incremental-mode=lsn"]))
519522

520523
pgdata_restored = self.pgdata_content(node.data_dir)
521524

@@ -524,8 +527,6 @@ def test_incr_lsn_restore(self):
524527

525528
self.compare_pgdata(pgdata, pgdata_restored)
526529

527-
exit(1)
528-
529530
# Clean after yourself
530531
self.del_test_dir(module_name, fname)
531532

@@ -580,7 +581,7 @@ def test_incr_shift_sanity(self):
580581
try:
581582
self.restore_node(
582583
backup_dir, 'node', node, data_dir=node.data_dir,
583-
options=["-j", "4", "--incremental-lsn"])
584+
options=["-j", "4", "--incremental-mode=lsn"])
584585
# we should die here because exception is what we expect to happen
585586
self.assertEqual(
586587
1, 0,
@@ -589,8 +590,8 @@ def test_incr_shift_sanity(self):
589590
repr(self.output), self.cmd))
590591
except ProbackupException as e:
591592
self.assertIn(
592-
'ERROR: Cannot perform incremental restore of '
593-
'backup chain {0} in shift mode'.format(page_id),
593+
"ERROR: Cannot perform incremental restore of "
594+
"backup chain {0} in 'lsn' mode".format(page_id),
594595
e.message,
595596
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
596597
repr(e.message), self.cmd))
@@ -648,7 +649,7 @@ def test_incr_checksum_sanity(self):
648649

649650
self.restore_node(
650651
backup_dir, 'node', node, data_dir=node.data_dir,
651-
options=["-j", "4", "--incremental"])
652+
options=["-j", "4", "--incremental-mode=checksum"])
652653

653654
pgdata_restored = self.pgdata_content(node.data_dir)
654655

@@ -707,7 +708,7 @@ def test_incr_checksum_corruption_detection(self):
707708

708709
print(self.restore_node(
709710
backup_dir, 'node', node, data_dir=node.data_dir,
710-
options=["-j", "4", "--incremental"]))
711+
options=["-j", "4", "--incremental-mode=checksum"]))
711712

712713
pgdata_restored = self.pgdata_content(node.data_dir)
713714

@@ -765,7 +766,7 @@ def test_incr_shift_corruption_detection(self):
765766

766767
self.restore_node(
767768
backup_dir, 'node', node, data_dir=node.data_dir,
768-
options=["-j", "4", "--incremental-lsn"])
769+
options=["-j", "4", "--incremental-mode=lsn"])
769770

770771
pgdata_restored = self.pgdata_content(node.data_dir)
771772

@@ -836,7 +837,7 @@ def test_incr_restore_multiple_external(self):
836837

837838
print(self.restore_node(
838839
backup_dir, 'node', node,
839-
options=["-j", "4", '--incremental', '--log-level-console=VERBOSE']))
840+
options=["-j", "4", '--incremental-mode=checksum', '--log-level-console=VERBOSE']))
840841

841842
pgdata_restored = self.pgdata_content(
842843
node.base_dir, exclude_dirs=['logs'])
@@ -907,7 +908,7 @@ def test_incr_shift_restore_multiple_external(self):
907908

908909
print(self.restore_node(
909910
backup_dir, 'node', node,
910-
options=["-j", "4", '--incremental-lsn']))
911+
options=["-j", "4", '--incremental-mode=lsn']))
911912

912913
pgdata_restored = self.pgdata_content(
913914
node.base_dir, exclude_dirs=['logs'])

0 commit comments

Comments
 (0)