@@ -42,7 +42,9 @@ def test_without_backup_path_3(self):
42
42
self .assertEqual (1 , 0 , "Expecting Error because '-B' parameter is not specified.\n Output: {0} \n CMD: {1}" .format (
43
43
repr (self .output ), self .cmd ))
44
44
except ProbackupException as e :
45
- self .assertEqual (e .message , 'ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path)\n ' ,
45
+ self .assertIn (
46
+ 'ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path)' ,
47
+ e .message ,
46
48
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
47
49
48
50
@@ -63,8 +65,9 @@ def test_options_4(self):
63
65
self .assertEqual (1 , 0 , "Expecting Error because 'instance' parameter is not specified.\n Output: {0} \n CMD: {1}" .format (
64
66
repr (self .output ), self .cmd ))
65
67
except ProbackupException as e :
66
- self .assertEqual (e .message ,
67
- 'ERROR: required parameter not specified: --instance\n ' ,
68
+ self .assertIn (
69
+ 'ERROR: required parameter not specified: --instance' ,
70
+ e .message ,
68
71
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
69
72
70
73
# backup command failure without backup mode option
@@ -73,7 +76,8 @@ def test_options_4(self):
73
76
self .assertEqual (1 , 0 , "Expecting Error because '-b' parameter is not specified.\n Output: {0} \n CMD: {1}" .format (
74
77
repr (self .output ), self .cmd ))
75
78
except ProbackupException as e :
76
- self .assertIn ('ERROR: required parameter not specified: BACKUP_MODE (-b, --backup-mode)' ,
79
+ self .assertIn (
80
+ 'ERROR: required parameter not specified: BACKUP_MODE (-b, --backup-mode)' ,
77
81
e .message ,
78
82
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
79
83
@@ -83,8 +87,9 @@ def test_options_4(self):
83
87
self .assertEqual (1 , 0 , "Expecting Error because backup-mode parameter is invalid.\n Output: {0} \n CMD: {1}" .format (
84
88
repr (self .output ), self .cmd ))
85
89
except ProbackupException as e :
86
- self .assertEqual (e .message ,
87
- 'ERROR: invalid backup-mode "bad"\n ' ,
90
+ self .assertIn (
91
+ 'ERROR: invalid backup-mode "bad"' ,
92
+ e .message ,
88
93
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
89
94
90
95
# delete failure without delete options
@@ -94,8 +99,9 @@ def test_options_4(self):
94
99
self .assertEqual (1 , 0 , "Expecting Error because delete options are omitted.\n Output: {0} \n CMD: {1}" .format (
95
100
repr (self .output ), self .cmd ))
96
101
except ProbackupException as e :
97
- self .assertEqual (e .message ,
98
- 'ERROR: You must specify at least one of the delete options: --expired |--wal |--merge-expired |--delete-invalid |--backup_id\n ' ,
102
+ self .assertIn (
103
+ 'ERROR: You must specify at least one of the delete options: --expired |--wal |--merge-expired |--delete-invalid |--backup_id' ,
104
+ e .message ,
99
105
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
100
106
101
107
@@ -106,7 +112,9 @@ def test_options_4(self):
106
112
self .assertEqual (1 , 0 , "Expecting Error because backup ID is omitted.\n Output: {0} \n CMD: {1}" .format (
107
113
repr (self .output ), self .cmd ))
108
114
except ProbackupException as e :
109
- self .assertTrue ("option requires an argument -- 'i'" in e .message ,
115
+ self .assertIn (
116
+ "option requires an argument -- 'i'" ,
117
+ e .message ,
110
118
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
111
119
112
120
# Clean after yourself
@@ -118,12 +126,16 @@ def test_options_5(self):
118
126
fname = self .id ().split ("." )[3 ]
119
127
backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
120
128
node = self .make_simple_node (
121
- base_dir = os .path .join (module_name , fname , 'node' ),
122
- pg_options = {
123
- 'max_wal_senders' : '2' })
129
+ base_dir = os .path .join (module_name , fname , 'node' ))
124
130
125
- self .assertEqual ("INFO: Backup catalog '{0}' successfully inited\n " .format (backup_dir ),
126
- self .init_pb (backup_dir ))
131
+ output = self .init_pb (backup_dir )
132
+ self .assertIn (
133
+ "INFO: Backup catalog" ,
134
+ output )
135
+
136
+ self .assertIn (
137
+ "successfully inited" ,
138
+ output )
127
139
self .add_instance (backup_dir , 'node' , node )
128
140
129
141
node .slow_start ()
@@ -138,8 +150,9 @@ def test_options_5(self):
138
150
self .assertEqual (1 , 0 , "Expecting Error because of garbage in pg_probackup.conf.\n Output: {0} \n CMD: {1}" .format (
139
151
repr (self .output ), self .cmd ))
140
152
except ProbackupException as e :
141
- self .assertEqual (e .message ,
142
- 'ERROR: Syntax error in " = INFINITE"\n ' ,
153
+ self .assertIn (
154
+ 'ERROR: Syntax error in " = INFINITE' ,
155
+ e .message ,
143
156
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
144
157
145
158
self .clean_pb (backup_dir )
@@ -156,8 +169,9 @@ def test_options_5(self):
156
169
self .assertEqual (1 , 0 , "Expecting Error because of invalid backup-mode in pg_probackup.conf.\n Output: {0} \n CMD: {1}" .format (
157
170
repr (self .output ), self .cmd ))
158
171
except ProbackupException as e :
159
- self .assertEqual (e .message ,
160
- 'ERROR: Invalid option "BACKUP_MODE" in file "{0}"\n ' .format (conf_file ),
172
+ self .assertIn (
173
+ 'ERROR: Invalid option "BACKUP_MODE" in file' ,
174
+ e .message ,
161
175
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
162
176
163
177
self .clean_pb (backup_dir )
@@ -177,8 +191,9 @@ def test_options_5(self):
177
191
self .assertEqual (1 , 0 , "Expecting Error because option system-identifier cannot be specified in command line.\n Output: {0} \n CMD: {1}" .format (
178
192
repr (self .output ), self .cmd ))
179
193
except ProbackupException as e :
180
- self .assertEqual (e .message ,
181
- 'ERROR: Option system-identifier cannot be specified in command line\n ' ,
194
+ self .assertIn (
195
+ 'ERROR: Option system-identifier cannot be specified in command line' ,
196
+ e .message ,
182
197
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
183
198
184
199
# invalid value in pg_probackup.conf
@@ -191,8 +206,9 @@ def test_options_5(self):
191
206
self .assertEqual (1 , 0 , "Expecting Error because option -C should be boolean.\n Output: {0} \n CMD: {1}" .format (
192
207
repr (self .output ), self .cmd ))
193
208
except ProbackupException as e :
194
- self .assertEqual (e .message ,
195
- 'ERROR: Invalid option "SMOOTH_CHECKPOINT" in file "{0}"\n ' .format (conf_file ),
209
+ self .assertIn (
210
+ 'ERROR: Invalid option "SMOOTH_CHECKPOINT" in file' ,
211
+ e .message ,
196
212
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
197
213
198
214
self .clean_pb (backup_dir )
@@ -209,8 +225,9 @@ def test_options_5(self):
209
225
self .assertEqual (1 , 0 , 'Expecting Error because of invalid option "TIMELINEID".\n Output: {0} \n CMD: {1}' .format (
210
226
repr (self .output ), self .cmd ))
211
227
except ProbackupException as e :
212
- self .assertEqual (e .message ,
213
- 'ERROR: Invalid option "TIMELINEID" in file "{0}"\n ' .format (conf_file ),
228
+ self .assertIn (
229
+ 'ERROR: Invalid option "TIMELINEID" in file' ,
230
+ e .message ,
214
231
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ), self .cmd ))
215
232
216
233
# Clean after yourself
0 commit comments