Skip to content

Commit d48477d

Browse files
[#258] Problems in ProbackupTest and TestBasic(ProbackupTest) are fixed (#259)
* [#258] Declaration of ProbackupTest::pg_node is corrected ProbackupTest::pg_node is testgres.NodeApp, not testgres.PostgresNode. Asserts are added. * [#258] TestBasic::test_full_backup cleans node object Node cleanup is added. TODO: we should to stop node only and cleanup his data in conftest.
1 parent 354de69 commit d48477d

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

testgres/plugins/pg_probackup2/pg_probackup2/tests/test_basic.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class ProbackupTest:
14-
pg_node: testgres.PostgresNode
14+
pg_node: testgres.NodeApp
1515

1616
@staticmethod
1717
def probackup_is_available() -> bool:
@@ -75,21 +75,30 @@ def helper__build_backup_dir(self, backup='backup'):
7575
@pytest.mark.skipif(not ProbackupTest.probackup_is_available(), reason="Check that PGPROBACKUPBIN is defined and is valid.")
7676
class TestBasic(ProbackupTest):
7777
def test_full_backup(self):
78+
assert self.pg_node is not None
79+
assert type(self.pg_node) == testgres.NodeApp # noqa: E721
80+
assert self.pb is not None
81+
assert type(self.pb) == ProbackupApp # noqa: E721
82+
7883
# Setting up a simple test node
7984
node = self.pg_node.make_simple('node', pg_options={"fsync": "off", "synchronous_commit": "off"})
8085

81-
# Initialize and configure Probackup
82-
self.pb.init()
83-
self.pb.add_instance('node', node)
84-
self.pb.set_archiving('node', node)
86+
assert node is not None
87+
assert type(node) == testgres.PostgresNode # noqa: E721
88+
89+
with node:
90+
# Initialize and configure Probackup
91+
self.pb.init()
92+
self.pb.add_instance('node', node)
93+
self.pb.set_archiving('node', node)
8594

86-
# Start the node and initialize pgbench
87-
node.slow_start()
88-
node.pgbench_init(scale=100, no_vacuum=True)
95+
# Start the node and initialize pgbench
96+
node.slow_start()
97+
node.pgbench_init(scale=100, no_vacuum=True)
8998

90-
# Perform backup and validation
91-
backup_id = self.pb.backup_node('node', node)
92-
out = self.pb.validate('node', backup_id)
99+
# Perform backup and validation
100+
backup_id = self.pb.backup_node('node', node)
101+
out = self.pb.validate('node', backup_id)
93102

94-
# Check if the backup is valid
95-
assert f"INFO: Backup {backup_id} is valid" in out
103+
# Check if the backup is valid
104+
assert f"INFO: Backup {backup_id} is valid" in out

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