Skip to content

Commit e49af7d

Browse files
Merge pull request #6 from dura0ok/revert-archiving-instance-check
Revert "PBCKP-2912: add sanity check in set_archiving(instance should…
2 parents 072a77e + 0514bc7 commit e49af7d

File tree

2 files changed

+3
-29
lines changed

2 files changed

+3
-29
lines changed

pg_probackup2/app.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -787,13 +787,6 @@ def set_archiving(
787787
log_level=False, archive_timeout=False,
788788
custom_archive_command=None):
789789

790-
# check instance existing
791-
instances_json = self.show(instance=None, as_json=True, expect_error=False, as_text=True)
792-
instances_data = json.loads(instances_json)
793-
if not any(inst_data.get('instance') == instance for inst_data in instances_data):
794-
raise RuntimeError("Instance '{0}' does not exist. " \
795-
"Please add the instance first using add_instance() or init_pb_node().".format(instance))
796-
797790
# parse postgresql.auto.conf
798791
options = {}
799792
if replica:

pg_probackup2/tests/test_basic.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import pytest
66

77
import testgres
8-
from pg_probackup2.app import ProbackupApp
9-
from pg_probackup2.init_helpers import Init, init_params
10-
from pg_probackup2.storage.fs_backup import FSTestBackupDir
8+
from ...pg_probackup2.app import ProbackupApp
9+
from ...pg_probackup2.init_helpers import Init, init_params
10+
from ..storage.fs_backup import FSTestBackupDir
1111

1212

1313
class ProbackupTest:
@@ -102,22 +102,3 @@ def test_full_backup(self):
102102

103103
# Check if the backup is valid
104104
assert f"INFO: Backup {backup_id} is valid" in out
105-
106-
def test_set_archiving_nonexistent_instance(self):
107-
self.pb.init()
108-
109-
with pytest.raises(AssertionError) as exc_info:
110-
self.pb.set_archiving('nonexistent_instance', None)
111-
112-
assert "Instance 'nonexistent_instance' does not exist" in str(exc_info.value)
113-
114-
def test_set_archiving_existing_instance(self):
115-
node = self.pg_node.make_simple('node', pg_options={"fsync": "off", "synchronous_commit": "off"})
116-
117-
with node:
118-
self.pb.init()
119-
node.slow_start()
120-
self.pb.add_instance('node', node)
121-
self.pb.set_archiving('node', node)
122-
123-
assert "does not exist" not in str(self.pb.test_class.output or "")

0 commit comments

Comments
 (0)