1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-07-16 07:14:15 +02:00

tests fix

This commit is contained in:
Grigory Smolkin
2017-06-20 13:57:23 +03:00
parent 5e034a4acc
commit 1a849cad7e
23 changed files with 1029 additions and 754 deletions

View File

@ -1,4 +1,5 @@
import unittest
import os
from sys import exit
from testgres import get_new_node, stop_all
from helpers.ptrack_helpers import ProbackupTest, idx_ptrack
@ -7,6 +8,7 @@ from helpers.ptrack_helpers import ProbackupTest, idx_ptrack
class SimpleTest(ProbackupTest, unittest.TestCase):
def __init__(self, *args, **kwargs):
super(SimpleTest, self).__init__(*args, **kwargs)
self.module_name = 'ptrack_cluster'
def teardown(self):
# clean_all()
@ -16,12 +18,15 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
# @unittest.expectedFailure
def test_ptrack_cluster_btree(self):
fname = self.id().split('.')[3]
node = self.make_simple_node(base_dir="tmp_dirs/ptrack/{0}".format(fname),
node = self.make_simple_node(base_dir="{0}/{1}/node".format(self.module_name, fname),
set_replication=True,
initdb_params=['--data-checksums', '-A trust'],
initdb_params=['--data-checksums'],
pg_options={'ptrack_enable': 'on', 'wal_level': 'replica', 'max_wal_senders': '2'})
backup_dir = os.path.join(self.tmp_path, self.module_name, fname, 'backup')
self.init_pb(backup_dir)
self.add_instance(backup_dir, 'node', node)
node.start()
self.create_tblspace_in_node(node, 'somedata')
# Create table and indexes
@ -46,8 +51,7 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
idx_ptrack[i]['old_pages'] = self.get_md5_per_page_for_fork(
idx_ptrack[i]['path'], idx_ptrack[i]['old_size'])
self.init_pb(node)
self.backup_pb(node, backup_type='full', options=['-j100', '--stream'])
self.backup_node(backup_dir, 'node', node, options=['-j100', '--stream'])
node.psql('postgres', 'delete from t_heap where id%2 = 1')
node.psql('postgres', 'cluster t_heap using t_btree')
@ -68,17 +72,19 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
# compare pages and check ptrack sanity
self.check_ptrack_sanity(idx_ptrack[i])
self.clean_pb(node)
node.stop()
def test_ptrack_cluster_spgist(self):
fname = self.id().split('.')[3]
node = self.make_simple_node(base_dir="tmp_dirs/ptrack/{0}".format(fname),
node = self.make_simple_node(base_dir="{0}/{1}/node".format(self.module_name, fname),
set_replication=True,
initdb_params=['--data-checksums', '-A trust'],
initdb_params=['--data-checksums'],
pg_options={'ptrack_enable': 'on', 'wal_level': 'replica', 'max_wal_senders': '2'})
backup_dir = os.path.join(self.tmp_path, self.module_name, fname, 'backup')
self.init_pb(backup_dir)
self.add_instance(backup_dir, 'node', node)
node.start()
self.create_tblspace_in_node(node, 'somedata')
# Create table and indexes
@ -103,8 +109,7 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
idx_ptrack[i]['old_pages'] = self.get_md5_per_page_for_fork(
idx_ptrack[i]['path'], idx_ptrack[i]['old_size'])
self.init_pb(node)
self.backup_pb(node, backup_type='full', options=['-j100', '--stream'])
self.backup_node(backup_dir, 'node', node, options=['-j100', '--stream'])
node.psql('postgres', 'delete from t_heap where id%2 = 1')
node.psql('postgres', 'cluster t_heap using t_spgist')
@ -125,17 +130,19 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
# compare pages and check ptrack sanity
self.check_ptrack_sanity(idx_ptrack[i])
self.clean_pb(node)
node.stop()
def test_ptrack_cluster_brin(self):
fname = self.id().split('.')[3]
node = self.make_simple_node(base_dir="tmp_dirs/ptrack/{0}".format(fname),
node = self.make_simple_node(base_dir="{0}/{1}/node".format(self.module_name, fname),
set_replication=True,
initdb_params=['--data-checksums', '-A trust'],
initdb_params=['--data-checksums'],
pg_options={'ptrack_enable': 'on', 'wal_level': 'replica', 'max_wal_senders': '2'})
backup_dir = os.path.join(self.tmp_path, self.module_name, fname, 'backup')
self.init_pb(backup_dir)
self.add_instance(backup_dir, 'node', node)
node.start()
self.create_tblspace_in_node(node, 'somedata')
# Create table and indexes
@ -160,8 +167,7 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
idx_ptrack[i]['old_pages'] = self.get_md5_per_page_for_fork(
idx_ptrack[i]['path'], idx_ptrack[i]['old_size'])
self.init_pb(node)
self.backup_pb(node, backup_type='full', options=['-j100', '--stream'])
self.backup_node(backup_dir, 'node', node, options=['-j100', '--stream'])
node.psql('postgres', 'delete from t_heap where id%2 = 1')
node.psql('postgres', 'cluster t_heap using t_brin')
@ -182,17 +188,19 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
# compare pages and check ptrack sanity
self.check_ptrack_sanity(idx_ptrack[i])
self.clean_pb(node)
node.stop()
def test_ptrack_cluster_gist(self):
fname = self.id().split('.')[3]
node = self.make_simple_node(base_dir="tmp_dirs/ptrack/{0}".format(fname),
node = self.make_simple_node(base_dir="{0}/{1}/node".format(self.module_name, fname),
set_replication=True,
initdb_params=['--data-checksums', '-A trust'],
initdb_params=['--data-checksums'],
pg_options={'ptrack_enable': 'on', 'wal_level': 'replica', 'max_wal_senders': '2'})
backup_dir = os.path.join(self.tmp_path, self.module_name, fname, 'backup')
self.init_pb(backup_dir)
self.add_instance(backup_dir, 'node', node)
node.start()
self.create_tblspace_in_node(node, 'somedata')
# Create table and indexes
@ -217,8 +225,7 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
idx_ptrack[i]['old_pages'] = self.get_md5_per_page_for_fork(
idx_ptrack[i]['path'], idx_ptrack[i]['old_size'])
self.init_pb(node)
self.backup_pb(node, backup_type='full', options=['-j100', '--stream'])
self.backup_node(backup_dir, 'node', node, options=['-j100', '--stream'])
node.psql('postgres', 'delete from t_heap where id%2 = 1')
node.psql('postgres', 'cluster t_heap using t_gist')
@ -239,17 +246,19 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
# compare pages and check ptrack sanity
self.check_ptrack_sanity(idx_ptrack[i])
self.clean_pb(node)
node.stop()
def test_ptrack_cluster_gin(self):
fname = self.id().split('.')[3]
node = self.make_simple_node(base_dir="tmp_dirs/ptrack/{0}".format(fname),
node = self.make_simple_node(base_dir="{0}/{1}/node".format(self.module_name, fname),
set_replication=True,
initdb_params=['--data-checksums', '-A trust'],
initdb_params=['--data-checksums'],
pg_options={'ptrack_enable': 'on', 'wal_level': 'replica', 'max_wal_senders': '2'})
backup_dir = os.path.join(self.tmp_path, self.module_name, fname, 'backup')
self.init_pb(backup_dir)
self.add_instance(backup_dir, 'node', node)
node.start()
self.create_tblspace_in_node(node, 'somedata')
# Create table and indexes
@ -274,8 +283,7 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
idx_ptrack[i]['old_pages'] = self.get_md5_per_page_for_fork(
idx_ptrack[i]['path'], idx_ptrack[i]['old_size'])
self.init_pb(node)
self.backup_pb(node, backup_type='full', options=['-j100', '--stream'])
self.backup_node(backup_dir, 'node', node, options=['-j100', '--stream'])
node.psql('postgres', 'delete from t_heap where id%2 = 1')
node.psql('postgres', 'cluster t_heap using t_gin')
@ -296,7 +304,6 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
# compare pages and check ptrack sanity
self.check_ptrack_sanity(idx_ptrack[i])
self.clean_pb(node)
node.stop()
if __name__ == '__main__':