@@ -25,10 +25,8 @@ def test_retention_redundancy_1(self):
2525 self .set_archiving (backup_dir , 'node' , node )
2626 node .slow_start ()
2727
28- with open (os .path .join (
29- backup_dir , 'backups' , 'node' ,
30- "pg_probackup.conf" ), "a" ) as conf :
31- conf .write ("retention-redundancy = 1\n " )
28+ self .set_config (
29+ backup_dir , 'node' , options = ['--retention-redundancy=1' ])
3230
3331 # Make backups to be purged
3432 self .backup_node (backup_dir , 'node' , node )
@@ -39,31 +37,31 @@ def test_retention_redundancy_1(self):
3937
4038 self .assertEqual (len (self .show_pb (backup_dir , 'node' )), 4 )
4139
40+ output_before = self .show_archive (backup_dir , 'node' , tli = 1 )
41+
4242 # Purge backups
4343 log = self .delete_expired (
4444 backup_dir , 'node' , options = ['--expired' , '--wal' ])
4545 self .assertEqual (len (self .show_pb (backup_dir , 'node' )), 2 )
4646
47- # Check that WAL segments were deleted
48- min_wal = None
49- max_wal = None
50- for line in log .splitlines ():
51- if line .startswith ("INFO: removed min WAL segment" ):
52- min_wal = line [31 :- 1 ]
53- elif line .startswith ("INFO: removed max WAL segment" ):
54- max_wal = line [31 :- 1 ]
47+ output_after = self .show_archive (backup_dir , 'node' , tli = 1 )
5548
56- if not min_wal :
57- self .assertTrue (False , "min_wal is empty" )
49+ self .assertEqual (
50+ output_before ['max-segno' ],
51+ output_after ['max-segno' ])
5852
59- if not max_wal :
60- self .assertTrue (False , "max_wal is not set" )
53+ self .assertNotEqual (
54+ output_before ['min-segno' ],
55+ output_after ['min-segno' ])
56+
57+ # Check that WAL segments were deleted
58+ min_wal = output_after ['min-segno' ]
59+ max_wal = output_after ['max-segno' ]
6160
6261 for wal_name in os .listdir (os .path .join (backup_dir , 'wal' , 'node' )):
6362 if not wal_name .endswith (".backup" ):
64- # wal_name_b = wal_name.encode('ascii')
65- self .assertEqual (wal_name [8 :] > min_wal [8 :], True )
66- self .assertEqual (wal_name [8 :] > max_wal [8 :], True )
63+ self .assertTrue (wal_name [8 :] >= min_wal )
64+ self .assertTrue (wal_name [8 :] <= max_wal )
6765
6866 # Clean after yourself
6967 self .del_test_dir (module_name , fname )
@@ -1353,7 +1351,7 @@ def test_window_error_backups_2(self):
13531351
13541352 gdb .set_breakpoint ('pg_stop_backup' )
13551353 gdb .run_until_break ()
1356- gdb ._execute ('signal SIGTERM ' )
1354+ gdb ._execute ('signal SIGKILL ' )
13571355 gdb .continue_execution_until_error ()
13581356
13591357 page_id = self .show_pb (backup_dir , 'node' )[1 ]['id' ]
0 commit comments