@@ -353,9 +353,63 @@ def test_locking_restore_locked(self):
353
353
repr (self .output ), self .cmd ))
354
354
except ProbackupException as e :
355
355
self .assertTrue (
356
- "Insert expected error message" .format (
357
- backup_id ) in e .message ,
358
- e .message ,
356
+ "Insert expected error message" in e .message ,
357
+ '\n Unexpected Error Message: {0}\n CMD: {1}' .format (
358
+ repr (e .message ), self .cmd ))
359
+
360
+ # Clean after yourself
361
+ self .del_test_dir (module_name , fname )
362
+
363
+ def test_locking_restore_locked_without_validation (self ):
364
+ """
365
+ make node, take full backup, take page backup,
366
+ launch validate on FULL and stop it in the middle,
367
+ launch restore of PAGE.
368
+ Expect restore to fail because validation of
369
+ intermediate backup is impossible
370
+ """
371
+ fname = self .id ().split ('.' )[3 ]
372
+ node = self .make_simple_node (
373
+ base_dir = os .path .join (module_name , fname , 'node' ),
374
+ initdb_params = ['--data-checksums' ],
375
+ pg_options = {'wal_level' : 'replica' })
376
+
377
+ backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
378
+ self .init_pb (backup_dir )
379
+ self .add_instance (backup_dir , 'node' , node )
380
+ self .set_archiving (backup_dir , 'node' , node )
381
+ node .slow_start ()
382
+
383
+ # FULL
384
+ backup_id = self .backup_node (backup_dir , 'node' , node )
385
+
386
+ # PAGE1
387
+ restore_id = self .backup_node (backup_dir , 'node' , node , backup_type = 'page' )
388
+
389
+ gdb = self .validate_pb (
390
+ backup_dir , 'node' , backup_id = backup_id , gdb = True )
391
+
392
+ gdb .set_breakpoint ('pgBackupValidate' )
393
+ gdb .run_until_break ()
394
+
395
+ node .cleanup ()
396
+
397
+ try :
398
+ self .restore_node (
399
+ backup_dir , 'node' , node , options = ['--no-validate' ])
400
+ self .assertEqual (
401
+ 1 , 0 ,
402
+ "Expecting Error because restore without whole chain validation "
403
+ "is prohibited unless --no-validate provided.\n "
404
+ "Output: {0} \n CMD: {1}" .format (
405
+ repr (self .output ), self .cmd ))
406
+ except ProbackupException as e :
407
+ self .assertTrue (
408
+ "Backup {0} is used without validation" .format (
409
+ restore_id ) in e .message and
410
+ 'is using backup {0} and still is running' .format (
411
+ backup_id ) in e .message and
412
+ 'ERROR: Cannot lock backup directory' in e .message ,
359
413
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (
360
414
repr (e .message ), self .cmd ))
361
415
0 commit comments