@@ -42,7 +42,9 @@ def test_without_backup_path_3(self):
4242self .assertEqual (1 ,0 ,"Expecting Error because '-B' parameter is not specified.\n Output: {0}\n CMD: {1}" .format (
4343repr (self .output ),self .cmd ))
4444except 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 ,
4648'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ),self .cmd ))
4749
4850
@@ -63,8 +65,9 @@ def test_options_4(self):
6365self .assertEqual (1 ,0 ,"Expecting Error because 'instance' parameter is not specified.\n Output: {0}\n CMD: {1}" .format (
6466repr (self .output ),self .cmd ))
6567except 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 ,
6871'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ),self .cmd ))
6972
7073# backup command failure without backup mode option
@@ -73,7 +76,8 @@ def test_options_4(self):
7376self .assertEqual (1 ,0 ,"Expecting Error because '-b' parameter is not specified.\n Output: {0}\n CMD: {1}" .format (
7477repr (self .output ),self .cmd ))
7578except 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)' ,
7781e .message ,
7882'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ),self .cmd ))
7983
@@ -83,8 +87,9 @@ def test_options_4(self):
8387self .assertEqual (1 ,0 ,"Expecting Error because backup-mode parameter is invalid.\n Output: {0}\n CMD: {1}" .format (
8488repr (self .output ),self .cmd ))
8589except 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 ,
8893'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ),self .cmd ))
8994
9095# delete failure without delete options
@@ -94,8 +99,9 @@ def test_options_4(self):
9499self .assertEqual (1 ,0 ,"Expecting Error because delete options are omitted.\n Output: {0}\n CMD: {1}" .format (
95100repr (self .output ),self .cmd ))
96101except 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 ,
99105'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ),self .cmd ))
100106
101107
@@ -106,7 +112,9 @@ def test_options_4(self):
106112self .assertEqual (1 ,0 ,"Expecting Error because backup ID is omitted.\n Output: {0}\n CMD: {1}" .format (
107113repr (self .output ),self .cmd ))
108114except 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 ,
110118'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ),self .cmd ))
111119
112120# Clean after yourself
@@ -118,12 +126,16 @@ def test_options_5(self):
118126fname = self .id ().split ("." )[3 ]
119127backup_dir = os .path .join (self .tmp_path ,module_name ,fname ,'backup' )
120128node = 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' ))
124130
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 )
127139self .add_instance (backup_dir ,'node' ,node )
128140
129141node .slow_start ()
@@ -138,8 +150,9 @@ def test_options_5(self):
138150self .assertEqual (1 ,0 ,"Expecting Error because of garbage in pg_probackup.conf.\n Output: {0}\n CMD: {1}" .format (
139151repr (self .output ),self .cmd ))
140152except 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 ,
143156'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ),self .cmd ))
144157
145158self .clean_pb (backup_dir )
@@ -156,8 +169,9 @@ def test_options_5(self):
156169self .assertEqual (1 ,0 ,"Expecting Error because of invalid backup-mode in pg_probackup.conf.\n Output: {0}\n CMD: {1}" .format (
157170repr (self .output ),self .cmd ))
158171except 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 ,
161175'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ),self .cmd ))
162176
163177self .clean_pb (backup_dir )
@@ -177,8 +191,9 @@ def test_options_5(self):
177191self .assertEqual (1 ,0 ,"Expecting Error because option system-identifier cannot be specified in command line.\n Output: {0}\n CMD: {1}" .format (
178192repr (self .output ),self .cmd ))
179193except 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 ,
182197'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ),self .cmd ))
183198
184199# invalid value in pg_probackup.conf
@@ -191,8 +206,9 @@ def test_options_5(self):
191206self .assertEqual (1 ,0 ,"Expecting Error because option -C should be boolean.\n Output: {0}\n CMD: {1}" .format (
192207repr (self .output ),self .cmd ))
193208except 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 ,
196212'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ),self .cmd ))
197213
198214self .clean_pb (backup_dir )
@@ -209,8 +225,9 @@ def test_options_5(self):
209225self .assertEqual (1 ,0 ,'Expecting Error because of invalid option "TIMELINEID".\n Output: {0}\n CMD: {1}' .format (
210226repr (self .output ),self .cmd ))
211227except 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 ,
214231'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (e .message ),self .cmd ))
215232
216233# Clean after yourself