@@ -77,7 +77,7 @@ def test_validate_wal_unreal_values(self):
77
77
self .assertEqual (1 , 0 , "Expecting Error because of validation to unreal time.\n Output: {0} \n CMD: {1}" .format (
78
78
repr (self .output ), self .cmd ))
79
79
except ProbackupException , e :
80
- self .assertTrue (re . match ( 'WARNING: recovery can be done up to time [0-9-: ]+ and xid \d+ \n ERROR: not enough WAL records to time {0} \n \Z' . format ( unreal_time_2 ), e .message ) ,
80
+ self .assertTrue ('ERROR: not enough WAL records to time' in e .message ,
81
81
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
82
82
83
83
# Validate to real xid
@@ -98,7 +98,7 @@ def test_validate_wal_unreal_values(self):
98
98
self .assertEqual (1 , 0 , "Expecting Error because of validation to unreal xid.\n Output: {0} \n CMD: {1}" .format (
99
99
repr (self .output ), self .cmd ))
100
100
except ProbackupException , e :
101
- self .assertTrue (re . match ( 'WARNING: recovery can be done up to time [0-9-: ]+ and xid \d+ \n ERROR: not enough WAL records to xid \d+ \n \Z' , e .message ) ,
101
+ self .assertTrue ('ERROR: not enough WAL records to xid' in e .message ,
102
102
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
103
103
104
104
# Validate with backup ID
@@ -135,8 +135,8 @@ def test_validate_corrupt_wal_1(self):
135
135
wals .sort ()
136
136
for wal in wals :
137
137
f = open (os .path .join (wals_dir , wal ), "rb+" )
138
- f .seek (256 )
139
- f .write (six .b ("blablabla " ))
138
+ f .seek (42 )
139
+ f .write (six .b ("blablablaadssaaaaaaaaaaaaaaa " ))
140
140
f .close
141
141
142
142
# Simple validate
@@ -145,9 +145,8 @@ def test_validate_corrupt_wal_1(self):
145
145
self .assertEqual (1 , 0 , "Expecting Error because of wal segments corruption.\n Output: {0} \n CMD: {1}" .format (
146
146
repr (self .output ), self .cmd ))
147
147
except ProbackupException , e :
148
- #TODO assert correct error message
149
- self .assertTrue (re .match ('Possible WAL CORRUPTION\Z' , e .message ),
150
- '\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
148
+ self .assertTrue ('Possible WAL CORRUPTION' in e .message ),
149
+ '\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd )
151
150
152
151
self .assertEqual ('CORRUPT' , self .show_pb (node , id = backup_id )['status' ], 'Backup STATUS should be "CORRUPT"' )
153
152
node .stop ()
@@ -188,7 +187,7 @@ def test_validate_corrupt_wal_2(self):
188
187
wals .sort ()
189
188
for wal in wals :
190
189
f = open (os .path .join (wals_dir , wal ), "rb+" )
191
- f .seek (256 )
190
+ f .seek (0 )
192
191
f .write (six .b ("blablabla" ))
193
192
f .close
194
193
@@ -198,9 +197,8 @@ def test_validate_corrupt_wal_2(self):
198
197
self .assertEqual (1 , 0 , "Expecting Error because of wal segments corruption.\n Output: {0} \n CMD: {1}" .format (
199
198
repr (self .output ), self .cmd ))
200
199
except ProbackupException , e :
201
- #TODO assert correct error message
202
- self .assertTrue (re .match ('Possible WAL CORRUPTION\Z' , e .message ),
203
- '\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
200
+ self .assertTrue ('Possible WAL CORRUPTION' in e .message ),
201
+ '\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd )
204
202
205
203
self .assertEqual ('CORRUPT' , self .show_pb (node , id = backup_id )['status' ], 'Backup STATUS should be "CORRUPT"' )
206
204
node .stop ()
0 commit comments