1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-09-16 09:26:30 +02:00

tests: minor changes to logging and snapfs tests

This commit is contained in:
Grigory Smolkin
2019-03-29 22:10:24 +03:00
parent 6fef70277d
commit 2647c37841
2 changed files with 37 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
import unittest
import os
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
import datetime
module_name = 'logging'
@@ -15,10 +15,8 @@ class LogTest(ProbackupTest, unittest.TestCase):
fname = self.id().split('.')[3]
node = self.make_simple_node(
base_dir=os.path.join(module_name, fname, 'node'),
initdb_params=['--data-checksums'],
pg_options={
'wal_level': 'replica'}
)
initdb_params=['--data-checksums'])
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
self.init_pb(backup_dir)
self.add_instance(backup_dir, 'node', node)
@@ -41,4 +39,36 @@ class LogTest(ProbackupTest, unittest.TestCase):
gdb.continue_execution_until_exit()
# Clean after yourself
self.del_test_dir(module_name, fname)
self.del_test_dir(module_name, fname)
def test_log_filename_strftime(self):
fname = self.id().split('.')[3]
node = self.make_simple_node(
base_dir=os.path.join(module_name, fname, 'node'),
initdb_params=['--data-checksums'])
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
self.init_pb(backup_dir)
self.add_instance(backup_dir, 'node', node)
node.slow_start()
self.set_config(
backup_dir, 'node',
options=['--log-rotation-age=1d'])
self.backup_node(
backup_dir, 'node', node,
options=[
'--stream',
'--log-level-file=VERBOSE',
'--log-filename=pg_probackup-%a.log'])
day_of_week = datetime.datetime.today().strftime("%a")
path = os.path.join(
backup_dir, 'log', 'pg_probackup-{0}.log'.format(day_of_week))
self.assertTrue(os.path.isfile(path))
# Clean after yourself
self.del_test_dir(module_name, fname)

View File

@@ -9,8 +9,8 @@ module_name = 'snapfs'
class SnapFSTest(ProbackupTest, unittest.TestCase):
# @unittest.skip("skip")
# @unittest.expectedFailure
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
def test_snapfs_simple(self):
"""standart backup modes with ARCHIVE WAL method"""
fname = self.id().split('.')[3]