@@ -140,13 +140,15 @@ def test_ptrack_stream(self):
140140 self .restore_node (backup_dir , 'node' , node , backup_id = ptrack_backup_id , options = ["-j" , "4" ]),
141141 '\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (self .output ), self .cmd ))
142142 pgdata_restored = self .pgdata_content (node .data_dir )
143- # self.compare_pgdata(pgdata, pgdata_restored)
144143 node .start ()
145144 while node .safe_psql ("postgres" , "select pg_is_in_recovery()" ) == 't\n ' :
146145 time .sleep (1 )
147146 ptrack_result_new = node .safe_psql ("postgres" , "SELECT * FROM t_heap" )
148147 self .assertEqual (ptrack_result , ptrack_result_new )
149148
149+ if self .paranoia :
150+ self .compare_pgdata (pgdata , pgdata_restored )
151+
150152 # Clean after yourself
151153 self .del_test_dir (module_name , fname )
152154
@@ -203,12 +205,15 @@ def test_ptrack_archive(self):
203205 self .restore_node (backup_dir , 'node' , node , backup_id = ptrack_backup_id , options = ["-j" , "4" , "--time={0}" .format (ptrack_target_time )]),
204206 '\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (self .output ), self .cmd ))
205207 pgdata_restored = self .pgdata_content (node .data_dir )
206- # self.compare_pgdata(pgdata, pgdata_restored)
207208 node .start ()
208209 while node .safe_psql ("postgres" , "select pg_is_in_recovery()" ) == 't\n ' :
209210 time .sleep (1 )
210211 ptrack_result_new = node .safe_psql ("postgres" , "SELECT * FROM t_heap" )
211212 self .assertEqual (ptrack_result , ptrack_result_new )
213+
214+ if self .paranoia :
215+ self .compare_pgdata (pgdata , pgdata_restored )
216+
212217 node .cleanup ()
213218
214219 # Clean after yourself
@@ -401,8 +406,9 @@ def test_create_db(self):
401406 node_restored .cleanup ()
402407 # COMPARE PHYSICAL CONTENT
403408 self .restore_node (backup_dir , 'node' , node_restored , backup_id = backup_id , options = ["-j" , "4" ])
404- pgdata_new = self .pgdata_content (node_restored .data_dir )
405- # self.compare_pgdata(pgdata, pgdata_restored)
409+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
410+ if self .paranoia :
411+ self .compare_pgdata (pgdata , pgdata_restored )
406412
407413 # START RESTORED NODE
408414 node_restored .append_conf ("postgresql.auto.conf" , "port = {0}" .format (node_restored .port ))
@@ -424,8 +430,9 @@ def test_create_db(self):
424430 node_restored .start ()
425431
426432 # COMPARE PHYSICAL CONTENT
427- pgdata_new = self .pgdata_content (node_restored .data_dir )
428- # self.compare_pgdata(pgdata, pgdata_restored)
433+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
434+ if self .paranoia :
435+ self .compare_pgdata (pgdata , pgdata_restored )
429436
430437 try :
431438 node_restored .safe_psql ('db1' , 'select 1' )
@@ -485,8 +492,7 @@ def test_alter_table_set_tablespace_ptrack(self):
485492 ])
486493
487494 # GET RESTORED PGDATA AND COMPARE
488- pgdata_new = self .pgdata_content (node_restored .data_dir )
489- # self.compare_pgdata(pgdata, pgdata_new)
495+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
490496 # START RESTORED NODE
491497 node_restored .append_conf ('postgresql.auto.conf' , 'port = {0}' .format (node_restored .port ))
492498 node_restored .start ()
@@ -496,6 +502,8 @@ def test_alter_table_set_tablespace_ptrack(self):
496502 result_new = node_restored .safe_psql ("postgres" , "select * from t_heap" )
497503
498504 self .assertEqual (result , result_new , 'lost some data after restore' )
505+ if self .paranoia :
506+ self .compare_pgdata (pgdata , pgdata_restored )
499507
500508 # Clean after yourself
501509 self .del_test_dir (module_name , fname )
@@ -538,9 +546,10 @@ def test_alter_database_set_tablespace_ptrack(self):
538546 "-T" , "{0}={1}" .format (self .get_tblspace_path (node ,'somedata' ), self .get_tblspace_path (node_restored ,'somedata' ))])
539547
540548 # GET PHYSICAL CONTENT
541- pgdata_new = self .pgdata_content (node_restored .data_dir )
549+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
542550 # COMPARE PHYSICAL CONTENT
543- # self.compare_pgdata(pgdata, pgdata_restored)
551+ if self .paranoia :
552+ self .compare_pgdata (pgdata , pgdata_restored )
544553 # START RESTORED NODE
545554 node_restored .start ()
546555
@@ -649,9 +658,8 @@ def test_ptrack_alter_tablespace(self):
649658 "-j" , "4" , "-T" , "{0}={1}" .format (tblspc_path , tblspc_path_new )])
650659 result = node .safe_psql ("postgres" , "select * from t_heap" )
651660
652- pgdata_new = self .pgdata_content (restored_node .data_dir )
653- # COMPARE PHYSICAL CONTENT
654- # self.compare_pgdata(pgdata, pgdata_restored)
661+ pgdata_restored = self .pgdata_content (restored_node .data_dir )
662+
655663 # START RESTORED NODE
656664 restored_node .append_conf ("postgresql.auto.conf" , "port = {0}" .format (restored_node .port ))
657665 restored_node .start ()
@@ -660,6 +668,11 @@ def test_ptrack_alter_tablespace(self):
660668
661669 result_new = restored_node .safe_psql ("postgres" , "select * from t_heap" )
662670 self .assertEqual (result , result_new )
671+
672+ # COMPARE PHYSICAL CONTENT
673+ if self .paranoia :
674+ self .compare_pgdata (pgdata , pgdata_restored )
675+
663676 restored_node .cleanup ()
664677 shutil .rmtree (tblspc_path_new , ignore_errors = True )
665678
@@ -675,9 +688,8 @@ def test_ptrack_alter_tablespace(self):
675688 "-j" , "4" , "-T" , "{0}={1}" .format (tblspc_path , tblspc_path_new )])
676689 restored_node .append_conf ("postgresql.auto.conf" , "port = {0}" .format (restored_node .port ))
677690
678- # COMPARE PHYSICAL CONTENT
679- pgdata_new = self .pgdata_content (restored_node .data_dir )
680- # self.compare_pgdata(pgdata, pgdata_restored)
691+ # GET PHYSICAL CONTENT
692+ pgdata_restored = self .pgdata_content (restored_node .data_dir )
681693
682694 # START RESTORED NODE
683695 restored_node .start ()
@@ -687,13 +699,16 @@ def test_ptrack_alter_tablespace(self):
687699 result_new = restored_node .safe_psql ("postgres" , "select * from t_heap" )
688700 self .assertEqual (result , result_new )
689701
702+ if self .paranoia :
703+ # COMPARE PHYSICAL CONTENT
704+ self .compare_pgdata (pgdata , pgdata_restored )
705+
690706 # Clean after yourself
691707 self .del_test_dir (module_name , fname )
692708
693709 # @unittest.skip("skip")
694710 def test_relation_with_multiple_segments (self ):
695711 """Make node, create table, alter table tablespace, take ptrack backup, move table from tablespace, take ptrack backup"""
696- self .maxDiff = None
697712 fname = self .id ().split ('.' )[3 ]
698713 backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
699714 node = self .make_simple_node (base_dir = "{0}/{1}/node" .format (module_name , fname ),
@@ -736,7 +751,6 @@ def test_relation_with_multiple_segments(self):
736751
737752 # GET PHYSICAL CONTENT FROM NODE_RESTORED
738753 pgdata_restored = self .pgdata_content (restored_node .data_dir )
739- # self.compare_pgdata(pgdata, pgdata_restored)
740754
741755 # START RESTORED NODE
742756 restored_node .append_conf ("postgresql.auto.conf" , "port = {0}" .format (restored_node .port ))
@@ -745,7 +759,12 @@ def test_relation_with_multiple_segments(self):
745759 time .sleep (1 )
746760
747761 result_new = restored_node .safe_psql ("postgres" , "select * from pgbench_accounts" )
762+
763+ # COMPARE RESTORED FILES
748764 self .assertEqual (result , result_new )
749765
766+ if self .paranoia :
767+ self .compare_pgdata (pgdata , pgdata_restored )
768+
750769 # Clean after yourself
751770 self .del_test_dir (module_name , fname )
0 commit comments