@@ -11,14 +11,19 @@ class ExcludeTest(ProbackupTest, unittest.TestCase):
11
11
# @unittest.skip("skip")
12
12
# @unittest.expectedFailure
13
13
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
+ """
15
18
fname = self .id ().split ('.' )[3 ]
16
19
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 ),
18
22
set_replication = True ,
19
23
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' }
22
27
)
23
28
24
29
self .init_pb (backup_dir )
@@ -28,10 +33,14 @@ def test_exclude_temp_tables(self):
28
33
conn = node .connect ()
29
34
with node .connect ("postgres" ) as conn :
30
35
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" )
32
39
conn .commit ()
33
40
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 ]
35
44
conn .commit ()
36
45
37
46
temp_toast_schema_name = "pg_toast_" + temp_schema_name .replace ("pg_" , "" )
@@ -60,18 +69,24 @@ def test_exclude_temp_tables(self):
60
69
temp_toast_filename = os .path .basename (toast_path )
61
70
temp_idx_toast_filename = os .path .basename (toast_idx_path )
62
71
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' ])
64
74
65
75
for root , dirs , files in os .walk (backup_dir ):
66
76
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 ))
75
90
76
91
# Clean after yourself
77
92
self .del_test_dir (module_name , fname )
@@ -92,7 +107,7 @@ def test_exclude_unlogged_tables_1(self):
92
107
pg_options = {
93
108
'wal_level' : 'replica' ,
94
109
'max_wal_senders' : '2' ,
95
- "shared_buffers" : "1GB " ,
110
+ "shared_buffers" : "10MB " ,
96
111
"fsync" : "off" ,
97
112
'ptrack_enable' : 'on' }
98
113
)
0 commit comments