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

Appearance settings

Commit 34741de

Browse filesBrowse files
committed
[Issue #364] added tests.validate.ValidateTest.test_no_validate_tablespace_map
1 parent a6fabdb commit 34741de
Copy full SHA for 34741de

File tree

1 file changed

+65
-0
lines changed
Filter options

1 file changed

+65
-0
lines changed

‎tests/validate.py

Copy file name to clipboardExpand all lines: tests/validate.py
+65Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3968,6 +3968,71 @@ def test_validate_missing_page_header_map(self):
39683968
# Clean after yourself
39693969
self.del_test_dir(module_name, fname)
39703970

3971+
# @unittest.expectedFailure
3972+
# @unittest.skip("skip")
3973+
def test_no_validate_tablespace_map(self):
3974+
"""
3975+
Check that --no-validate is propagated to tablespace_map
3976+
"""
3977+
fname = self.id().split('.')[3]
3978+
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
3979+
node = self.make_simple_node(
3980+
base_dir=os.path.join(module_name, fname, 'node'),
3981+
set_replication=True,
3982+
initdb_params=['--data-checksums'])
3983+
3984+
self.init_pb(backup_dir)
3985+
self.add_instance(backup_dir, 'node', node)
3986+
node.slow_start()
3987+
3988+
self.create_tblspace_in_node(node, 'external_dir')
3989+
3990+
node.safe_psql(
3991+
'postgres',
3992+
'CREATE TABLE t_heap(a int) TABLESPACE "external_dir"')
3993+
3994+
tblspace_new = self.get_tblspace_path(node, 'external_dir_new')
3995+
3996+
oid = node.safe_psql(
3997+
'postgres',
3998+
"select oid from pg_tablespace where spcname = 'external_dir'").decode('utf-8').rstrip()
3999+
4000+
# FULL backup
4001+
backup_id = self.backup_node(
4002+
backup_dir, 'node', node, options=['--stream'])
4003+
4004+
pgdata = self.pgdata_content(node.data_dir)
4005+
4006+
tablespace_map = os.path.join(
4007+
backup_dir, 'backups', 'node',
4008+
backup_id, 'database', 'tablespace_map')
4009+
4010+
# overwrite tablespace_map file
4011+
with open(tablespace_map, "w") as f:
4012+
f.write("{0} {1}".format(oid, tblspace_new))
4013+
f.close
4014+
4015+
node.cleanup()
4016+
4017+
self.restore_node(backup_dir, 'node', node, options=['--no-validate'])
4018+
4019+
pgdata_restored = self.pgdata_content(node.data_dir)
4020+
self.compare_pgdata(pgdata, pgdata_restored)
4021+
4022+
# check that tablespace restore as symlink
4023+
tablespace_link = os.path.join(node.data_dir, 'pg_tblspc', oid)
4024+
self.assertTrue(
4025+
os.path.islink(tablespace_link),
4026+
"'%s' is not a symlink" % tablespace_link)
4027+
4028+
self.assertEqual(
4029+
os.readlink(tablespace_link),
4030+
tblspace_new,
4031+
"Symlink '{0}' do not points to '{1}'".format(tablespace_link, tblspace_new))
4032+
4033+
# Clean after yourself
4034+
self.del_test_dir(module_name, fname)
4035+
39714036
# validate empty backup list
39724037
# page from future during validate
39734038
# page from future during backup

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.