@@ -767,21 +767,38 @@ def test_validate_corrupt_wal_2(self):
767
767
wals .sort ()
768
768
for wal in wals :
769
769
with open (os .path .join (wals_dir , wal ), "rb+" , 0 ) as f :
770
- f .seek (0 )
770
+ f .seek (128 )
771
771
f .write (b"blablablaadssaaaaaaaaaaaaaaa" )
772
772
f .flush ()
773
773
f .close
774
774
775
775
# Validate to xid
776
776
try :
777
- self .validate_pb (backup_dir , 'node' , backup_id , options = ['--xid={0}' .format (target_xid )])
778
- self .assertEqual (1 , 0 , "Expecting Error because of wal segments corruption.\n Output: {0} \n CMD: {1}" .format (
779
- repr (self .output ), self .cmd ))
777
+ self .validate_pb (
778
+ backup_dir ,
779
+ 'node' ,
780
+ backup_id ,
781
+ options = [
782
+ "--log-level-console=verbose" ,
783
+ "--xid={0}" .format (target_xid )])
784
+ self .assertEqual (
785
+ 1 , 0 ,
786
+ "Expecting Error because of wal segments corruption.\n "
787
+ " Output: {0} \n CMD: {1}" .format (
788
+ repr (self .output ), self .cmd ))
780
789
except ProbackupException as e :
781
- self .assertTrue ('Possible WAL CORRUPTION' in e .message ,
782
- '\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
783
-
784
- self .assertEqual ('CORRUPT' , self .show_pb (backup_dir , 'node' , backup_id )['status' ], 'Backup STATUS should be "CORRUPT"' )
790
+ self .assertTrue (
791
+ 'WARNING: Backup' in e .message and
792
+ 'WAL segments are corrupted' in e .message and
793
+ "WARNING: There are not enough WAL "
794
+ "records to consistenly restore backup" in e .message ,
795
+ '\n Unexpected Error Message: {0}\n CMD: {1}' .format (
796
+ repr (e .message ), self .cmd ))
797
+
798
+ self .assertEqual (
799
+ 'CORRUPT' ,
800
+ self .show_pb (backup_dir , 'node' , backup_id )['status' ],
801
+ 'Backup STATUS should be "CORRUPT"' )
785
802
786
803
# Clean after yourself
787
804
self .del_test_dir (module_name , fname )
0 commit comments