mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-26 09:47:58 +00:00
move config cmd tests to own module
This commit is contained in:
parent
8aaad71439
commit
32f81eff27
2 changed files with 42 additions and 40 deletions
|
@ -1891,42 +1891,6 @@ def test_bad_filters(self):
|
|||
self.cmd(f"--repo={self.repository_location}", "create", "test", "input")
|
||||
self.cmd(f"--repo={self.repository_location}", "delete", "--first", "1", "--last", "1", fork=True, exit_code=2)
|
||||
|
||||
def test_config(self):
|
||||
self.create_test_files()
|
||||
os.unlink("input/flagfile")
|
||||
self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION)
|
||||
output = self.cmd(f"--repo={self.repository_location}", "config", "--list")
|
||||
self.assert_in("[repository]", output)
|
||||
self.assert_in("version", output)
|
||||
self.assert_in("segments_per_dir", output)
|
||||
self.assert_in("storage_quota", output)
|
||||
self.assert_in("append_only", output)
|
||||
self.assert_in("additional_free_space", output)
|
||||
self.assert_in("id", output)
|
||||
self.assert_not_in("last_segment_checked", output)
|
||||
|
||||
output = self.cmd(f"--repo={self.repository_location}", "config", "last_segment_checked", exit_code=1)
|
||||
self.assert_in("No option ", output)
|
||||
self.cmd(f"--repo={self.repository_location}", "config", "last_segment_checked", "123")
|
||||
output = self.cmd(f"--repo={self.repository_location}", "config", "last_segment_checked")
|
||||
assert output == "123" + "\n"
|
||||
output = self.cmd(f"--repo={self.repository_location}", "config", "--list")
|
||||
self.assert_in("last_segment_checked", output)
|
||||
self.cmd(f"--repo={self.repository_location}", "config", "--delete", "last_segment_checked")
|
||||
|
||||
for cfg_key, cfg_value in [("additional_free_space", "2G"), ("repository.append_only", "1")]:
|
||||
output = self.cmd(f"--repo={self.repository_location}", "config", cfg_key)
|
||||
assert output == "0" + "\n"
|
||||
self.cmd(f"--repo={self.repository_location}", "config", cfg_key, cfg_value)
|
||||
output = self.cmd(f"--repo={self.repository_location}", "config", cfg_key)
|
||||
assert output == cfg_value + "\n"
|
||||
self.cmd(f"--repo={self.repository_location}", "config", "--delete", cfg_key)
|
||||
self.cmd(f"--repo={self.repository_location}", "config", cfg_key, exit_code=1)
|
||||
|
||||
self.cmd(f"--repo={self.repository_location}", "config", "--list", "--delete", exit_code=2)
|
||||
self.cmd(f"--repo={self.repository_location}", "config", exit_code=2)
|
||||
self.cmd(f"--repo={self.repository_location}", "config", "invalid-option", exit_code=1)
|
||||
|
||||
# derived from test_extract_xattrs_errors()
|
||||
@pytest.mark.skipif(
|
||||
not xattr.XATTR_FAKEROOT, reason="xattr not supported on this system or on this version of fakeroot"
|
||||
|
@ -2117,10 +2081,6 @@ def test_remote_repo_restrict_to_repository(self):
|
|||
with pytest.raises(PathNotAllowed):
|
||||
self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION)
|
||||
|
||||
@unittest.skip("only works locally")
|
||||
def test_config(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("only works locally")
|
||||
def test_migrate_lock_alive(self):
|
||||
pass
|
||||
|
|
42
src/borg/testsuite/archiver/config_cmd.py
Normal file
42
src/borg/testsuite/archiver/config_cmd.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
import os
|
||||
|
||||
from ...constants import * # NOQA
|
||||
from . import ArchiverTestCaseBase, RK_ENCRYPTION
|
||||
|
||||
|
||||
class ArchiverTestCase(ArchiverTestCaseBase):
|
||||
def test_config(self):
|
||||
self.create_test_files()
|
||||
os.unlink("input/flagfile")
|
||||
self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION)
|
||||
output = self.cmd(f"--repo={self.repository_location}", "config", "--list")
|
||||
self.assert_in("[repository]", output)
|
||||
self.assert_in("version", output)
|
||||
self.assert_in("segments_per_dir", output)
|
||||
self.assert_in("storage_quota", output)
|
||||
self.assert_in("append_only", output)
|
||||
self.assert_in("additional_free_space", output)
|
||||
self.assert_in("id", output)
|
||||
self.assert_not_in("last_segment_checked", output)
|
||||
|
||||
output = self.cmd(f"--repo={self.repository_location}", "config", "last_segment_checked", exit_code=1)
|
||||
self.assert_in("No option ", output)
|
||||
self.cmd(f"--repo={self.repository_location}", "config", "last_segment_checked", "123")
|
||||
output = self.cmd(f"--repo={self.repository_location}", "config", "last_segment_checked")
|
||||
assert output == "123" + "\n"
|
||||
output = self.cmd(f"--repo={self.repository_location}", "config", "--list")
|
||||
self.assert_in("last_segment_checked", output)
|
||||
self.cmd(f"--repo={self.repository_location}", "config", "--delete", "last_segment_checked")
|
||||
|
||||
for cfg_key, cfg_value in [("additional_free_space", "2G"), ("repository.append_only", "1")]:
|
||||
output = self.cmd(f"--repo={self.repository_location}", "config", cfg_key)
|
||||
assert output == "0" + "\n"
|
||||
self.cmd(f"--repo={self.repository_location}", "config", cfg_key, cfg_value)
|
||||
output = self.cmd(f"--repo={self.repository_location}", "config", cfg_key)
|
||||
assert output == cfg_value + "\n"
|
||||
self.cmd(f"--repo={self.repository_location}", "config", "--delete", cfg_key)
|
||||
self.cmd(f"--repo={self.repository_location}", "config", cfg_key, exit_code=1)
|
||||
|
||||
self.cmd(f"--repo={self.repository_location}", "config", "--list", "--delete", exit_code=2)
|
||||
self.cmd(f"--repo={self.repository_location}", "config", exit_code=2)
|
||||
self.cmd(f"--repo={self.repository_location}", "config", "invalid-option", exit_code=1)
|
Loading…
Reference in a new issue