From 34305d686c4df8132d2d4ed48e69a996160e2755 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Tue, 1 Oct 2024 09:28:39 -0700 Subject: [PATCH] Revert "Add missing test (#911)" which accidentally included unrelated changes. This reverts commit bf1e8bc44ec460980fad19372c04eb37c039fa1f. --- NEWS | 2 +- borgmatic/borg/create.py | 2 +- docs/how-to/backup-your-databases.md | 13 ++++++------- tests/unit/borg/test_create.py | 7 ++++--- tests/unit/commands/test_borgmatic.py | 23 ----------------------- 5 files changed, 12 insertions(+), 35 deletions(-) diff --git a/NEWS b/NEWS index 3e2680f8..788e6354 100644 --- a/NEWS +++ b/NEWS @@ -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 changes in Borg 2.0.0b10. + compatibility with recent Borg 2 changes. 1.8.14 * #896: Fix an error in borgmatic rcreate/init on an empty repository directory with Borg 1.4. diff --git a/borgmatic/borg/create.py b/borgmatic/borg/create.py index 3fd645bf..0ed56261 100644 --- a/borgmatic/borg/create.py +++ b/borgmatic/borg/create.py @@ -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') else ()) + + (('--one-file-system',) if config.get('one_file_system') or stream_processes else ()) + numeric_ids_flags + atime_flags + (('--noctime',) if config.get('ctime') is False else ()) diff --git a/docs/how-to/backup-your-databases.md b/docs/how-to/backup-your-databases.md index 5520fc1e..fbabc7b8 100644 --- a/docs/how-to/backup-your-databases.md +++ b/docs/how-to/backup-your-databases.md @@ -466,14 +466,13 @@ exclude them. Prior to version 1.7.3Special 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. Prior to version 1.8.15 -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 +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 `source_directories` instead of relying on Borg to include them implicitly via -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. +a parent directory. ### Manual restoration diff --git a/tests/unit/borg/test_create.py b/tests/unit/borg/test_create.py index 79cb63bf..8e20dc63 100644 --- a/tests/unit/borg/test_create.py +++ b/tests/unit/borg/test_create.py @@ -989,7 +989,7 @@ def test_make_base_create_command_with_stream_processes_ignores_read_special_fal ) ) - assert create_flags == ('borg', 'create', '--read-special') + assert create_flags == ('borg', 'create', '--one-file-system', '--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', '--read-special') + assert create_flags == ('borg', 'create', '--one-file-system', '--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', '--read-special'), + ('borg', 'create', '--one-file-system', '--read-special'), REPO_ARCHIVE_WITH_PATHS, flexmock(), flexmock(), @@ -1760,6 +1760,7 @@ 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 diff --git a/tests/unit/commands/test_borgmatic.py b/tests/unit/commands/test_borgmatic.py index ffd0e61e..10eebd90 100644 --- a/tests/unit/commands/test_borgmatic.py +++ b/tests/unit/commands/test_borgmatic.py @@ -981,29 +981,6 @@ 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([])