Skip to content

Commit a65da28

Browse files
authored
Add pg_probackup plugin (#92)
1 parent 5218b11 commit a65da28

File tree

13 files changed

+1722
-1
lines changed

13 files changed

+1722
-1
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
readme = f.read()
2828

2929
setup(
30-
version='1.9.3',
30+
version='1.10.0',
3131
name='testgres',
3232
packages=['testgres', 'testgres.operations', 'testgres.helpers'],
3333
description='Testing utility for PostgreSQL and its extensions',

testgres/plugins/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from pg_probackup2.gdb import GDBobj
2+
from pg_probackup2.app import ProbackupApp, ProbackupException
3+
from pg_probackup2.init_helpers import init_params
4+
from pg_probackup2.storage.fs_backup import FSTestBackupDir
5+
from pg_probackup2.storage.s3_backup import S3TestBackupDir
6+
7+
__all__ = [
8+
"ProbackupApp", "ProbackupException", "init_params", "FSTestBackupDir", "S3TestBackupDir", "GDBobj"
9+
]
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# testgres - pg_probackup2
2+
3+
Ccontrol and testing utility for [pg_probackup2](https://github.com/postgrespro/pg_probackup). Python 3.5+ is supported.
4+
5+
6+
## Installation
7+
8+
To install `testgres`, run:
9+
10+
```
11+
pip install testgres-pg_probackup
12+
```
13+
14+
We encourage you to use `virtualenv` for your testing environment.
15+
The package requires testgres~=1.9.3.
16+
17+
## Usage
18+
19+
### Environment
20+
21+
> Note: by default testgres runs `initdb`, `pg_ctl`, `psql` provided by `PATH`.
22+
23+
There are several ways to specify a custom postgres installation:
24+
25+
* export `PG_CONFIG` environment variable pointing to the `pg_config` executable;
26+
* export `PG_BIN` environment variable pointing to the directory with executable files.
27+
28+
Example:
29+
30+
```bash
31+
export PG_BIN=$HOME/pg/bin
32+
python my_tests.py
33+
```
34+
35+
36+
### Examples
37+
38+
Here is an example of what you can do with `testgres-pg_probackup2`:
39+
40+
```python
41+
# You can see full script here plugins/pg_probackup2/pg_probackup2/tests/basic_test.py
42+
def test_full_backup(self):
43+
# Setting up a simple test node
44+
node = self.pg_node.make_simple('node', pg_options={"fsync": "off", "synchronous_commit": "off"})
45+
46+
# Initialize and configure Probackup
47+
self.pb.init()
48+
self.pb.add_instance('node', node)
49+
self.pb.set_archiving('node', node)
50+
51+
# Start the node and initialize pgbench
52+
node.slow_start()
53+
node.pgbench_init(scale=100, no_vacuum=True)
54+
55+
# Perform backup and validation
56+
backup_id = self.pb.backup_node('node', node)
57+
out = self.pb.validate('node', backup_id)
58+
59+
# Check if the backup is valid
60+
self.assertIn(f"INFO: Backup {backup_id} is valid", out)
61+
```
62+
63+
## Authors
64+
65+
[Postgres Professional](https://postgrespro.ru/about)

testgres/plugins/pg_probackup2/__init__.py

Whitespace-only changes.

testgres/plugins/pg_probackup2/pg_probackup2/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)
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