@@ -1708,3 +1708,55 @@ def test_ptrack_multiple_segments(self):
1708
1708
1709
1709
# Clean after yourself
1710
1710
self .del_test_dir (module_name , fname )
1711
+
1712
+ # @unittest.skip("skip")
1713
+ # @unittest.expectedFailure
1714
+ def test_atexit_fail (self ):
1715
+ """
1716
+ Take backups of every available types and check that PTRACK is clean
1717
+ """
1718
+ fname = self .id ().split ('.' )[3 ]
1719
+ node = self .make_simple_node (
1720
+ base_dir = "{0}/{1}/node" .format (module_name , fname ),
1721
+ set_replication = True ,
1722
+ initdb_params = ['--data-checksums' ],
1723
+ pg_options = {
1724
+ 'ptrack_enable' : 'on' ,
1725
+ 'wal_level' : 'replica' ,
1726
+ 'max_wal_senders' : '2' })
1727
+ backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
1728
+ self .init_pb (backup_dir )
1729
+ self .add_instance (backup_dir , 'node' , node )
1730
+ node .start ()
1731
+
1732
+ # Take FULL backup to clean every ptrack
1733
+ self .backup_node (
1734
+ backup_dir , 'node' , node , options = ['--stream' ])
1735
+
1736
+ try :
1737
+ self .backup_node (
1738
+ backup_dir , 'node' , node , backup_type = 'ptrack' ,
1739
+ options = ["--stream" , "-j 200" ]
1740
+ )
1741
+ # we should die here because exception is what we expect to happen
1742
+ self .assertEqual (
1743
+ 1 , 0 ,
1744
+ "Expecting Error because we are opening too many connections"
1745
+ "\n Output: {0} \n CMD: {1}" .format (
1746
+ repr (self .output ), self .cmd )
1747
+ )
1748
+ except ProbackupException as e :
1749
+ self .assertIn (
1750
+ 'setting its status to ERROR' ,
1751
+ e .message ,
1752
+ '\n Unexpected Error Message: {0}\n '
1753
+ ' CMD: {1}' .format (repr (e .message ), self .cmd )
1754
+ )
1755
+
1756
+ self .assertFalse (
1757
+ node .safe_psql (
1758
+ "postgres" ,
1759
+ "select * from pg_is_in_backup()" ).rstrip ())
1760
+
1761
+ # Clean after yourself
1762
+ self .del_test_dir (module_name , fname )
0 commit comments