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

Commit29380ef

Browse files
committed
ptrack tests fixes
1 parent25b7a70 commit29380ef

File tree

1 file changed

+28
-40
lines changed

1 file changed

+28
-40
lines changed

‎tests/ptrack.py

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
classPtrackBackupTest(ProbackupTest,unittest.TestCase):
1414

15-
@unittest.skip("skip")
15+
#@unittest.skip("skip")
1616
# @unittest.expectedFailure
1717
deftest_ptrack_enable(self):
1818
"""make ptrack without full backup, should result in error"""
@@ -42,7 +42,7 @@ def test_ptrack_enable(self):
4242
# Clean after yourself
4343
self.del_test_dir(module_name,fname)
4444

45-
@unittest.skip("skip")
45+
#@unittest.skip("skip")
4646
deftest_ptrack_stream(self):
4747
"""make node, make full and ptrack stream backups, restore them and check data correctness"""
4848
self.maxDiff=None
@@ -71,9 +71,8 @@ def test_ptrack_stream(self):
7171
"postgres",
7272
"insert into t_heap select i as id, nextval('t_seq') as t_seq, md5(i::text) as text, md5(i::text)::tsvector as tsvector from generate_series(100,200) i")
7373
ptrack_result=node.safe_psql("postgres","SELECT * FROM t_heap")
74-
node.safe_psql("postgres","checkpoint")
75-
pgdata=self.pgdata_content(node.data_dir)
7674
ptrack_backup_id=self.backup_node(backup_dir,'node',node,backup_type='ptrack',options=['--stream'])
75+
pgdata=self.pgdata_content(node.data_dir)
7776

7877
# Drop Node
7978
node.cleanup()
@@ -100,7 +99,7 @@ def test_ptrack_stream(self):
10099
# Clean after yourself
101100
self.del_test_dir(module_name,fname)
102101

103-
@unittest.skip("skip")
102+
#@unittest.skip("skip")
104103
deftest_ptrack_archive(self):
105104
"""make archive node, make full and ptrack backups, check data correctness in restored instance"""
106105
self.maxDiff=None
@@ -129,9 +128,8 @@ def test_ptrack_archive(self):
129128
"postgres",
130129
"insert into t_heap select i as id, md5(i::text) as text, md5(i::text)::tsvector as tsvector from generate_series(100,200) i")
131130
ptrack_result=node.safe_psql("postgres","SELECT * FROM t_heap")
132-
node.safe_psql("postgres","checkpoint")
133-
pgdata=self.pgdata_content(node.data_dir)
134131
ptrack_backup_id=self.backup_node(backup_dir,'node',node,backup_type='ptrack')
132+
pgdata=self.pgdata_content(node.data_dir)
135133

136134
# Drop Node
137135
node.cleanup()
@@ -159,7 +157,7 @@ def test_ptrack_archive(self):
159157
# Clean after yourself
160158
self.del_test_dir(module_name,fname)
161159

162-
@unittest.skip("skip")
160+
#@unittest.skip("skip")
163161
deftest_ptrack_pgpro417(self):
164162
"""Make node, take full backup, take ptrack backup, delete ptrack backup. Try to take ptrack backup, which should fail"""
165163
self.maxDiff=None
@@ -211,7 +209,7 @@ def test_ptrack_pgpro417(self):
211209
# Clean after yourself
212210
self.del_test_dir(module_name,fname)
213211

214-
@unittest.skip("skip")
212+
#@unittest.skip("skip")
215213
deftest_page_pgpro417(self):
216214
"""Make archive node, take full backup, take page backup, delete page backup. Try to take ptrack backup, which should fail"""
217215
self.maxDiff=None
@@ -262,7 +260,7 @@ def test_page_pgpro417(self):
262260
# Clean after yourself
263261
# self.del_test_dir(module_name, fname)
264262

265-
@unittest.skip("skip")
263+
#@unittest.skip("skip")
266264
deftest_full_pgpro417(self):
267265
"""Make node, take two full backups, delete full second backup. Try to take ptrack backup, which should fail"""
268266
self.maxDiff=None
@@ -312,7 +310,7 @@ def test_full_pgpro417(self):
312310
# Clean after yourself
313311
self.del_test_dir(module_name,fname)
314312

315-
#@unittest.skip("skip")
313+
#@unittest.skip("skip")
316314
deftest_create_db(self):
317315
"""Make node, take full backup, create database db1, take ptrack backup, restore database and check it presense"""
318316
self.maxDiff=None
@@ -339,11 +337,8 @@ def test_create_db(self):
339337
node.safe_psql("db1","create table t_heap as select i as id, md5(i::text) as text, md5(i::text)::tsvector as tsvector from generate_series(0,100) i")
340338

