@@ -11,14 +11,19 @@ class ExcludeTest(ProbackupTest, unittest.TestCase):
1111 # @unittest.skip("skip")
1212 # @unittest.expectedFailure
1313 def test_exclude_temp_tables (self ):
14- """make node without archiving, create temp table, take full backup, check that temp table not present in backup catalogue"""
14+ """
15+ make node without archiving, create temp table, take full backup,
16+ check that temp table not present in backup catalogue
17+ """
1518 fname = self .id ().split ('.' )[3 ]
1619 backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
17- node = self .make_simple_node (base_dir = "{0}/{1}/node" .format (module_name , fname ),
20+ node = self .make_simple_node (
21+ base_dir = "{0}/{1}/node" .format (module_name , fname ),
1822 set_replication = True ,
1923 initdb_params = ['--data-checksums' ],
20- pg_options = {'wal_level' : 'replica' , 'max_wal_senders' : '2' , 'shared_buffers' : '1GB' ,
21- "fsync" : "off" , 'ptrack_enable' : 'on' }
24+ pg_options = {
25+ 'wal_level' : 'replica' , 'max_wal_senders' : '2' ,
26+ 'shared_buffers' : '1GB' , 'fsync' : 'off' , 'ptrack_enable' : 'on' }
2227 )
2328
2429 self .init_pb (backup_dir )
@@ -28,10 +33,14 @@ def test_exclude_temp_tables(self):
2833 conn = node .connect ()
2934 with node .connect ("postgres" ) as conn :
3035
31- conn .execute ("create temp table test as select generate_series(0,50050000)::text" )
36+ conn .execute (
37+ "create temp table test as "
38+ "select generate_series(0,50050000)::text" )
3239 conn .commit ()
3340
34- temp_schema_name = conn .execute ("SELECT nspname FROM pg_namespace WHERE oid = pg_my_temp_schema()" )[0 ][0 ]
41+ temp_schema_name = conn .execute (
42+ "SELECT nspname FROM pg_namespace "
43+ "WHERE oid = pg_my_temp_schema()" )[0 ][0 ]
3544 conn .commit ()
3645
3746 temp_toast_schema_name = "pg_toast_" + temp_schema_name .replace ("pg_" , "" )
@@ -60,18 +69,24 @@ def test_exclude_temp_tables(self):
6069 temp_toast_filename = os .path .basename (toast_path )
6170 temp_idx_toast_filename = os .path .basename (toast_idx_path )
6271
63- self .backup_node (backup_dir , 'node' , node , backup_type = 'full' , options = ['--stream' ])
72+ self .backup_node (
73+ backup_dir , 'node' , node , backup_type = 'full' , options = ['--stream' ])
6474
6575 for root , dirs , files in os .walk (backup_dir ):
6676 for file in files :
67- if file in [temp_table_filename , temp_table_filename + ".1" ,
68- temp_idx_filename ,
69- temp_idx_filename + ".1" ,
70- temp_toast_filename ,
71- temp_toast_filename + ".1" ,
72- temp_idx_toast_filename ,
73- temp_idx_toast_filename + ".1" ]:
74- self .assertEqual (1 , 0 , "Found temp table file in backup catalogue.\n Filepath: {0}" .format (file ))
77+ if file in [
78+ temp_table_filename , temp_table_filename + ".1" ,
79+ temp_idx_filename ,
80+ temp_idx_filename + ".1" ,
81+ temp_toast_filename ,
82+ temp_toast_filename + ".1" ,
83+ temp_idx_toast_filename ,
84+ temp_idx_toast_filename + ".1"
85+ ]:
86+ self .assertEqual (
87+ 1 , 0 ,
88+ "Found temp table file in backup catalogue.\n "
89+ "Filepath: {0}" .format (file ))
7590
7691 # Clean after yourself
7792 self .del_test_dir (module_name , fname )
@@ -92,7 +107,7 @@ def test_exclude_unlogged_tables_1(self):
92107 pg_options = {
93108 'wal_level' : 'replica' ,
94109 'max_wal_senders' : '2' ,
95- "shared_buffers" : "1GB " ,
110+ "shared_buffers" : "10MB " ,
96111 "fsync" : "off" ,
97112 'ptrack_enable' : 'on' }
98113 )
0 commit comments