|
11 | 11 |
|
12 | 12 |
|
13 | 13 | class ProbackupTest:
|
14 |
| -pg_node: testgres.PostgresNode |
| 14 | +pg_node: testgres.NodeApp |
15 | 15 |
|
16 | 16 | @staticmethod
|
17 | 17 | def probackup_is_available() -> bool:
|
@@ -75,21 +75,30 @@ def helper__build_backup_dir(self, backup='backup'):
|
75 | 75 | @pytest.mark.skipif(not ProbackupTest.probackup_is_available(), reason="Check that PGPROBACKUPBIN is defined and is valid.")
|
76 | 76 | class TestBasic(ProbackupTest):
|
77 | 77 | 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 | + |
78 | 83 | # Setting up a simple test node
|
79 | 84 | node = self.pg_node.make_simple('node', pg_options={"fsync": "off", "synchronous_commit": "off"})
|
80 | 85 |
|
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) |
85 | 94 |
|
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) |
89 | 98 |
|
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) |
93 | 102 |
|
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