341339
# PTRACK BACKUP
342-
node.safe_psql("postgres","checkpoint")
343-
pgdata_content=self.pgdata_content(node.data_dir)
344-
sys.exit(1)
345340
backup_id=self.backup_node(backup_dir,'node',node,backup_type='ptrack',options=["--stream"])
346-
sys.exit(1)
341+
pgdata_content=self.pgdata_content(node.data_dir)
347342

348343
# RESTORE
349344
node_restored=self.make_simple_node(base_dir="{0}/{1}/node_restored".format(module_name,fname))
@@ -357,18 +352,14 @@ def test_create_db(self):
357352
node_restored.append_conf("postgresql.auto.conf","port = {0}".format(node_restored.port))
358353
node_restored.start()
359354
result_new=node_restored.safe_psql("postgres","select * from pg_class")
360-
self.assertEqual(result,result_new)
361355

362356

363357
# DROP DATABASE DB1
364358
node.safe_psql(
365359
"postgres","drop database db1")
366360
# SECOND PTRACK BACKUP
367-
node.safe_psql("postgres","select * from pg_class; select * from pg_index; select * from pg_attribute; checkpoint")
368-
node.safe_psql("postgres","vacuum pg_class")
369-
node.safe_psql("postgres","checkpoint")
370-
pgdata_content=self.pgdata_content(node.data_dir)
371361
backup_id=self.backup_node(backup_dir,'node',node,backup_type='ptrack',options=["--stream"])
362+
pgdata_content=self.pgdata_content(node.data_dir)
372363

373364
# RESTORE SECOND PTRACK BACKUP
374365
node_restored.cleanup()
@@ -394,7 +385,7 @@ def test_create_db(self):
394385
# Clean after yourself
395386
self.del_test_dir(module_name,fname)
396387

397-
@unittest.skip("skip")
388+
#@unittest.skip("skip")
398389
deftest_alter_table_set_tablespace_ptrack(self):
399390
"""Make node, create tablespace with table, take full backup, alter tablespace location, take ptrack backup, restore database."""
400391
self.maxDiff=None
@@ -426,8 +417,8 @@ def test_alter_table_set_tablespace_ptrack(self):
426417
# PTRACK BACKUP
427418
result=node.safe_psql("postgres","select * from t_heap")
428419
node.safe_psql("postgres","select * from pg_class; checkpoint")
429-
pgdata_content=self.pgdata_content(node.data_dir)
430420
self.backup_node(backup_dir,'node',node,backup_type='ptrack',options=["--stream"])
421+
pgdata_content=self.pgdata_content(node.data_dir)
431422
node.stop()
432423

433424
# RESTORE
@@ -451,7 +442,7 @@ def test_alter_table_set_tablespace_ptrack(self):
451442
# Clean after yourself
452443
self.del_test_dir(module_name,fname)
453444

454-
@unittest.skip("skip")
445+
#@unittest.skip("skip")
455446
deftest_alter_database_set_tablespace_ptrack(self):
456447
"""Make node, create tablespace with database, take full backup, alter tablespace location, take ptrack backup, restore database."""
457448
self.maxDiff=None
@@ -478,9 +469,8 @@ def test_alter_database_set_tablespace_ptrack(self):
478469
"alter database postgres set tablespace somedata")
479470

480471
# PTRACK BACKUP
481-
node.safe_psql("template1","select * from pg_database; checkpoint;")
482-
pgdata_content=self.pgdata_content(node.data_dir)
483472
self.backup_node(backup_dir,'node',node,backup_type='ptrack',options=["--stream"])
473+
pgdata_content=self.pgdata_content(node.data_dir)
484474
node.stop()
485475

486476
# RESTORE
@@ -499,7 +489,7 @@ def test_alter_database_set_tablespace_ptrack(self):
499489
# Clean after yourself
500490
self.del_test_dir(module_name,fname)
501491

502-
@unittest.skip("skip")
492+
#@unittest.skip("skip")
503493
deftest_drop_tablespace(self):
504494
"""Make node, create table, alter table tablespace, take ptrack backup, move table from tablespace, take ptrack backup"""
505495
self.maxDiff=None
@@ -559,7 +549,7 @@ def test_drop_tablespace(self):
559549
# Clean after yourself
560550
self.del_test_dir(module_name,fname)
561551

