You've already forked pg_probackup
mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-07-17 07:22:20 +02:00
tests: json format for show command
This commit is contained in:
@ -427,7 +427,11 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
def test_replica_archive(self):
|
||||
"""make node without archiving, take stream backup and turn it into replica, set replica with archiving, make archive backup from replica"""
|
||||
"""
|
||||
make node without archiving, take stream backup and
|
||||
turn it into replica, set replica with archiving,
|
||||
make archive backup from replica
|
||||
"""
|
||||
fname = self.id().split('.')[3]
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
master = self.make_simple_node(
|
||||
@ -468,7 +472,9 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
||||
after = replica.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||
self.assertEqual(before, after)
|
||||
|
||||
# Change data on master, take FULL backup from replica, restore taken backup and check that restored data equal to original data
|
||||
# Change data on master, take FULL backup from replica,
|
||||
# restore taken backup and check that restored data equal
|
||||
# to original data
|
||||
master.psql(
|
||||
"postgres",
|
||||
"insert into t_heap as select i as id, md5(i::text) as text, "
|
||||
@ -502,7 +508,9 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
||||
after = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||
self.assertEqual(before, after)
|
||||
|
||||
# Change data on master, make PAGE backup from replica, restore taken backup and check that restored data equal to original data
|
||||
# Change data on master, make PAGE backup from replica,
|
||||
# restore taken backup and check that restored data equal
|
||||
# to original data
|
||||
master.psql(
|
||||
"postgres",
|
||||
"insert into t_heap as select i as id, md5(i::text) as text, "
|
||||
|
@ -29,15 +29,11 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.set_archiving(backup_dir, 'node', node)
|
||||
node.start()
|
||||
|
||||
# full backup mode
|
||||
# with open(path.join(node.logs_dir, "backup_full.log"), "wb") as backup_log:
|
||||
# backup_log.write(self.backup_node(node, options=["--verbose"]))
|
||||
|
||||
backup_id = self.backup_node(backup_dir, 'node', node)
|
||||
show_backup = self.show_pb(backup_dir, 'node')[0]
|
||||
|
||||
self.assertEqual(show_backup['Status'], "OK")
|
||||
self.assertEqual(show_backup['Mode'], "FULL")
|
||||
self.assertEqual(show_backup['status'], "OK")
|
||||
self.assertEqual(show_backup['backup-mode'], "FULL")
|
||||
|
||||
# postmaster.pid and postmaster.opts shouldn't be copied
|
||||
excluded = True
|
||||
@ -61,29 +57,29 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# print self.show_pb(node)
|
||||
show_backup = self.show_pb(backup_dir, 'node')[1]
|
||||
self.assertEqual(show_backup['Status'], "OK")
|
||||
self.assertEqual(show_backup['Mode'], "PAGE")
|
||||
self.assertEqual(show_backup['status'], "OK")
|
||||
self.assertEqual(show_backup['backup-mode'], "PAGE")
|
||||
|
||||
# Check parent backup
|
||||
self.assertEqual(
|
||||
backup_id,
|
||||
self.show_pb(
|
||||
backup_dir, 'node',
|
||||
backup_id=show_backup['ID'])["parent-backup-id"])
|
||||
backup_id=show_backup['id'])["parent-backup-id"])
|
||||
|
||||
# ptrack backup mode
|
||||
self.backup_node(backup_dir, 'node', node, backup_type="ptrack")
|
||||
|
||||
show_backup = self.show_pb(backup_dir, 'node')[2]
|
||||
self.assertEqual(show_backup['Status'], "OK")
|
||||
self.assertEqual(show_backup['Mode'], "PTRACK")
|
||||
self.assertEqual(show_backup['status'], "OK")
|
||||
self.assertEqual(show_backup['backup-mode'], "PTRACK")
|
||||
|
||||
# Check parent backup
|
||||
self.assertEqual(
|
||||
page_backup_id,
|
||||
self.show_pb(
|
||||
backup_dir, 'node',
|
||||
backup_id=show_backup['ID'])["parent-backup-id"])
|
||||
backup_id=show_backup['id'])["parent-backup-id"])
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
@ -106,7 +102,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node,
|
||||
options=["-C"])
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[0]['Status'], "OK")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[0]['status'], "OK")
|
||||
node.stop()
|
||||
|
||||
# Clean after yourself
|
||||
@ -162,7 +158,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
self.assertEqual(
|
||||
self.show_pb(backup_dir, 'node')[0]['Status'],
|
||||
self.show_pb(backup_dir, 'node')[0]['status'],
|
||||
"ERROR")
|
||||
|
||||
# Clean after yourself
|
||||
@ -227,7 +223,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertEqual(
|
||||
self.show_pb(backup_dir, 'node', backup_id)['status'], "CORRUPT")
|
||||
self.assertEqual(
|
||||
self.show_pb(backup_dir, 'node')[1]['Status'], "ERROR")
|
||||
self.show_pb(backup_dir, 'node')[1]['status'], "ERROR")
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
@ -250,12 +246,12 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node,
|
||||
backup_type="full", options=["-j", "4"])
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[0]['Status'], "OK")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[0]['status'], "OK")
|
||||
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node,
|
||||
backup_type="ptrack", options=["-j", "4"])
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[0]['Status'], "OK")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[0]['status'], "OK")
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
@ -282,11 +278,11 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
backup_dir, 'node', node, backup_type="full",
|
||||
options=["-j", "4", "--stream"])
|
||||
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[0]['Status'], "OK")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[0]['status'], "OK")
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node,
|
||||
backup_type="ptrack", options=["-j", "4", "--stream"])
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[1]['Status'], "OK")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[1]['status'], "OK")
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
@ -342,7 +338,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
f.close
|
||||
|
||||
self.assertTrue(
|
||||
self.show_pb(backup_dir, 'node')[1]['Status'] == 'OK',
|
||||
self.show_pb(backup_dir, 'node')[1]['status'] == 'OK',
|
||||
"Backup Status should be OK")
|
||||
|
||||
# Clean after yourself
|
||||
@ -415,7 +411,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
self.assertTrue(
|
||||
self.show_pb(backup_dir, 'node')[1]['Status'] == 'ERROR',
|
||||
self.show_pb(backup_dir, 'node')[1]['status'] == 'ERROR',
|
||||
"Backup Status should be ERROR")
|
||||
|
||||
# Clean after yourself
|
||||
|
@ -44,13 +44,13 @@ class DeleteTest(ProbackupTest, unittest.TestCase):
|
||||
self.backup_node(backup_dir, 'node', node)
|
||||
|
||||
show_backups = self.show_pb(backup_dir, 'node')
|
||||
id_1 = show_backups[0]['ID']
|
||||
id_2 = show_backups[1]['ID']
|
||||
id_3 = show_backups[2]['ID']
|
||||
id_1 = show_backups[0]['id']
|
||||
id_2 = show_backups[1]['id']
|
||||
id_3 = show_backups[2]['id']
|
||||
self.delete_pb(backup_dir, 'node', id_2)
|
||||
show_backups = self.show_pb(backup_dir, 'node')
|
||||
self.assertEqual(show_backups[0]['ID'], id_1)
|
||||
self.assertEqual(show_backups[1]['ID'], id_3)
|
||||
self.assertEqual(show_backups[0]['id'], id_1)
|
||||
self.assertEqual(show_backups[1]['id'], id_3)
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
@ -82,15 +82,15 @@ class DeleteTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertEqual(len(show_backups), 4)
|
||||
|
||||
# delete first page backup
|
||||
self.delete_pb(backup_dir, 'node', show_backups[1]['ID'])
|
||||
self.delete_pb(backup_dir, 'node', show_backups[1]['id'])
|
||||
|
||||
show_backups = self.show_pb(backup_dir, 'node')
|
||||
self.assertEqual(len(show_backups), 2)
|
||||
|
||||
self.assertEqual(show_backups[0]['Mode'], "FULL")
|
||||
self.assertEqual(show_backups[0]['Status'], "OK")
|
||||
self.assertEqual(show_backups[1]['Mode'], "FULL")
|
||||
self.assertEqual(show_backups[1]['Status'], "OK")
|
||||
self.assertEqual(show_backups[0]['backup-mode'], "FULL")
|
||||
self.assertEqual(show_backups[0]['status'], "OK")
|
||||
self.assertEqual(show_backups[1]['backup-mode'], "FULL")
|
||||
self.assertEqual(show_backups[1]['status'], "OK")
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
@ -122,15 +122,15 @@ class DeleteTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertEqual(len(show_backups), 4)
|
||||
|
||||
# delete first page backup
|
||||
self.delete_pb(backup_dir, 'node', show_backups[1]['ID'])
|
||||
self.delete_pb(backup_dir, 'node', show_backups[1]['id'])
|
||||
|
||||
show_backups = self.show_pb(backup_dir, 'node')
|
||||
self.assertEqual(len(show_backups), 2)
|
||||
|
||||
self.assertEqual(show_backups[0]['Mode'], "FULL")
|
||||
self.assertEqual(show_backups[0]['Status'], "OK")
|
||||
self.assertEqual(show_backups[1]['Mode'], "FULL")
|
||||
self.assertEqual(show_backups[1]['Status'], "OK")
|
||||
self.assertEqual(show_backups[0]['backup-mode'], "FULL")
|
||||
self.assertEqual(show_backups[0]['status'], "OK")
|
||||
self.assertEqual(show_backups[1]['backup-mode'], "FULL")
|
||||
self.assertEqual(show_backups[1]['status'], "OK")
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
|
@ -1191,7 +1191,7 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
|
||||
f.close
|
||||
|
||||
self.assertTrue(
|
||||
self.show_pb(backup_dir, 'node')[1]['Status'] == 'OK',
|
||||
self.show_pb(backup_dir, 'node')[1]['status'] == 'OK',
|
||||
"Backup Status should be OK")
|
||||
|
||||
# Clean after yourself
|
||||
@ -1264,7 +1264,7 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
self.assertTrue(
|
||||
self.show_pb(backup_dir, 'node')[1]['Status'] == 'ERROR',
|
||||
self.show_pb(backup_dir, 'node')[1]['status'] == 'ERROR',
|
||||
"Backup Status should be ERROR")
|
||||
|
||||
# Clean after yourself
|
||||
|
@ -34,25 +34,33 @@ class ExcludeTest(ProbackupTest, unittest.TestCase):
|
||||
temp_schema_name = conn.execute("SELECT nspname FROM pg_namespace WHERE oid = pg_my_temp_schema()")[0][0]
|
||||
conn.commit()
|
||||
|
||||
temp_toast_schema_name = "pg_toast_" + temp_schema_name.replace("pg_", "")
|
||||
temp_toast_schema_name = "pg_toast_" + temp_schema_name.replace(
|
||||
"pg_", "")
|
||||
conn.commit()
|
||||
|
||||
conn.execute("create index test_idx on test (generate_series)")
|
||||
conn.commit()
|
||||
|
||||
heap_path = conn.execute("select pg_relation_filepath('test')")[0][0]
|
||||
heap_path = conn.execute(
|
||||
"select pg_relation_filepath('test')")[0][0]
|
||||
conn.commit()
|
||||
|
||||
index_path = conn.execute("select pg_relation_filepath('test_idx')")[0][0]
|
||||
index_path = conn.execute(
|
||||
"select pg_relation_filepath('test_idx')")[0][0]
|
||||
conn.commit()
|
||||
|
||||
heap_oid = conn.execute("select 'test'::regclass::oid")[0][0]
|
||||
conn.commit()
|
||||
|
||||
toast_path = conn.execute("select pg_relation_filepath('{0}.{1}')".format(temp_toast_schema_name, "pg_toast_" + str(heap_oid)))[0][0]
|
||||
toast_path = conn.execute(
|
||||
"select pg_relation_filepath('{0}.{1}')".format(
|
||||
temp_toast_schema_name, "pg_toast_" + str(heap_oid)))[0][0]
|
||||
conn.commit()
|
||||
|
||||
toast_idx_path = conn.execute("select pg_relation_filepath('{0}.{1}')".format(temp_toast_schema_name, "pg_toast_" + str(heap_oid) + "_index"))[0][0]
|
||||
toast_idx_path = conn.execute(
|
||||
"select pg_relation_filepath('{0}.{1}')".format(
|
||||
temp_toast_schema_name,
|
||||
"pg_toast_" + str(heap_oid) + "_index"))[0][0]
|
||||
conn.commit()
|
||||
|
||||
temp_table_filename = os.path.basename(heap_path)
|
||||
|
@ -12,6 +12,7 @@ import select
|
||||
import psycopg2
|
||||
from time import sleep
|
||||
import re
|
||||
import json
|
||||
|
||||
idx_ptrack = {
|
||||
't_heap': {
|
||||
@ -598,7 +599,7 @@ class ProbackupTest(object):
|
||||
|
||||
def show_pb(
|
||||
self, backup_dir, instance=None, backup_id=None,
|
||||
options=[], as_text=False
|
||||
options=[], as_text=False, as_json=True
|
||||
):
|
||||
|
||||
backup_list = []
|
||||
@ -613,11 +614,31 @@ class ProbackupTest(object):
|
||||
if backup_id:
|
||||
cmd_list += ["-i", backup_id]
|
||||
|
||||
if as_json:
|
||||
cmd_list += ["--format=json"]
|
||||
|
||||
if as_text:
|
||||
# You should print it when calling as_text=true
|
||||
return self.run_pb(cmd_list + options)
|
||||
|
||||
# get show result as list of lines
|
||||
if as_json:
|
||||
data = json.loads(self.run_pb(cmd_list + options))
|
||||
# print(data)
|
||||
for instance_data in data:
|
||||
# find specific instance if requested
|
||||
if instance and instance_data['instance'] != instance:
|
||||
continue
|
||||
|
||||
for backup in reversed(instance_data['backups']):
|
||||
# find specific backup if requested
|
||||
if backup_id:
|
||||
if backup['id'] == backup_id:
|
||||
return backup
|
||||
else:
|
||||
backup_list.append(backup)
|
||||
return backup_list
|
||||
else:
|
||||
show_splitted = self.run_pb(cmd_list + options).splitlines()
|
||||
if instance is not None and backup_id is None:
|
||||
# cut header(ID, Mode, etc) from show as single string
|
||||
|
@ -63,7 +63,7 @@ class ArchiveCheck(ProbackupTest, unittest.TestCase):
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
backup_id = self.show_pb(backup_dir, 'node')[0]['ID']
|
||||
backup_id = self.show_pb(backup_dir, 'node')[0]['id']
|
||||
self.assertEqual(
|
||||
'ERROR', self.show_pb(backup_dir, 'node', backup_id)['status'],
|
||||
'Backup should have ERROR status')
|
||||
|
103
tests/ptrack.py
103
tests/ptrack.py
@ -268,7 +268,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Physical comparison
|
||||
if self.paranoia:
|
||||
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
|
||||
pgdata_restored = self.pgdata_content(
|
||||
node_restored.data_dir, ignore_ptrack=False)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
node_restored.append_conf(
|
||||
@ -430,7 +431,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Physical comparison
|
||||
if self.paranoia:
|
||||
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
|
||||
pgdata_restored = self.pgdata_content(
|
||||
node_restored.data_dir, ignore_ptrack=False)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
node_restored.append_conf(
|
||||
@ -503,7 +505,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Physical comparison
|
||||
if self.paranoia:
|
||||
pgdata_restored = self.pgdata_content(node.data_dir, ignore_ptrack=False)
|
||||
pgdata_restored = self.pgdata_content(
|
||||
node.data_dir, ignore_ptrack=False)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
node.start()
|
||||
@ -584,8 +587,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd)
|
||||
)
|
||||
node.start()
|
||||
while node.safe_psql(
|
||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
||||
while node.psql(
|
||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
||||
time.sleep(1)
|
||||
full_result_new = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||
self.assertEqual(full_result, full_result_new)
|
||||
@ -604,12 +607,13 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
)
|
||||
|
||||
if self.paranoia:
|
||||
pgdata_restored = self.pgdata_content(node.data_dir, ignore_ptrack=False)
|
||||
pgdata_restored = self.pgdata_content(
|
||||
node.data_dir, ignore_ptrack=False)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
node.start()
|
||||
while node.safe_psql(
|
||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
||||
while node.psql(
|
||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
||||
time.sleep(1)
|
||||
ptrack_result_new = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||
self.assertEqual(ptrack_result, ptrack_result_new)
|
||||
@ -688,9 +692,11 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd)
|
||||
)
|
||||
node.start()
|
||||
while node.safe_psql(
|
||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
||||
|
||||
while node.psql(
|
||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
||||
time.sleep(1)
|
||||
|
||||
full_result_new = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||
self.assertEqual(full_result, full_result_new)
|
||||
node.cleanup()
|
||||
@ -711,12 +717,13 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
)
|
||||
|
||||
if self.paranoia:
|
||||
pgdata_restored = self.pgdata_content(node.data_dir, ignore_ptrack=False)
|
||||
pgdata_restored = self.pgdata_content(
|
||||
node.data_dir, ignore_ptrack=False)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
node.start()
|
||||
while node.safe_psql(
|
||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
||||
while node.psql(
|
||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
||||
time.sleep(1)
|
||||
ptrack_result_new = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||
self.assertEqual(ptrack_result, ptrack_result_new)
|
||||
@ -811,7 +818,10 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_page_pgpro417(self):
|
||||
"""Make archive node, take full backup, take page backup, delete page backup. Try to take ptrack backup, which should fail"""
|
||||
"""
|
||||
Make archive node, take full backup, take page backup,
|
||||
delete page backup. Try to take ptrack backup, which should fail
|
||||
"""
|
||||
self.maxDiff = None
|
||||
fname = self.id().split('.')[3]
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
@ -880,7 +890,10 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_full_pgpro417(self):
|
||||
"""Make node, take two full backups, delete full second backup. Try to take ptrack backup, which should fail"""
|
||||
"""
|
||||
Make node, take two full backups, delete full second backup.
|
||||
Try to take ptrack backup, which should fail
|
||||
"""
|
||||
self.maxDiff = None
|
||||
fname = self.id().split('.')[3]
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
@ -954,7 +967,10 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_create_db(self):
|
||||
"""Make node, take full backup, create database db1, take ptrack backup, restore database and check it presense"""
|
||||
"""
|
||||
Make node, take full backup, create database db1, take ptrack backup,
|
||||
restore database and check it presense
|
||||
"""
|
||||
self.maxDiff = None
|
||||
fname = self.id().split('.')[3]
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
@ -1017,7 +1033,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# COMPARE PHYSICAL CONTENT
|
||||
if self.paranoia:
|
||||
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
|
||||
pgdata_restored = self.pgdata_content(
|
||||
node_restored.data_dir, ignore_ptrack=False)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
# START RESTORED NODE
|
||||
@ -1046,7 +1063,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# COMPARE PHYSICAL CONTENT
|
||||
if self.paranoia:
|
||||
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
|
||||
pgdata_restored = self.pgdata_content(
|
||||
node_restored.data_dir, ignore_ptrack=False)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
# START RESTORED NODE
|
||||
@ -1151,7 +1169,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# GET RESTORED PGDATA AND COMPARE
|
||||
if self.paranoia:
|
||||
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
|
||||
pgdata_restored = self.pgdata_content(
|
||||
node_restored.data_dir, ignore_ptrack=False)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
# START RESTORED NODE
|
||||
@ -1159,8 +1178,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
'postgresql.auto.conf', 'port = {0}'.format(node_restored.port))
|
||||
node_restored.start()
|
||||
|
||||
while node_restored.safe_psql(
|
||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
||||
while node_restored.psql(
|
||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
||||
time.sleep(1)
|
||||
result_new = node_restored.safe_psql(
|
||||
"postgres", "select * from t_heap")
|
||||
@ -1229,7 +1248,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# GET PHYSICAL CONTENT and COMPARE PHYSICAL CONTENT
|
||||
if self.paranoia:
|
||||
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
|
||||
pgdata_restored = self.pgdata_content(
|
||||
node_restored.data_dir, ignore_ptrack=False)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
# START RESTORED NODE
|
||||
@ -1240,7 +1260,10 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_drop_tablespace(self):
|
||||
"""Make node, create table, alter table tablespace, take ptrack backup, move table from tablespace, take ptrack backup"""
|
||||
"""
|
||||
Make node, create table, alter table tablespace, take ptrack backup,
|
||||
move table from tablespace, take ptrack backup
|
||||
"""
|
||||
self.maxDiff = None
|
||||
fname = self.id().split('.')[3]
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
@ -1321,7 +1344,10 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_ptrack_alter_tablespace(self):
|
||||
"""Make node, create table, alter table tablespace, take ptrack backup, move table from tablespace, take ptrack backup"""
|
||||
"""
|
||||
Make node, create table, alter table tablespace, take ptrack backup,
|
||||
move table from tablespace, take ptrack backup
|
||||
"""
|
||||
self.maxDiff = None
|
||||
fname = self.id().split('.')[3]
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
@ -1379,15 +1405,16 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# GET PHYSICAL CONTENT FROM RESTORED NODE and COMPARE PHYSICAL CONTENT
|
||||
if self.paranoia:
|
||||
pgdata_restored = self.pgdata_content(restored_node.data_dir, ignore_ptrack=False)
|
||||
pgdata_restored = self.pgdata_content(
|
||||
restored_node.data_dir, ignore_ptrack=False)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
# START RESTORED NODE
|
||||
restored_node.append_conf(
|
||||
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
||||
restored_node.start()
|
||||
while restored_node.safe_psql(
|
||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
||||
while restored_node.psql(
|
||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
||||
time.sleep(1)
|
||||
|
||||
# COMPARE LOGICAL CONTENT
|
||||
@ -1416,14 +1443,15 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# GET PHYSICAL CONTENT FROM RESTORED NODE and COMPARE PHYSICAL CONTENT
|
||||
if self.paranoia:
|
||||
pgdata_restored = self.pgdata_content(restored_node.data_dir, ignore_ptrack=False)
|
||||
pgdata_restored = self.pgdata_content(
|
||||
restored_node.data_dir, ignore_ptrack=False)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
# START RESTORED NODE
|
||||
restored_node.append_conf(
|
||||
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
||||
restored_node.start()
|
||||
while restored_node.safe_psql(
|
||||
while restored_node.psql(
|
||||
"postgres",
|
||||
"select pg_is_in_recovery()") == 't\n':
|
||||
time.sleep(1)
|
||||
@ -1437,7 +1465,10 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_ptrack_multiple_segments(self):
|
||||
"""Make node, create table, alter table tablespace, take ptrack backup, move table from tablespace, take ptrack backup"""
|
||||
"""
|
||||
Make node, create table, alter table tablespace,
|
||||
take ptrack backup, move table from tablespace, take ptrack backup
|
||||
"""
|
||||
fname = self.id().split('.')[3]
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
node = self.make_simple_node(
|
||||
@ -1446,9 +1477,10 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
initdb_params=['--data-checksums'],
|
||||
pg_options={
|
||||
'wal_level': 'replica', 'max_wal_senders': '2',
|
||||
'ptrack_enable': 'on', 'fsync': 'off', 'shared_buffers': '128MB',
|
||||
'maintenance_work_mem': '1GB', 'autovacuum': 'off',
|
||||
'full_page_writes': 'off'}
|
||||
'ptrack_enable': 'on', 'fsync': 'off',
|
||||
'autovacuum': 'off',
|
||||
'full_page_writes': 'off'
|
||||
}
|
||||
)
|
||||
|
||||
self.init_pb(backup_dir)
|
||||
@ -1514,14 +1546,15 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# GET PHYSICAL CONTENT FROM NODE_RESTORED
|
||||
if self.paranoia:
|
||||
pgdata_restored = self.pgdata_content(restored_node.data_dir, ignore_ptrack=False)
|
||||
pgdata_restored = self.pgdata_content(
|
||||
restored_node.data_dir, ignore_ptrack=False)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
# START RESTORED NODE
|
||||
restored_node.append_conf(
|
||||
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
||||
restored_node.start()
|
||||
while restored_node.safe_psql(
|
||||
while restored_node.psql(
|
||||
"postgres",
|
||||
"select pg_is_in_recovery()") == 't\n':
|
||||
time.sleep(1)
|
||||
|
@ -718,7 +718,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
con.commit()
|
||||
|
||||
backup_id = self.backup_node(backup_dir, 'node', node)
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[0]['Status'], "OK")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[0]['status'], "OK")
|
||||
|
||||
# 1 - Try to restore to existing directory
|
||||
node.stop()
|
||||
@ -785,8 +785,8 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
backup_dir, 'node', node, backup_type="page")
|
||||
|
||||
show_pb = self.show_pb(backup_dir, 'node')
|
||||
self.assertEqual(show_pb[1]['Status'], "OK")
|
||||
self.assertEqual(show_pb[2]['Status'], "OK")
|
||||
self.assertEqual(show_pb[1]['status'], "OK")
|
||||
self.assertEqual(show_pb[2]['status'], "OK")
|
||||
|
||||
node.stop()
|
||||
node.cleanup()
|
||||
@ -829,7 +829,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Full backup
|
||||
self.backup_node(backup_dir, 'node', node)
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[0]['Status'], "OK")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[0]['status'], "OK")
|
||||
|
||||
# Create tablespace
|
||||
tblspc_path = os.path.join(node.base_dir, "tblspc")
|
||||
@ -845,8 +845,9 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# First page backup
|
||||
self.backup_node(backup_dir, 'node', node, backup_type="page")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[1]['Status'], "OK")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[1]['Mode'], "PAGE")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[1]['status'], "OK")
|
||||
self.assertEqual(
|
||||
self.show_pb(backup_dir, 'node')[1]['backup-mode'], "PAGE")
|
||||
|
||||
# Create tablespace table
|
||||
with node.connect("postgres") as con:
|
||||
@ -862,8 +863,9 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
# Second page backup
|
||||
backup_id = self.backup_node(
|
||||
backup_dir, 'node', node, backup_type="page")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[2]['Status'], "OK")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[2]['Mode'], "PAGE")
|
||||
self.assertEqual(self.show_pb(backup_dir, 'node')[2]['status'], "OK")
|
||||
self.assertEqual(
|
||||
self.show_pb(backup_dir, 'node')[2]['backup-mode'], "PAGE")
|
||||
|
||||
node.stop()
|
||||
node.cleanup()
|
||||
|
@ -14,7 +14,8 @@ class RetentionTest(ProbackupTest, unittest.TestCase):
|
||||
def test_retention_redundancy_1(self):
|
||||
"""purge backups using redundancy-based retention policy"""
|
||||
fname = self.id().split('.')[3]
|
||||
node = self.make_simple_node(base_dir="{0}/{1}/node".format(module_name, fname),
|
||||
node = self.make_simple_node(
|
||||
base_dir="{0}/{1}/node".format(module_name, fname),
|
||||
initdb_params=['--data-checksums'],
|
||||
pg_options={'wal_level': 'replica'}
|
||||
)
|
||||
@ -24,7 +25,9 @@ class RetentionTest(ProbackupTest, unittest.TestCase):
|
||||
self.set_archiving(backup_dir, 'node', node)
|
||||
node.start()
|
||||
|
||||
with open(os.path.join(backup_dir, 'backups', 'node', "pg_probackup.conf"), "a") as conf:
|
||||
with open(os.path.join(
|
||||
backup_dir, 'backups', 'node',
|
||||
"pg_probackup.conf"), "a") as conf:
|
||||
conf.write("retention-redundancy = 1\n")
|
||||
|
||||
# Make backups to be purged
|
||||
@ -68,7 +71,8 @@ class RetentionTest(ProbackupTest, unittest.TestCase):
|
||||
def test_retention_window_2(self):
|
||||
"""purge backups using window-based retention policy"""
|
||||
fname = self.id().split('.')[3]
|
||||
node = self.make_simple_node(base_dir="{0}/{1}/node".format(module_name, fname),
|
||||
node = self.make_simple_node(
|
||||
base_dir="{0}/{1}/node".format(module_name, fname),
|
||||
initdb_params=['--data-checksums'],
|
||||
pg_options={'wal_level': 'replica'}
|
||||
)
|
||||
|
@ -36,6 +36,35 @@ class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
|
||||
# @unittest.skip("skip")
|
||||
# @unittest.expectedFailure
|
||||
def test_show_json(self):
|
||||
"""Status DONE and OK"""
|
||||
fname = self.id().split('.')[3]
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
node = self.make_simple_node(
|
||||
base_dir="{0}/{1}/node".format(module_name, fname),
|
||||
initdb_params=['--data-checksums'],
|
||||
pg_options={'wal_level': 'replica'}
|
||||
)
|
||||
|
||||
self.init_pb(backup_dir)
|
||||
self.add_instance(backup_dir, 'node', node)
|
||||
self.set_archiving(backup_dir, 'node', node)
|
||||
node.start()
|
||||
|
||||
self.assertEqual(
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node,
|
||||
options=["--log-level-console=panic"]),
|
||||
None
|
||||
)
|
||||
self.backup_node(backup_dir, 'node', node)
|
||||
self.assertIn("OK", self.show_pb(backup_dir, 'node', as_text=True))
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_corrupt_2(self):
|
||||
"""Status CORRUPT"""
|
||||
|
@ -908,7 +908,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
backup_id = self.backup_node(backup_dir, 'node', node)
|
||||
target_xid = None
|
||||
with node.connect("postgres") as con:
|
||||
res = con.execute("INSERT INTO tbl0005 VALUES ('inserted') RETURNING (xmin)")
|
||||
res = con.execute(
|
||||
"INSERT INTO tbl0005 VALUES ('inserted') RETURNING (xmin)")
|
||||
con.commit()
|
||||
target_xid = res[0][0]
|
||||
|
||||
@ -1041,7 +1042,10 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_validate_corrupt_wal_between_backups(self):
|
||||
"""make archive node, make full backup, corrupt all wal files, run validate to real xid, expect errors"""
|
||||
"""
|
||||
make archive node, make full backup, corrupt all wal files,
|
||||
run validate to real xid, expect errors
|
||||
"""
|
||||
fname = self.id().split('.')[3]
|
||||
node = self.make_simple_node(
|
||||
base_dir="{0}/{1}/node".format(module_name, fname),
|
||||
@ -1083,7 +1087,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
else:
|
||||
walfile = node.safe_psql(
|
||||
'postgres',
|
||||
'select pg_walfile_name(pg_current_wal_location())').rstrip()
|
||||
'select pg_walfile_name(pg_current_wal_lsn())').rstrip()
|
||||
|
||||
if self.archive_compress:
|
||||
walfile = walfile + '.gz'
|
||||
@ -1134,12 +1138,12 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
self.assertEqual(
|
||||
'OK',
|
||||
self.show_pb(backup_dir, 'node')[0]['Status'],
|
||||
self.show_pb(backup_dir, 'node')[0]['status'],
|
||||
'Backup STATUS should be "OK"')
|
||||
|
||||
self.assertEqual(
|
||||
'OK',
|
||||
self.show_pb(backup_dir, 'node')[1]['Status'],
|
||||
self.show_pb(backup_dir, 'node')[1]['status'],
|
||||
'Backup STATUS should be "OK"')
|
||||
|
||||
# Clean after yourself
|
||||
@ -1208,7 +1212,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
self.assertEqual(
|
||||
'ERROR',
|
||||
self.show_pb(backup_dir, 'node')[1]['Status'],
|
||||
self.show_pb(backup_dir, 'node')[1]['status'],
|
||||
'Backup {0} should have STATUS "ERROR"')
|
||||
|
||||
# Clean after yourself
|
||||
@ -1405,7 +1409,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
pass
|
||||
self.assertTrue(
|
||||
self.show_pb(backup_dir, 'node')[6]['Status'] == 'ERROR')
|
||||
self.show_pb(backup_dir, 'node')[6]['status'] == 'ERROR')
|
||||
self.set_archiving(backup_dir, 'node', node)
|
||||
node.reload()
|
||||
self.backup_node(backup_dir, 'node', node, backup_type='page')
|
||||
@ -1440,14 +1444,19 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[0]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[1]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[2]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[3]['Status'] == 'CORRUPT')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[4]['Status'] == 'ORPHAN')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[5]['Status'] == 'ORPHAN')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[6]['Status'] == 'ERROR')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[7]['Status'] == 'ORPHAN')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[0]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[1]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[2]['status'] == 'OK')
|
||||
self.assertTrue(
|
||||
self.show_pb(backup_dir, 'node')[3]['status'] == 'CORRUPT')
|
||||
self.assertTrue(
|
||||
self.show_pb(backup_dir, 'node')[4]['status'] == 'ORPHAN')
|
||||
self.assertTrue(
|
||||
self.show_pb(backup_dir, 'node')[5]['status'] == 'ORPHAN')
|
||||
self.assertTrue(
|
||||
self.show_pb(backup_dir, 'node')[6]['status'] == 'ERROR')
|
||||
self.assertTrue(
|
||||
self.show_pb(backup_dir, 'node')[7]['status'] == 'ORPHAN')
|
||||
|
||||
os.rename(file_new, file)
|
||||
try:
|
||||
@ -1459,14 +1468,15 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[0]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[1]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[2]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[3]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[4]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[5]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[6]['Status'] == 'ERROR')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[7]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[0]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[1]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[2]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[3]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[4]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[5]['status'] == 'OK')
|
||||
self.assertTrue(
|
||||
self.show_pb(backup_dir, 'node')[6]['status'] == 'ERROR')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[7]['status'] == 'OK')
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
@ -1537,13 +1547,13 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[0]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[1]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[2]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[3]['Status'] == 'CORRUPT')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[4]['Status'] == 'ORPHAN')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[5]['Status'] == 'ORPHAN')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[6]['Status'] == 'ORPHAN')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[0]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[1]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[2]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[3]['status'] == 'CORRUPT')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[4]['status'] == 'ORPHAN')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[5]['status'] == 'ORPHAN')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[6]['status'] == 'ORPHAN')
|
||||
|
||||
os.rename(file_new, file)
|
||||
file = os.path.join(
|
||||
@ -1562,13 +1572,13 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[0]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[1]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[2]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[3]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[4]['Status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[5]['Status'] == 'CORRUPT')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[6]['Status'] == 'ORPHAN')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[0]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[1]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[2]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[3]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[4]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[5]['status'] == 'CORRUPT')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[6]['status'] == 'ORPHAN')
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
|
Reference in New Issue
Block a user