@@ -25,10 +25,8 @@ def test_retention_redundancy_1(self):
25
25
self .set_archiving (backup_dir , 'node' , node )
26
26
node .slow_start ()
27
27
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' ])
32
30
33
31
# Make backups to be purged
34
32
self .backup_node (backup_dir , 'node' , node )
@@ -39,31 +37,31 @@ def test_retention_redundancy_1(self):
39
37
40
38
self .assertEqual (len (self .show_pb (backup_dir , 'node' )), 4 )
41
39
40
+ output_before = self .show_archive (backup_dir , 'node' , tli = 1 )
41
+
42
42
# Purge backups
43
43
log = self .delete_expired (
44
44
backup_dir , 'node' , options = ['--expired' , '--wal' ])
45
45
self .assertEqual (len (self .show_pb (backup_dir , 'node' )), 2 )
46
46
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 )
55
48
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' ])
58
52
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' ]
61
60
62
61
for wal_name in os .listdir (os .path .join (backup_dir , 'wal' , 'node' )):
63
62
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 )
67
65
68
66
# Clean after yourself
69
67
self .del_test_dir (module_name , fname )
@@ -1353,7 +1351,7 @@ def test_window_error_backups_2(self):
1353
1351
1354
1352
gdb .set_breakpoint ('pg_stop_backup' )
1355
1353
gdb .run_until_break ()
1356
- gdb ._execute ('signal SIGTERM ' )
1354
+ gdb ._execute ('signal SIGKILL ' )
1357
1355
gdb .continue_execution_until_error ()
1358
1356
1359
1357
page_id = self .show_pb (backup_dir , 'node' )[1 ]['id' ]
0 commit comments