562-
@unittest.skip("skip")
552+
#@unittest.skip("skip")
563553
deftest_alter_tablespace(self):
564554
"""Make node, create table, alter table tablespace, take ptrack backup, move table from tablespace, take ptrack backup"""
565555
self.maxDiff=None
@@ -589,9 +579,9 @@ def test_alter_tablespace(self):
589579
node.safe_psql(
590580
"postgres","alter table t_heap set tablespace somedata")
591581
# FIRTS PTRACK BACKUP
592-
node.safe_psql("postgres","select * from pg_class; checkpoint")
593-
pgdata_content=self.pgdata_content(node.data_dir)
582+
node.safe_psql("postgres","checkpoint")
594583
self.backup_node(backup_dir,'node',node,backup_type='ptrack',options=["--stream"])
584+
pgdata_content=self.pgdata_content(node.data_dir)
595585

596586
# Restore ptrack backup and check table consistency
597587
restored_node=self.make_simple_node(base_dir="{0}/{1}/restored_node".format(module_name,fname))
@@ -602,7 +592,7 @@ def test_alter_tablespace(self):
602592
"-j","4","-T","{0}={1}".format(tblspc_path,tblspc_path_new)])
603593
result=node.safe_psql("postgres","select * from t_heap")
604594

605-
pgdata_content_new=self.pgdata_content(node.data_dir)
595+
pgdata_content_new=self.pgdata_content(restored_node.data_dir)
606596
self.compare_pgdata(pgdata_content,pgdata_content_new)
607597
restored_node.append_conf("postgresql.auto.conf","port = {0}".format(restored_node.port))
608598
restored_node.start()
@@ -617,13 +607,13 @@ def test_alter_tablespace(self):
617607
"postgres","alter table t_heap set tablespace pg_default")
618608
# SECOND PTRACK BACKUP
619609
node.safe_psql("template1","checkpoint")
620-
pgdata_content=self.pgdata_content(node.data_dir)
621610
self.backup_node(backup_dir,'node',node,backup_type='ptrack',options=["--stream"])
611+
pgdata_content=self.pgdata_content(node.data_dir)
622612

623613
# Restore second ptrack backup and check table consistency
624614
self.restore_node(backup_dir,'node',restored_node,options=[
625615
"-j","4","-T","{0}={1}".format(tblspc_path,tblspc_path_new)])
626-
pgdata_content_new=self.pgdata_content(node.data_dir)
616+
pgdata_content_new=self.pgdata_content(restored_node.data_dir)
627617
self.compare_pgdata(pgdata_content,pgdata_content_new)
628618
restored_node.append_conf("postgresql.auto.conf","port = {0}".format(restored_node.port))
629619
restored_node.start()
@@ -633,7 +623,7 @@ def test_alter_tablespace(self):
633623
# Clean after yourself
634624
self.del_test_dir(module_name,fname)
635625

636-
@unittest.skip("skip")
626+
#@unittest.skip("skip")
637627
deftest_relation_with_multiple_segments(self):
638628
"""Make node, create table, alter table tablespace, take ptrack backup, move table from tablespace, take ptrack backup"""
639629
self.maxDiff=None
@@ -657,25 +647,23 @@ def test_relation_with_multiple_segments(self):
657647
# FULL BACKUP
658648
self.backup_node(backup_dir,'node',node,options=["--stream"])
659649

660-
pgbench=node.pgbench(options=['-T','50','-c','2'])
650+
pgbench=node.pgbench(options=['-T','50','-c','2','--no-vacuum'])
661651
pgbench.wait()
662652

663653
# GET PHYSICAL CONTENT FROM NODE
664-
node.safe_psql("postgres","checkpoint")
665-
pgdata=self.pgdata_content(node.data_dir)
666654
# FIRTS PTRACK BACKUP
667655
result=node.safe_psql("postgres","select * from pgbench_accounts")
668656
self.backup_node(backup_dir,'node',node,backup_type='ptrack',options=["--stream"])
657+
pgdata=self.pgdata_content(node.data_dir)
669658

670-
# Restore ptrack backup and check table consistency
659+
# RESTORE NODE
660+
# self.restore_node(backup_dir, 'node', restored_node, options=[
661+
# "-j", "4", "-T", "{0}={1}".format(tblspc_path, tblspc_path_new)])
671662
restored_node=self.make_simple_node(base_dir="{0}/{1}/restored_node".format(module_name,fname))
672663
restored_node.cleanup()
673664
# tblspc_path = self.get_tblspace_path(node, 'somedata')
674665
# tblspc_path_new = self.get_tblspace_path(restored_node, 'somedata_restored')
675666

676-
# RESTORE NODE
677-
# self.restore_node(backup_dir, 'node', restored_node, options=[
678-
# "-j", "4", "-T", "{0}={1}".format(tblspc_path, tblspc_path_new)])
679667
self.restore_node(backup_dir,'node',restored_node,options=[
680668
"-j","4"])
681669
# GET PHYSICAL CONTENT FROM NODE_RESTORED

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp