Skip to content

postgrespro/testgres-pg_probackup2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

testgres - pg_probackup2

Control and testing utility for pg_probackup2. Python 3.5+ is supported.

Installation

To install testgres, run:

pip install testgres-pg_probackup

We encourage you to use virtualenv for your testing environment. The package requires testgres~=1.9.3.

Usage

Environment variables

Variable Required Default value Description
PGPROBACKUP_TMP_DIR No tests/tmp_dirs The root of the temporary directory hierarchy where tests store data and logs. Relative paths start from the current working directory.
PG_PROBACKUP_TEST_BACKUP_DIR_PREFIX No Temporary test hierarchy Prefix of the test backup directories. Must be an absolute path. Use this variable to store test backups in a location other than the temporary test hierarchy.
PG_PROBACKUP_VALGRIND No Not set Run pg_probackup through valgrind if the variable is set to 'y'. Setting PG_PROBACKUP_VALGRIND_SUP (see below) to any value enables valgrind just like setting PG_PROBACKUP_VALGRIND=y would do.
PG_PROBACKUP_VALGRIND_SUP No Not set Specify the path to a valgrind suppression file. If the variable is not set then a file named "valgrind.supp" is searched for in the current working directory (normally the root of pg_probackup repository). Setting PG_PROBACKUP_VALGRIND_SUP to any value enables valgrind just like setting PG_PROBACKUP_VALGRIND=y (see above) would do.

See Testgres on how to configure a custom Postgres installation using PG_CONFIG and PG_BIN environment variables.

Examples

Here is an example of what you can do with testgres-pg_probackup2:

# You can see full script here plugins/pg_probackup2/pg_probackup2/tests/basic_test.py
def test_full_backup(self):
    # Setting up a simple test node
    node = self.pg_node.make_simple('node', pg_options={"fsync": "off", "synchronous_commit": "off"})

    # Initialize and configure Probackup
    self.pb.init()
    self.pb.add_instance('node', node)
    self.pb.set_archiving('node', node)

    # Start the node and initialize pgbench
    node.slow_start()
    node.pgbench_init(scale=100, no_vacuum=True)

    # Perform backup and validation
    backup_id = self.pb.backup_node('node', node)
    out = self.pb.validate('node', backup_id)

    # Check if the backup is valid
    self.assertIn(f"INFO: Backup {backup_id} is valid", out)

Authors

Postgres Professional

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy