Skip to content

[#258] Problems in ProbackupTest and TestBasic(ProbackupTest) are fixed #259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions testgres/plugins/pg_probackup2/pg_probackup2/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class ProbackupTest:
pg_node: testgres.PostgresNode
pg_node: testgres.NodeApp

@staticmethod
def probackup_is_available() -> bool:
Expand Down Expand Up @@ -75,21 +75,30 @@ def helper__build_backup_dir(self, backup='backup'):
@pytest.mark.skipif(not ProbackupTest.probackup_is_available(), reason="Check that PGPROBACKUPBIN is defined and is valid.")
class TestBasic(ProbackupTest):
def test_full_backup(self):
assert self.pg_node is not None
assert type(self.pg_node) == testgres.NodeApp # noqa: E721
assert self.pb is not None
assert type(self.pb) == ProbackupApp # noqa: E721

# 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)
assert node is not None
assert type(node) == testgres.PostgresNode # noqa: E721

with node:
# 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)
# 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)
# 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
assert f"INFO: Backup {backup_id} is valid" in out
# Check if the backup is valid
assert f"INFO: Backup {backup_id} is valid" in out