1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-12-11 11:41:33 +02:00
pg_probackup/tests/snapfs.py
AndrewBille 8846e1997a
Stabilizy tests. (#411)
* tests: Introduced a new flag for tests -- PGPROBACKUP_GDB
* tests: Do travis builds with CFLAGS="-O0" (stabilization of gdb tests)
* tests: Run compatibility tests only if PGPROBACKUPBIN_OLD set
* tests: Running some tests now depends on PGPROBACKUP_SSH_REMOTE
2021-08-03 21:59:49 +03:00

62 lines
1.7 KiB
Python

import unittest
import os
from time import sleep
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
module_name = 'snapfs'
class SnapFSTest(ProbackupTest, unittest.TestCase):
# @unittest.expectedFailure
def test_snapfs_simple(self):
"""standart backup modes with ARCHIVE WAL method"""
if not self.enterprise:
self.skipTest('This test must be run on enterprise')
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)
self.set_archiving(backup_dir, 'node', node)
node.slow_start()
self.backup_node(backup_dir, 'node', node)
node.safe_psql(
'postgres',
'select pg_make_snapshot()')
node.pgbench_init(scale=10)
pgbench = node.pgbench(options=['-T', '50', '-c', '2', '--no-vacuum'])
pgbench.wait()
self.backup_node(
backup_dir, 'node', node, backup_type='page')
node.safe_psql(
'postgres',
'select pg_remove_snapshot(1)')
self.backup_node(
backup_dir, 'node', node, backup_type='page')
pgdata = self.pgdata_content(node.data_dir)
node.cleanup()
self.restore_node(
backup_dir, 'node',
node, options=["-j", "4"])
pgdata_restored = self.pgdata_content(node.data_dir)
self.compare_pgdata(pgdata, pgdata_restored)
# Clean after yourself
self.del_test_dir(module_name, fname)