@@ -968,7 +968,7 @@ def test_validate_wal_lost_segment_1(self):
968968 wals_dir = os .path .join (backup_dir , 'wal' , 'node' )
969969 wals = [f for f in os .listdir (wals_dir ) if os .path .isfile (os .path .join (wals_dir , f )) and not f .endswith ('.backup' )]
970970 wals .sort ()
971- file = os .path .join (backup_dir , 'wal' , 'node' , wals [3 ])
971+ file = os .path .join (backup_dir , 'wal' , 'node' , wals [- 1 ])
972972 os .remove (file )
973973
974974 # cut out '.gz'
@@ -1237,7 +1237,7 @@ def test_pgpro688(self):
12371237 self .del_test_dir (module_name , fname )
12381238
12391239 # @unittest.skip("skip")
1240- # @unittest.expectedFailure
1240+ @unittest .expectedFailure
12411241 def test_pgpro561 (self ):
12421242 """make node with archiving, make stream backup, restore it to node1, check that archiving is not successful on node1"""
12431243 fname = self .id ().split ('.' )[3 ]
@@ -1290,60 +1290,4 @@ def test_pgpro561(self):
12901290 self .assertFalse ('pg_probackup archive-push completed successfully' in log_content )
12911291
12921292 # Clean after yourself
1293- # self.del_test_dir(module_name, fname)
1294-
1295- # @unittest.skip("skip")
1296- # @unittest.expectedFailure
1297- def test_pgpro561 (self ):
1298- """make node with archiving, make stream backup, restore it to node1, check that archiving is not successful on node1"""
1299- fname = self .id ().split ('.' )[3 ]
1300- node1 = self .make_simple_node (base_dir = "{0}/{1}/node1" .format (module_name , fname ),
1301- set_replication = True ,
1302- initdb_params = ['--data-checksums' ],
1303- pg_options = {'wal_level' : 'replica' , 'max_wal_senders' : '2' }
1304- )
1305- backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
1306- self .init_pb (backup_dir )
1307- self .add_instance (backup_dir , 'node1' , node1 )
1308- self .set_archiving (backup_dir , 'node1' , node1 )
1309- node1 .start ()
1310-
1311- backup_id = self .backup_node (backup_dir , 'node1' , node1 , options = ["--stream" ])
1312-
1313- node2 = self .make_simple_node (base_dir = "{0}/{1}/node2" .format (module_name , fname ))
1314- node2 .cleanup ()
1315-
1316- node1 .psql (
1317- "postgres" ,
1318- "create table t_heap as select i as id, md5(i::text) as text, md5(repeat(i::text,10))::tsvector as tsvector from generate_series(0,256) i" )
1319-
1320- self .backup_node (backup_dir , 'node1' , node1 , backup_type = 'page' , options = ["--stream" ])
1321- self .restore_node (backup_dir , 'node1' , data_dir = node2 .data_dir )
1322- node2 .append_conf ('postgresql.auto.conf' , 'port = {0}' .format (node2 .port ))
1323- node2 .start ()
1324-
1325- timeline_node1 = node1 .get_control_data ()["Latest checkpoint's TimeLineID" ]
1326- timeline_node2 = node2 .get_control_data ()["Latest checkpoint's TimeLineID" ]
1327- self .assertEqual (timeline_node1 , timeline_node2 , "Timelines on Master and Node1 should be equal. This is unexpected" )
1328-
1329- archive_command_node1 = node1 .safe_psql ("postgres" , "show archive_command" )
1330- archive_command_node2 = node2 .safe_psql ("postgres" , "show archive_command" )
1331- self .assertEqual (archive_command_node1 , archive_command_node2 , "Archive command on Master and Node should be equal. This is unexpected" )
1332-
1333- #result = node2.safe_psql("postgres", "select last_failed_wal from pg_stat_get_archiver() where last_failed_wal is not NULL")
1334- ## self.assertEqual(res, six.b(""), 'Restored Node1 failed to archive segment {0} due to having the same archive command as Master'.format(res.rstrip()))
1335- #if result == "":
1336- # self.assertEqual(1, 0, 'Error is expected due to Master and Node1 having the common archive and archive_command')
1337-
1338- log_file = os .path .join (node2 .logs_dir , 'postgresql.log' )
1339- with open (log_file , 'r' ) as f :
1340- log_content = f .read ()
1341- self .assertTrue ('LOG: archive command failed with exit code 1' in log_content
1342- and 'DETAIL: The failed archive command was:' in log_content
1343- and 'INFO: pg_probackup archive-push from' in log_content ,
1344- 'Expecting error messages about failed archive_command'
1345- )
1346- self .assertFalse ('pg_probackup archive-push completed successfully' in log_content )
1347-
1348- # Clean after yourself
1349- # self.del_test_dir(module_name, fname)
1293+ self .del_test_dir (module_name , fname )
0 commit comments