Add missing test (#911).
Some checks failed
build / docs (push) Blocked by required conditions
build / test (push) Has been cancelled

This commit is contained in:
Dan Helfman 2024-10-01 09:26:00 -07:00
parent fd4f69f6c3
commit bf1e8bc44e
5 changed files with 35 additions and 12 deletions

2
NEWS
View File

@ -1,7 +1,7 @@
1.8.15.dev0
* #911: Add a "key change-passphrase" action to change the passphrase protecting a repository key.
* #915: Rename repository actions like "rcreate" to more explicit names like "repo-create" for
compatibility with recent Borg 2 changes.
compatibility with recent changes in Borg 2.0.0b10.
1.8.14
* #896: Fix an error in borgmatic rcreate/init on an empty repository directory with Borg 1.4.

View File

@ -431,7 +431,7 @@ def make_base_create_command(
+ (('--compression', compression) if compression else ())
+ upload_ratelimit_flags
+ (('--upload-buffer', str(upload_buffer_size)) if upload_buffer_size else ())
+ (('--one-file-system',) if config.get('one_file_system') or stream_processes else ())
+ (('--one-file-system',) if config.get('one_file_system') else ())
+ numeric_ids_flags
+ atime_flags
+ (('--noctime',) if config.get('ctime') is False else ())

View File

@ -466,13 +466,14 @@ exclude them. <span class="minilink minilink-addedin">Prior to version
1.7.3</span>Special files were not auto-excluded, and you were responsible for
excluding them yourself. Common directories to exclude are `/dev` and `/run`,
but that may not be exhaustive.
5. Database hooks also implicitly enable the `one_file_system` option, which
means Borg won't cross filesystem boundaries when looking for files to backup.
This is especially important when running borgmatic in a container, as
container volumes are mounted as separate filesystems. One work-around is to
explicitly add each mounted volume you'd like to backup to
5. <span class="minilink minilink-addedin">Prior to version 1.8.15</span>
Database hooks also implicitly enabled the `one_file_system` option, which
meant Borg wouldn't cross filesystem boundaries when looking for files to
backup. When borgmatic was running in a container, this often required a
work-around to explicitly add each mounted backup volume to
`source_directories` instead of relying on Borg to include them implicitly via
a parent directory.
a parent directory. However, as of borgmatic 1.8.15, `one_file_system` is no
longer auto-enabled and such work-arounds aren't necessary.
### Manual restoration

View File

@ -989,7 +989,7 @@ def test_make_base_create_command_with_stream_processes_ignores_read_special_fal
)
)
assert create_flags == ('borg', 'create', '--one-file-system', '--read-special')
assert create_flags == ('borg', 'create', '--read-special')
assert create_positional_arguments == REPO_ARCHIVE_WITH_PATHS
assert not pattern_file
assert exclude_file
@ -1031,7 +1031,7 @@ def test_make_base_create_command_with_stream_processes_and_read_special_true_sk
)
)
assert create_flags == ('borg', 'create', '--one-file-system', '--read-special')
assert create_flags == ('borg', 'create', '--read-special')
assert create_positional_arguments == REPO_ARCHIVE_WITH_PATHS
assert not pattern_file
assert not exclude_file
@ -1750,7 +1750,7 @@ def test_create_archive_with_progress_and_stream_processes_calls_borg_with_progr
flexmock(module).should_receive('collect_borgmatic_source_directories').and_return([])
flexmock(module).should_receive('make_base_create_command').and_return(
(
('borg', 'create', '--one-file-system', '--read-special'),
('borg', 'create', '--read-special'),
REPO_ARCHIVE_WITH_PATHS,
flexmock(),
flexmock(),
@ -1760,7 +1760,6 @@ def test_create_archive_with_progress_and_stream_processes_calls_borg_with_progr
create_command = (
'borg',
'create',
'--one-file-system',
'--read-special',
'--progress',
) + REPO_ARCHIVE_WITH_PATHS

View File

@ -981,6 +981,29 @@ def test_run_actions_runs_export_key():
)
def test_run_actions_runs_change_passphrase():
flexmock(module).should_receive('add_custom_log_levels')
flexmock(module).should_receive('get_skip_actions').and_return([])
flexmock(module.command).should_receive('execute_hook')
flexmock(borgmatic.actions.change_passphrase).should_receive('run_change_passphrase').once()
tuple(
module.run_actions(
arguments={
'global': flexmock(dry_run=False, log_file='foo'),
'change-passphrase': flexmock(),
},
config_filename=flexmock(),
config={'repositories': []},
config_paths=[],
local_path=flexmock(),
remote_path=flexmock(),
local_borg_version=flexmock(),
repository={'path': 'repo'},
)
)
def test_run_actions_runs_delete():
flexmock(module).should_receive('add_custom_log_levels')
flexmock(module).should_receive('get_skip_actions').and_return([])