Skip to content

Commit 3dec5b3

Browse files
committed
Fix cfs tests in cfs_restore.py
1 parent 7ed8014 commit 3dec5b3

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

tests/cfs_restore.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,13 @@ def test_restore_from_fullbackup_to_new_location(self):
213213
self.node.cleanup()
214214
shutil.rmtree(self.get_tblspace_path(self.node, tblspace_name))
215215

216-
self.node_new = self.make_simple_node(base_dir="{0}/{1}/node_new_location".format(module_name, self.fname))
217-
self.node_new.cleanup()
216+
node_new = self.make_simple_node(base_dir="{0}/{1}/node_new_location".format(module_name, self.fname))
217+
node_new.cleanup()
218218

219219
try:
220-
self.restore_node(self.backup_dir, 'node', self.node_new, backup_id=self.backup_id)
220+
self.restore_node(self.backup_dir, 'node', node_new, backup_id=self.backup_id)
221+
node_new.append_conf("postgresql.auto.conf",
222+
"port = {0}".format(node_new.port))
221223
except ProbackupException as e:
222224
self.fail(
223225
"ERROR: Restore from full backup failed. \n {0} \n {1}".format(
@@ -230,7 +232,7 @@ def test_restore_from_fullbackup_to_new_location(self):
230232
"ERROR: File pg_compression not found in backup dir"
231233
)
232234
try:
233-
self.node_new.slow_start()
235+
node_new.slow_start()
234236
except ProbackupException as e:
235237
self.fail(
236238
"ERROR: Instance not started after restore. \n {0} \n {1}".format(
@@ -240,10 +242,10 @@ def test_restore_from_fullbackup_to_new_location(self):
240242
)
241243

242244
self.assertEqual(
243-
repr(self.node.safe_psql("postgres", "SELECT * FROM %s" % 't1')),
245+
repr(node_new.safe_psql("postgres", "SELECT * FROM %s" % 't1')),
244246
repr(self.table_t1)
245247
)
246-
self.node_new.cleanup()
248+
node_new.cleanup()
247249

248250
# @unittest.expectedFailure
249251
# @unittest.skip("skip")
@@ -255,11 +257,13 @@ def test_restore_from_fullbackup_to_new_location_5_jobs(self):
255257
self.node.cleanup()
256258
shutil.rmtree(self.get_tblspace_path(self.node, tblspace_name))
257259

258-
self.node_new = self.make_simple_node(base_dir="{0}/{1}/node_new_location".format(module_name, self.fname))
259-
self.node_new.cleanup()
260+
node_new = self.make_simple_node(base_dir="{0}/{1}/node_new_location".format(module_name, self.fname))
261+
node_new.cleanup()
260262

261263
try:
262-
self.restore_node(self.backup_dir, 'node', self.node_new, backup_id=self.backup_id, options=['-j', '5'])
264+
self.restore_node(self.backup_dir, 'node', node_new, backup_id=self.backup_id, options=['-j', '5'])
265+
node_new.append_conf("postgresql.auto.conf",
266+
"port = {0}".format(node_new.port))
263267
except ProbackupException as e:
264268
self.fail(
265269
"ERROR: Restore from full backup failed. \n {0} \n {1}".format(
@@ -272,7 +276,7 @@ def test_restore_from_fullbackup_to_new_location_5_jobs(self):
272276
"ERROR: File pg_compression not found in backup dir"
273277
)
274278
try:
275-
self.node_new.slow_start()
279+
node_new.slow_start()
276280
except ProbackupException as e:
277281
self.fail(
278282
"ERROR: Instance not started after restore. \n {0} \n {1}".format(
@@ -282,10 +286,10 @@ def test_restore_from_fullbackup_to_new_location_5_jobs(self):
282286
)
283287

284288
self.assertEqual(
285-
repr(self.node.safe_psql("postgres", "SELECT * FROM %s" % 't1')),
289+
repr(node_new.safe_psql("postgres", "SELECT * FROM %s" % 't1')),
286290
repr(self.table_t1)
287291
)
288-
self.node_new.cleanup()
292+
node_new.cleanup()
289293

290294
# @unittest.expectedFailure
291295
# @unittest.skip("skip")

0 commit comments

Comments
 (0)