@@ -249,7 +249,8 @@ def test_validate_corrupted_intermediate_backup(self):
249249
250250 # Corrupt some file
251251 file = os .path .join (
252- backup_dir , 'backups/node' , backup_id_2 , 'database' , file_path )
252+ backup_dir , 'backups' , 'node' ,
253+ backup_id_2 , 'database' , file_path )
253254 with open (file , "r+b" , 0 ) as f :
254255 f .seek (42 )
255256 f .write (b"blah" )
@@ -342,7 +343,7 @@ def test_validate_corrupted_intermediate_backups(self):
342343
343344 # Corrupt some file in FULL backup
344345 file_full = os .path .join (
345- backup_dir , 'backups/ node' ,
346+ backup_dir , 'backups' , ' node' ,
346347 backup_id_1 , 'database' , file_path_t_heap )
347348 with open (file_full , "rb+" , 0 ) as f :
348349 f .seek (84 )
@@ -352,7 +353,7 @@ def test_validate_corrupted_intermediate_backups(self):
352353
353354 # Corrupt some file in PAGE1 backup
354355 file_page1 = os .path .join (
355- backup_dir , 'backups/ node' ,
356+ backup_dir , 'backups' , ' node' ,
356357 backup_id_2 , 'database' , file_path_t_heap_1 )
357358 with open (file_page1 , "rb+" , 0 ) as f :
358359 f .seek (42 )
@@ -379,8 +380,7 @@ def test_validate_corrupted_intermediate_backups(self):
379380 self .assertTrue (
380381 'INFO: Validating backup {0}' .format (
381382 backup_id_1 ) in e .message and
382- 'WARNING: Invalid CRC of backup file "{0}"' .format (
383- file_full ) in e .message and
383+ 'WARNING: Invalid CRC of backup file' in e .message and
384384 'WARNING: Backup {0} data files are corrupted' .format (
385385 backup_id_1 ) in e .message ,
386386 '\n Unexpected Error Message: {0}\n CMD: {1}' .format (
@@ -499,15 +499,15 @@ def test_validate_corrupted_intermediate_backups_1(self):
499499
500500 # Corrupt some file in PAGE2 and PAGE5 backups
501501 file_page1 = os .path .join (
502- backup_dir , 'backups/ node' , backup_id_3 , 'database' , file_page_2 )
502+ backup_dir , 'backups' , ' node' , backup_id_3 , 'database' , file_page_2 )
503503 with open (file_page1 , "rb+" , 0 ) as f :
504504 f .seek (84 )
505505 f .write (b"blah" )
506506 f .flush ()
507507 f .close
508508
509509 file_page4 = os .path .join (
510- backup_dir , 'backups/ node' , backup_id_6 , 'database' , file_page_5 )
510+ backup_dir , 'backups' , ' node' , backup_id_6 , 'database' , file_page_5 )
511511 with open (file_page4 , "rb+" , 0 ) as f :
512512 f .seek (42 )
513513 f .write (b"blah" )
@@ -547,8 +547,7 @@ def test_validate_corrupted_intermediate_backups_1(self):
547547 self .assertTrue (
548548 'INFO: Validating backup {0}' .format (
549549 backup_id_3 ) in e .message and
550- 'WARNING: Invalid CRC of backup file "{0}"' .format (
551- file_page1 ) in e .message and
550+ 'WARNING: Invalid CRC of backup file' in e .message and
552551 'WARNING: Backup {0} data files are corrupted' .format (
553552 backup_id_3 ) in e .message ,
554553 '\n Unexpected Error Message: {0}\n CMD: {1}' .format (
@@ -698,15 +697,17 @@ def test_validate_specific_target_corrupted_intermediate_backups(self):
698697
699698 # Corrupt some file in PAGE2 and PAGE5 backups
700699 file_page1 = os .path .join (
701- backup_dir , 'backups/node' , backup_id_3 , 'database' , file_page_2 )
700+ backup_dir , 'backups' , 'node' ,
701+ backup_id_3 , 'database' , file_page_2 )
702702 with open (file_page1 , "rb+" , 0 ) as f :
703703 f .seek (84 )
704704 f .write (b"blah" )
705705 f .flush ()
706706 f .close
707707
708708 file_page4 = os .path .join (
709- backup_dir , 'backups/node' , backup_id_6 , 'database' , file_page_5 )
709+ backup_dir , 'backups' , 'node' ,
710+ backup_id_6 , 'database' , file_page_5 )
710711 with open (file_page4 , "rb+" , 0 ) as f :
711712 f .seek (42 )
712713 f .write (b"blah" )
@@ -747,8 +748,7 @@ def test_validate_specific_target_corrupted_intermediate_backups(self):
747748 self .assertTrue (
748749 'INFO: Validating backup {0}' .format (
749750 backup_id_3 ) in e .message and
750- 'WARNING: Invalid CRC of backup file "{0}"' .format (
751- file_page1 ) in e .message and
751+ 'WARNING: Invalid CRC of backup file' in e .message and
752752 'WARNING: Backup {0} data files are corrupted' .format (
753753 backup_id_3 ) in e .message ,
754754 '\n Unexpected Error Message: {0}\n CMD: {1}' .format (
@@ -851,7 +851,7 @@ def test_validate_instance_with_corrupted_page(self):
851851
852852 # Corrupt some file in FULL backup
853853 file_full = os .path .join (
854- backup_dir , 'backups/ node' , backup_id_2 ,
854+ backup_dir , 'backups' , ' node' , backup_id_2 ,
855855 'database' , file_path_t_heap1 )
856856 with open (file_full , "rb+" , 0 ) as f :
857857 f .seek (84 )
@@ -906,8 +906,7 @@ def test_validate_instance_with_corrupted_page(self):
906906 self .assertTrue (
907907 'INFO: Validating backup {0}' .format (
908908 backup_id_2 ) in e .message and
909- 'WARNING: Invalid CRC of backup file "{0}"' .format (
910- file_full ) in e .message and
909+ 'WARNING: Invalid CRC of backup file' in e .message and
911910 'WARNING: Backup {0} data files are corrupted' .format (
912911 backup_id_2 ) in e .message ,
913912 '\n Unexpected Error Message: {0}\n CMD: {1}' .format (
@@ -964,7 +963,9 @@ def test_validate_instance_with_corrupted_full_and_try_restore(self):
964963
965964 node .safe_psql (
966965 "postgres" ,
967- "create table t_heap as select i as id, md5(i::text) as text, md5(repeat(i::text,10))::tsvector as tsvector from generate_series(0,10000) i" )
966+ "create table t_heap as select i as id, md5(i::text) as text, "
967+ "md5(repeat(i::text,10))::tsvector as tsvector "
968+ "from generate_series(0,10000) i" )
968969 file_path_t_heap = node .safe_psql (
969970 "postgres" ,
970971 "select pg_relation_filepath('t_heap')" ).rstrip ()
@@ -973,14 +974,18 @@ def test_validate_instance_with_corrupted_full_and_try_restore(self):
973974
974975 node .safe_psql (
975976 "postgres" ,
976- "insert into t_heap select i as id, md5(i::text) as text, md5(repeat(i::text,10))::tsvector as tsvector from generate_series(0,10000) i" )
977+ "insert into t_heap select i as id, md5(i::text) as text, "
978+ "md5(repeat(i::text,10))::tsvector as tsvector "
979+ "from generate_series(0,10000) i" )
977980 # PAGE1
978981 backup_id_2 = self .backup_node (backup_dir , 'node' , node , backup_type = 'page' )
979982
980983 # PAGE2
981984 node .safe_psql (
982985 "postgres" ,
983- "insert into t_heap select i as id, md5(i::text) as text, md5(repeat(i::text,10))::tsvector as tsvector from generate_series(20000,30000) i" )
986+ "insert into t_heap select i as id, md5(i::text) as text, "
987+ "md5(repeat(i::text,10))::tsvector as tsvector "
988+ "from generate_series(20000,30000) i" )
984989 backup_id_3 = self .backup_node (backup_dir , 'node' , node , backup_type = 'page' )
985990
986991 # FULL1
@@ -989,11 +994,15 @@ def test_validate_instance_with_corrupted_full_and_try_restore(self):
989994 # PAGE3
990995 node .safe_psql (
991996 "postgres" ,
992- "insert into t_heap select i as id, md5(i::text) as text, md5(repeat(i::text,10))::tsvector as tsvector from generate_series(30000,40000) i" )
997+ "insert into t_heap select i as id, "
998+ "md5(i::text) as text, md5(repeat(i::text,10))::tsvector as tsvector "
999+ "from generate_series(30000,40000) i" )
9931000 backup_id_5 = self .backup_node (backup_dir , 'node' , node , backup_type = 'page' )
9941001
9951002 # Corrupt some file in FULL backup
996- file_full = os .path .join (backup_dir , 'backups/node' , backup_id_1 , 'database' , file_path_t_heap )
1003+ file_full = os .path .join (
1004+ backup_dir , 'backups' , 'node' ,
1005+ backup_id_1 , 'database' , file_path_t_heap )
9971006 with open (file_full , "rb+" , 0 ) as f :
9981007 f .seek (84 )
9991008 f .write (b"blah" )
@@ -1009,7 +1018,7 @@ def test_validate_instance_with_corrupted_full_and_try_restore(self):
10091018 self .assertTrue (
10101019 'INFO: Validating backup {0}' .format (backup_id_1 ) in e .message
10111020 and "INFO: Validate backups of the instance 'node'" in e .message
1012- and 'WARNING: Invalid CRC of backup file "{0}"' . format ( file_full ) in e .message
1021+ and 'WARNING: Invalid CRC of backup file' in e .message
10131022 and 'WARNING: Backup {0} data files are corrupted' .format (backup_id_1 ) in e .message ,
10141023 '\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
10151024
@@ -1050,7 +1059,10 @@ def test_validate_instance_with_corrupted_full(self):
10501059
10511060 node .safe_psql (
10521061 "postgres" ,
1053- "create table t_heap as select i as id, md5(i::text) as text, md5(repeat(i::text,10))::tsvector as tsvector from generate_series(0,10000) i" )
1062+ "create table t_heap as select i as id, "
1063+ "md5(i::text) as text, md5(repeat(i::text,10))::tsvector as tsvector "
1064+ "from generate_series(0,10000) i" )
1065+
10541066 file_path_t_heap = node .safe_psql (
10551067 "postgres" ,
10561068 "select pg_relation_filepath('t_heap')" ).rstrip ()
@@ -1059,27 +1071,40 @@ def test_validate_instance_with_corrupted_full(self):
10591071
10601072 node .safe_psql (
10611073 "postgres" ,
1062- "insert into t_heap select i as id, md5(i::text) as text, md5(repeat(i::text,10))::tsvector as tsvector from generate_series(0,10000) i" )
1074+ "insert into t_heap select i as id, md5(i::text) as text, "
1075+ "md5(repeat(i::text,10))::tsvector as tsvector "
1076+ "from generate_series(0,10000) i" )
1077+
10631078 # PAGE1
1064- backup_id_2 = self .backup_node (backup_dir , 'node' , node , backup_type = 'page' )
1079+ backup_id_2 = self .backup_node (
1080+ backup_dir , 'node' , node , backup_type = 'page' )
10651081
10661082 # PAGE2
10671083 node .safe_psql (
10681084 "postgres" ,
1069- "insert into t_heap select i as id, md5(i::text) as text, md5(repeat(i::text,10))::tsvector as tsvector from generate_series(20000,30000) i" )
1070- backup_id_3 = self .backup_node (backup_dir , 'node' , node , backup_type = 'page' )
1085+ "insert into t_heap select i as id, md5(i::text) as text, "
1086+ "md5(repeat(i::text,10))::tsvector as tsvector "
1087+ "from generate_series(20000,30000) i" )
1088+
1089+ backup_id_3 = self .backup_node (
1090+ backup_dir , 'node' , node , backup_type = 'page' )
10711091
10721092 # FULL1
1073- backup_id_4 = self .backup_node (backup_dir , 'node' , node )
1093+ backup_id_4 = self .backup_node (
1094+ backup_dir , 'node' , node )
10741095
10751096 # PAGE3
10761097 node .safe_psql (
10771098 "postgres" ,
1078- "insert into t_heap select i as id, md5(i::text) as text, md5(repeat(i::text,10))::tsvector as tsvector from generate_series(30000,40000) i" )
1099+ "insert into t_heap select i as id, "
1100+ "md5(i::text) as text, md5(repeat(i::text,10))::tsvector as tsvector "
1101+ "from generate_series(30000,40000) i" )
10791102 backup_id_5 = self .backup_node (backup_dir , 'node' , node , backup_type = 'page' )
10801103
10811104 # Corrupt some file in FULL backup
1082- file_full = os .path .join (backup_dir , 'backups/node' , backup_id_1 , 'database' , file_path_t_heap )
1105+ file_full = os .path .join (
1106+ backup_dir , 'backups' , 'node' ,
1107+ backup_id_1 , 'database' , file_path_t_heap )
10831108 with open (file_full , "rb+" , 0 ) as f :
10841109 f .seek (84 )
10851110 f .write (b"blah" )
@@ -1089,13 +1114,16 @@ def test_validate_instance_with_corrupted_full(self):
10891114 # Validate Instance
10901115 try :
10911116 self .validate_pb (backup_dir , 'node' )
1092- self .assertEqual (1 , 0 , "Expecting Error because of data files corruption.\n Output: {0} \n CMD: {1}" .format (
1093- repr (self .output ), self .cmd ))
1117+ self .assertEqual (
1118+ 1 , 0 ,
1119+ "Expecting Error because of data files corruption.\n "
1120+ "Output: {0} \n CMD: {1}" .format (
1121+ repr (self .output ), self .cmd ))
10941122 except ProbackupException as e :
10951123 self .assertTrue (
10961124 'INFO: Validating backup {0}' .format (backup_id_1 ) in e .message
10971125 and "INFO: Validate backups of the instance 'node'" in e .message
1098- and 'WARNING: Invalid CRC of backup file "{0}"' . format ( file_full ) in e .message
1126+ and 'WARNING: Invalid CRC of backup file' in e .message
10991127 and 'WARNING: Backup {0} data files are corrupted' .format (backup_id_1 ) in e .message ,
11001128 '\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
11011129
0 commit comments