mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-01-05 13:20:31 +02:00
[Issue #226] fix tests
This commit is contained in:
parent
5d904b62e3
commit
4fd6ba14d0
@ -765,10 +765,6 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
before = master.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||
|
||||
master.safe_psql(
|
||||
"postgres",
|
||||
"CHECKPOINT")
|
||||
|
||||
self.wait_until_replica_catch_with_master(master, replica)
|
||||
|
||||
backup_id = self.backup_node(
|
||||
@ -864,10 +860,6 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
||||
"md5(repeat(i::text,10))::tsvector as tsvector "
|
||||
"from generate_series(0, 60000) i")
|
||||
|
||||
master.psql(
|
||||
"postgres",
|
||||
"CHECKPOINT")
|
||||
|
||||
backup_id = self.backup_node(
|
||||
backup_dir, 'replica', replica,
|
||||
options=[
|
||||
@ -977,10 +969,6 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
replica.promote()
|
||||
|
||||
replica.safe_psql(
|
||||
'postgres',
|
||||
'CHECKPOINT')
|
||||
|
||||
master.pgbench_init(scale=10)
|
||||
replica.pgbench_init(scale=10)
|
||||
|
||||
@ -1221,11 +1209,6 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
||||
# create timeline t2
|
||||
replica.promote()
|
||||
|
||||
# do checkpoint to increment timeline ID in pg_control
|
||||
replica.safe_psql(
|
||||
'postgres',
|
||||
'CHECKPOINT')
|
||||
|
||||
# FULL backup replica
|
||||
A1 = self.backup_node(
|
||||
backup_dir, 'replica', replica)
|
||||
@ -1959,7 +1942,8 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
replica.slow_start(replica=True)
|
||||
|
||||
node.safe_psql('postgres', 'CHECKPOINT')
|
||||
# FULL
|
||||
self.backup_node(backup_dir, 'replica', replica, options=['--stream'])
|
||||
|
||||
if self.get_version(replica) < 100000:
|
||||
pg_receivexlog_path = self.get_bin_path('pg_receivexlog')
|
||||
@ -1981,14 +1965,18 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
||||
'Failed to start pg_receivexlog: {0}'.format(
|
||||
pg_receivexlog.communicate()[1]))
|
||||
|
||||
replica.safe_psql(
|
||||
'postgres',
|
||||
'CHECKPOINT')
|
||||
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
"create table t_heap as select i as id, md5(i::text) as text, "
|
||||
"md5(repeat(i::text,10))::tsvector as tsvector "
|
||||
"from generate_series(0,1000000) i")
|
||||
|
||||
# FULL
|
||||
self.backup_node(backup_dir, 'replica', replica, options=['--stream'])
|
||||
# PAGE
|
||||
self.backup_node(backup_dir, 'replica', replica, backup_type='page')
|
||||
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
@ -2027,6 +2015,7 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
||||
pg_receivexlog.kill()
|
||||
self.del_test_dir(module_name, fname)
|
||||
|
||||
@unittest.skip("skip")
|
||||
def test_multi_timeline_recovery_prefetching(self):
|
||||
""""""
|
||||
fname = self.id().split('.')[3]
|
||||
|
@ -324,6 +324,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
node = self.make_simple_node(
|
||||
base_dir=os.path.join(module_name, fname, 'node'),
|
||||
set_replication=True,
|
||||
ptrack_enable=True,
|
||||
initdb_params=['--data-checksums'])
|
||||
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
@ -663,12 +664,10 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
"\n Output: {0} \n CMD: {1}".format(
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
'WARNING: page verification failed, '
|
||||
'calculated checksum' in e.message and
|
||||
'ERROR: query failed: ERROR: '
|
||||
'invalid page in block 1 of relation' in e.message and
|
||||
'ERROR: Data files transferring failed' in e.message,
|
||||
self.assertIn(
|
||||
'ERROR: Corruption detected in file "{0}", block 1: '
|
||||
'page header invalid, pd_lower'.format(heap_fullpath),
|
||||
e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
@ -806,12 +805,10 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
"\n Output: {0} \n CMD: {1}".format(
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
'WARNING: page verification failed, '
|
||||
'calculated checksum' in e.message and
|
||||
'ERROR: query failed: ERROR: '
|
||||
'invalid page in block 1 of relation' in e.message and
|
||||
'ERROR: Data files transferring failed' in e.message,
|
||||
self.assertIn(
|
||||
'ERROR: Corruption detected in file "{0}", block 1: '
|
||||
'page header invalid, pd_lower'.format(heap_fullpath),
|
||||
e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
@ -1480,7 +1477,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
node = self.make_simple_node(
|
||||
base_dir=os.path.join(module_name, fname, 'node'),
|
||||
set_replication=True,
|
||||
ptrack_enable=True,
|
||||
ptrack_enable=self.ptrack,
|
||||
initdb_params=['--data-checksums'])
|
||||
|
||||
self.init_pb(backup_dir)
|
||||
@ -1927,7 +1924,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'ERROR: Cannot open source file',
|
||||
'ERROR: Cannot open file',
|
||||
e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
@ -2131,9 +2128,8 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
"TO backup".format(fname))
|
||||
else:
|
||||
fnames = [
|
||||
'pg_catalog.pg_ptrack_get_pagemapset(pg_lsn)',
|
||||
'pg_catalog.pg_ptrack_control_lsn()',
|
||||
'pg_catalog.pg_ptrack_get_block(oid, oid, oid, bigint)'
|
||||
'pg_catalog.ptrack_get_pagemapset(pg_lsn)',
|
||||
'pg_catalog.ptrack_init_lsn()'
|
||||
]
|
||||
|
||||
for fname in fnames:
|
||||
|
@ -3946,9 +3946,9 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd)
|
||||
)
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'ERROR: LSN from ptrack_control 0/0 differs from Start LSN of previous backup',
|
||||
e.message,
|
||||
self.assertTrue(
|
||||
'ERROR: LSN from ptrack_control ' in e.message and
|
||||
'differs from Start LSN of previous backup' in e.message,
|
||||
'\n Unexpected Error Message: {0}\n'
|
||||
' CMD: {1}'.format(repr(e.message), self.cmd))
|
||||
|
||||
|
@ -207,10 +207,6 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
before = master.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||
|
||||
master.psql(
|
||||
"postgres",
|
||||
"CHECKPOINT")
|
||||
|
||||
self.wait_until_replica_catch_with_master(master, replica)
|
||||
|
||||
backup_id = self.backup_node(
|
||||
@ -383,10 +379,6 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
"md5(repeat(i::text,10))::tsvector as tsvector "
|
||||
"from generate_series(0,165000) i")
|
||||
|
||||
master.psql(
|
||||
"postgres",
|
||||
"CHECKPOINT")
|
||||
|
||||
master.psql(
|
||||
"postgres",
|
||||
"create table t_heap_1 as select i as id, md5(i::text) as text, "
|
||||
@ -726,9 +718,11 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
log_content)
|
||||
|
||||
self.assertIn(
|
||||
'LOG: stop_lsn: 0/4000028',
|
||||
'LOG: stop_lsn: 0/4000000',
|
||||
log_content)
|
||||
|
||||
self.assertTrue(self.show_pb(backup_dir, 'replica')[0]['status'] == 'DONE')
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
|
||||
@ -1118,18 +1112,6 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
replica.promote()
|
||||
|
||||
replica.safe_psql(
|
||||
'postgres',
|
||||
'CHECKPOINT')
|
||||
|
||||
# replica.safe_psql(
|
||||
# 'postgres',
|
||||
# 'create table t2()')
|
||||
#
|
||||
# replica.safe_psql(
|
||||
# 'postgres',
|
||||
# 'CHECKPOINT')
|
||||
|
||||
self.backup_node(
|
||||
backup_dir, 'master', replica, data_dir=replica.data_dir,
|
||||
backup_type='page')
|
||||
@ -1176,10 +1158,6 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
self.add_instance(backup_dir, 'replica', replica)
|
||||
|
||||
replica.safe_psql(
|
||||
'postgres',
|
||||
'CHECKPOINT')
|
||||
|
||||
full_id = self.backup_node(
|
||||
backup_dir, 'replica',
|
||||
replica, options=['--stream'])
|
||||
@ -1191,20 +1169,12 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
'FROM generate_series(0,20) i')
|
||||
self.wait_until_replica_catch_with_master(master, replica)
|
||||
|
||||
replica.safe_psql(
|
||||
'postgres',
|
||||
'CHECKPOINT')
|
||||
|
||||
self.backup_node(
|
||||
backup_dir, 'replica', replica,
|
||||
backup_type='delta', options=['--stream'])
|
||||
|
||||
replica.promote()
|
||||
|
||||
replica.safe_psql(
|
||||
'postgres',
|
||||
'CHECKPOINT')
|
||||
|
||||
# failing, because without archving, it is impossible to
|
||||
# take multi-timeline backup.
|
||||
try:
|
||||
@ -1297,7 +1267,6 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# node2 is now master
|
||||
node2.promote()
|
||||
node2.safe_psql('postgres', 'CHECKPOINT')
|
||||
|
||||
node2.safe_psql(
|
||||
'postgres',
|
||||
@ -1331,7 +1300,6 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# node1 is back to be a master
|
||||
node1.promote()
|
||||
node1.safe_psql('postgres', 'CHECKPOINT')
|
||||
|
||||
sleep(5)
|
||||
|
||||
@ -1420,7 +1388,6 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# node2 is now master
|
||||
node2.promote()
|
||||
node2.safe_psql('postgres', 'CHECKPOINT')
|
||||
|
||||
node2.safe_psql(
|
||||
'postgres',
|
||||
@ -1454,7 +1421,6 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# node1 is back to be a master
|
||||
node1.promote()
|
||||
node1.safe_psql('postgres', 'CHECKPOINT')
|
||||
self.switch_wal_segment(node1)
|
||||
|
||||
sleep(5)
|
||||
@ -1532,7 +1498,6 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
backup_type='delta', options=['--stream'])
|
||||
|
||||
replica.promote()
|
||||
replica.safe_psql('postgres', 'CHECKPOINT')
|
||||
|
||||
# failing, because without archving, it is impossible to
|
||||
# take multi-timeline backup.
|
||||
|
@ -980,9 +980,9 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Create tablespace table
|
||||
with node.connect("postgres") as con:
|
||||
con.connection.autocommit = True
|
||||
con.execute("CHECKPOINT")
|
||||
con.connection.autocommit = False
|
||||
# con.connection.autocommit = True
|
||||
# con.execute("CHECKPOINT")
|
||||
# con.connection.autocommit = False
|
||||
con.execute("CREATE TABLE tbl1 (a int) TABLESPACE tblspc")
|
||||
con.execute(
|
||||
"INSERT INTO tbl1 SELECT * "
|
||||
@ -1389,10 +1389,6 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
'postgres',
|
||||
'create extension pageinspect')
|
||||
|
||||
node.safe_psql(
|
||||
'postgres',
|
||||
'checkpoint')
|
||||
|
||||
node.safe_psql(
|
||||
'postgres',
|
||||
'insert into tbl select i from generate_series(0,100) as i')
|
||||
@ -3025,6 +3021,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
node = self.make_simple_node(
|
||||
base_dir=os.path.join(module_name, fname, 'node'),
|
||||
set_replication=True,
|
||||
ptrack_enable=self.ptrack,
|
||||
initdb_params=['--data-checksums'],
|
||||
pg_options={'autovacuum': 'off'})
|
||||
|
||||
@ -3276,17 +3273,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node, options=['--stream'])
|
||||
|
||||
node.pgbench_init(scale=1)
|
||||
|
||||
node.safe_psql(
|
||||
'postgres',
|
||||
'CHECKPOINT')
|
||||
|
||||
node.pgbench_init(scale=1)
|
||||
|
||||
node.safe_psql(
|
||||
'postgres',
|
||||
'CHECKPOINT')
|
||||
node.pgbench_init(scale=5)
|
||||
|
||||
node.safe_psql(
|
||||
'postgres',
|
||||
|
Loading…
Reference in New Issue
Block a user