mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-02-03 14:01:57 +02:00
tests: fixes for testgres1
This commit is contained in:
parent
78503f905b
commit
760afb60aa
@ -713,9 +713,9 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
||||
self.add_instance(backup_dir, 'node', node)
|
||||
node.start()
|
||||
if self.get_version(node) < 100000:
|
||||
pg_receivexlog_path = node.get_bin_path('pg_receivexlog')
|
||||
pg_receivexlog_path = self.get_bin_path('pg_receivexlog')
|
||||
else:
|
||||
pg_receivexlog_path = node.get_bin_path('pg_receivewal')
|
||||
pg_receivexlog_path = self.get_bin_path('pg_receivewal')
|
||||
|
||||
pg_receivexlog = self.run_binary(
|
||||
[
|
||||
|
@ -422,8 +422,9 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.del_test_dir(module_name, fname)
|
||||
|
||||
# @unittest.skip("skip")
|
||||
def test_tablespace_in_pgdata(self):
|
||||
"""make node, corrupt some page, check that backup failed"""
|
||||
@unittest.expectedFailure
|
||||
def test_tablespace_in_pgdata_pgpro_1376(self):
|
||||
"""PGPRO-1376 """
|
||||
fname = self.id().split('.')[3]
|
||||
node = self.make_simple_node(
|
||||
base_dir="{0}/{1}/node".format(module_name, fname),
|
||||
|
@ -36,7 +36,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
self.node.start()
|
||||
|
||||
self.create_tblspace_in_node(self.node, tblspace_name, True)
|
||||
self.create_tblspace_in_node(self.node, tblspace_name, cfs=True)
|
||||
|
||||
tblspace = self.node.safe_psql(
|
||||
"postgres",
|
||||
@ -778,8 +778,8 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
tblspace_name_1 = 'tblspace_name_1'
|
||||
tblspace_name_2 = 'tblspace_name_2'
|
||||
|
||||
self.create_tblspace_in_node(self.node, tblspace_name_1, True)
|
||||
self.create_tblspace_in_node(self.node, tblspace_name_2, True)
|
||||
self.create_tblspace_in_node(self.node, tblspace_name_1, cfs=True)
|
||||
self.create_tblspace_in_node(self.node, tblspace_name_2, cfs=True)
|
||||
|
||||
self.node.safe_psql(
|
||||
"postgres",
|
||||
|
@ -44,7 +44,7 @@ class CfsRestoreBase(ProbackupTest, unittest.TestCase):
|
||||
self.set_archiving(self.backup_dir, 'node', self.node)
|
||||
|
||||
self.node.start()
|
||||
self.create_tblspace_in_node(self.node, tblspace_name, True)
|
||||
self.create_tblspace_in_node(self.node, tblspace_name, cfs=True)
|
||||
|
||||
self.add_data_in_cluster()
|
||||
|
||||
|
@ -698,7 +698,7 @@ class ProbackupTest(object):
|
||||
|
||||
def delete_expired(self, backup_dir, instance, options=[]):
|
||||
cmd_list = [
|
||||
"delete", "--expired",
|
||||
"delete", "--expired", "--wal",
|
||||
"-B", backup_dir,
|
||||
"--instance={0}".format(instance)
|
||||
]
|
||||
@ -855,6 +855,7 @@ class ProbackupTest(object):
|
||||
node.safe_psql("postgres", "select pg_switch_wal()")
|
||||
else:
|
||||
node.safe_psql("postgres", "select pg_switch_xlog()")
|
||||
sleep(1)
|
||||
|
||||
def get_version(self, node):
|
||||
return self.version_to_num(
|
||||
|
@ -1614,7 +1614,7 @@ 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': '1GB',
|
||||
'ptrack_enable': 'on', 'fsync': 'off', 'shared_buffers': '128MB',
|
||||
'maintenance_work_mem': '1GB', 'autovacuum': 'off',
|
||||
'full_page_writes': 'off'}
|
||||
)
|
||||
|
@ -48,6 +48,13 @@ class RetentionTest(ProbackupTest, unittest.TestCase):
|
||||
min_wal = line[31:-1]
|
||||
elif line.startswith("INFO: removed max WAL segment"):
|
||||
max_wal = line[31:-1]
|
||||
|
||||
if not min_wal:
|
||||
self.assertTrue(False, "min_wal is empty")
|
||||
|
||||
if not max_wal:
|
||||
self.assertTrue(False, "max_wal is not set")
|
||||
|
||||
for wal_name in os.listdir(os.path.join(backup_dir, 'wal', 'node')):
|
||||
if not wal_name.endswith(".backup"):
|
||||
#wal_name_b = wal_name.encode('ascii')
|
||||
|
@ -1,6 +1,6 @@
|
||||
import os
|
||||
import unittest
|
||||
from .helpers.ptrack_helpers import ProbackupTest
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
|
||||
|
||||
|
||||
module_name = 'show'
|
||||
@ -14,7 +14,8 @@ class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
"""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),
|
||||
node = self.make_simple_node(
|
||||
base_dir="{0}/{1}/node".format(module_name, fname),
|
||||
initdb_params=['--data-checksums'],
|
||||
pg_options={'wal_level': 'replica'}
|
||||
)
|
||||
@ -25,7 +26,9 @@ class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
node.start()
|
||||
|
||||
self.assertEqual(
|
||||
self.backup_node(backup_dir, 'node', node, options=["--log-level-console=panic"]),
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node,
|
||||
options=["--log-level-console=panic"]),
|
||||
None
|
||||
)
|
||||
self.assertIn("OK", self.show_pb(backup_dir, 'node', as_text=True))
|
||||
@ -38,7 +41,8 @@ class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
"""Status CORRUPT"""
|
||||
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),
|
||||
node = self.make_simple_node(
|
||||
base_dir="{0}/{1}/node".format(module_name, fname),
|
||||
initdb_params=['--data-checksums'],
|
||||
pg_options={'wal_level': 'replica'}
|
||||
)
|
||||
@ -51,10 +55,28 @@ class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
backup_id = self.backup_node(backup_dir, 'node', node)
|
||||
|
||||
# delete file which belong to backup
|
||||
file = os.path.join(backup_dir, "backups", "node", backup_id, "database", "postgresql.conf")
|
||||
file = os.path.join(
|
||||
backup_dir, "backups", "node",
|
||||
backup_id, "database", "postgresql.conf")
|
||||
os.remove(file)
|
||||
|
||||
self.validate_pb(backup_dir, 'node', backup_id)
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node', backup_id)
|
||||
# we should die here because exception is what we expect to happen
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because backup corrupted.\n"
|
||||
" Output: {0} \n CMD: {1}".format(
|
||||
repr(self.output), self.cmd
|
||||
)
|
||||
)
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'data files are corrupted\n',
|
||||
e.message,
|
||||
'\n Unexpected Error Message: {0}\n'
|
||||
' CMD: {1}'.format(repr(e.message), self.cmd)
|
||||
)
|
||||
self.assertIn("CORRUPT", self.show_pb(backup_dir, as_text=True))
|
||||
|
||||
# Clean after yourself
|
||||
|
Loading…
x
Reference in New Issue
Block a user