@@ -767,21 +767,38 @@ def test_validate_corrupt_wal_2(self):
767767 wals .sort ()
768768 for wal in wals :
769769 with open (os .path .join (wals_dir , wal ), "rb+" , 0 ) as f :
770- f .seek (0 )
770+ f .seek (128 )
771771 f .write (b"blablablaadssaaaaaaaaaaaaaaa" )
772772 f .flush ()
773773 f .close
774774
775775 # Validate to xid
776776 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 ))
780789 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"' )
785802
786803 # Clean after yourself
787804 self .del_test_dir (module_name , fname )
0 commit comments