@@ -311,19 +311,51 @@ def test_issue_274(self):
311311 backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
312312 self .init_pb (backup_dir )
313313 self .add_instance (backup_dir , 'node' , node )
314+ self .set_archiving (backup_dir , 'node' , node )
314315 node .slow_start ()
315316
317+ replica = self .make_simple_node (
318+ base_dir = os .path .join (module_name , fname , 'replica' ))
319+ replica .cleanup ()
320+
321+ self .backup_node (backup_dir , 'node' , node , options = ['--stream' ])
322+ self .restore_node (backup_dir , 'node' , replica )
323+
324+ # Settings for Replica
325+ self .set_replica (node , replica , synchronous = True )
326+ self .set_archiving (backup_dir , 'node' , replica , replica = True )
327+ self .set_auto_conf (replica , {'port' : replica .port })
328+
329+ replica .slow_start (replica = True )
330+
331+ node .safe_psql (
332+ "postgres" ,
333+ "create table t_heap as select i as id, md5(i::text) as text, "
334+ "md5(repeat(i::text,10))::tsvector as tsvector "
335+ "from generate_series(0,45600) i" )
336+
316337 log_dir = os .path .join (backup_dir , "somedir" )
317338
318339 try :
319340 self .backup_node (
320- backup_dir , 'node' , node , backup_type = 'page' ,
341+ backup_dir , 'node' , replica , backup_type = 'page' ,
321342 options = [
322343 '--log-level-console=verbose' , '--log-level-file=verbose' ,
323344 '--log-directory={0}' .format (log_dir ), '-j1' ,
324- '--log-filename=somelog.txt' , '--archive-timeout=5s' ])
325- except :
326- pass
345+ '--log-filename=somelog.txt' , '--archive-timeout=5s' ,
346+ '--no-validate' , '--log-rotation-size=100KB' ])
347+ # we should die here because exception is what we expect to happen
348+ self .assertEqual (
349+ 1 , 0 ,
350+ "Expecting Error because of archiving timeout"
351+ "\n Output: {0} \n CMD: {1}" .format (
352+ repr (self .output ), self .cmd ))
353+ except ProbackupException as e :
354+ self .assertIn (
355+ 'ERROR: WAL segment' ,
356+ e .message ,
357+ '\n Unexpected Error Message: {0}\n CMD: {1}' .format (
358+ repr (e .message ), self .cmd ))
327359
328360 log_file_path = os .path .join (
329361 log_dir , 'somelog.txt' )
@@ -334,7 +366,6 @@ def test_issue_274(self):
334366 log_content = f .read ()
335367
336368 self .assertIn ('INFO: command:' , log_content )
337- # print(log_content)
338369
339370 # Clean after yourself
340371 self .del_test_dir (module_name , fname )
0 commit comments