|
@@ -292,12 +292,50 @@ def test_create_archive_calls_borg_with_parameters():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
+ )
|
|
|
+
|
|
|
+ module.create_archive(
|
|
|
+ dry_run=False,
|
|
|
+ repository='repo',
|
|
|
+ location_config={
|
|
|
+ 'source_directories': ['foo', 'bar'],
|
|
|
+ 'repositories': ['repo'],
|
|
|
+ 'exclude_patterns': None,
|
|
|
+ },
|
|
|
+ storage_config={},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+def test_create_archive_calls_borg_with_environment():
|
|
|
+ flexmock(module).should_receive('borgmatic_source_directories').and_return([])
|
|
|
+ flexmock(module).should_receive('deduplicate_directories').and_return(('foo', 'bar'))
|
|
|
+ flexmock(module).should_receive('map_directories_to_devices').and_return({})
|
|
|
+ flexmock(module).should_receive('expand_directories').and_return(())
|
|
|
+ flexmock(module.os.path).should_receive('expanduser').and_raise(TypeError)
|
|
|
+ flexmock(module).should_receive('expand_home_directories').and_return(())
|
|
|
+ flexmock(module).should_receive('write_pattern_file').and_return(None)
|
|
|
+ flexmock(module.feature).should_receive('available').and_return(True)
|
|
|
+ flexmock(module).should_receive('ensure_files_readable')
|
|
|
+ flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
+ flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ environment = {'BORG_THINGY': 'YUP'}
|
|
|
+ flexmock(module.environment).should_receive('make_environment').and_return(environment)
|
|
|
+ flexmock(module).should_receive('execute_command').with_args(
|
|
|
+ ('borg', 'create') + ARCHIVE_WITH_PATHS,
|
|
|
+ output_log_level=logging.INFO,
|
|
|
+ output_file=None,
|
|
|
+ borg_local_path='borg',
|
|
|
+ working_directory=None,
|
|
|
+ extra_environment=environment,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -328,12 +366,14 @@ def test_create_archive_with_patterns_calls_borg_with_patterns():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(pattern_flags)
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create') + pattern_flags + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -364,12 +404,14 @@ def test_create_archive_with_exclude_patterns_calls_borg_with_excludes():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(exclude_flags)
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create') + exclude_flags + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -397,12 +439,14 @@ def test_create_archive_with_log_info_calls_borg_with_info_parameter():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--info') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
insert_logging_mock(logging.INFO)
|
|
|
|
|
@@ -431,12 +475,14 @@ def test_create_archive_with_log_info_and_json_suppresses_most_borg_output():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--json') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=None,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
insert_logging_mock(logging.INFO)
|
|
|
|
|
@@ -466,12 +512,14 @@ def test_create_archive_with_log_debug_calls_borg_with_debug_parameter():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--debug', '--show-rc') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
insert_logging_mock(logging.DEBUG)
|
|
|
|
|
@@ -500,12 +548,14 @@ def test_create_archive_with_log_debug_and_json_suppresses_most_borg_output():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--json') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=None,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
insert_logging_mock(logging.DEBUG)
|
|
|
|
|
@@ -535,12 +585,14 @@ def test_create_archive_with_dry_run_calls_borg_with_dry_run_parameter():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--dry-run') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -570,12 +622,14 @@ def test_create_archive_with_stats_and_dry_run_calls_borg_without_stats_paramete
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--info', '--dry-run') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
insert_logging_mock(logging.INFO)
|
|
|
|
|
@@ -605,12 +659,14 @@ def test_create_archive_with_checkpoint_interval_calls_borg_with_checkpoint_inte
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--checkpoint-interval', '600') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -638,12 +694,14 @@ def test_create_archive_with_chunker_params_calls_borg_with_chunker_params_param
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--chunker-params', '1,2,3,4') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -671,12 +729,14 @@ def test_create_archive_with_compression_calls_borg_with_compression_parameters(
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--compression', 'rle') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -709,12 +769,14 @@ def test_create_archive_with_remote_rate_limit_calls_borg_with_upload_ratelimit_
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', option_flag, '100') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -744,12 +806,14 @@ def test_create_archive_with_working_directory_calls_borg_with_working_directory
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory='/working/dir',
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -778,12 +842,14 @@ def test_create_archive_with_one_file_system_calls_borg_with_one_file_system_par
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--one-file-system') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -817,12 +883,14 @@ def test_create_archive_with_numeric_owner_calls_borg_with_numeric_ids_parameter
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', option_flag) + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -851,12 +919,14 @@ def test_create_archive_with_read_special_calls_borg_with_read_special_parameter
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--read-special') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -892,12 +962,14 @@ def test_create_archive_with_basic_option_calls_borg_with_corresponding_paramete
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create') + ((option_flag,) if option_flag else ()) + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -937,12 +1009,14 @@ def test_create_archive_with_atime_option_calls_borg_with_corresponding_paramete
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create') + ((option_flag,) if option_flag else ()) + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -982,12 +1056,14 @@ def test_create_archive_with_bsd_flags_option_calls_borg_with_corresponding_para
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create') + ((option_flag,) if option_flag else ()) + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1016,12 +1092,14 @@ def test_create_archive_with_files_cache_calls_borg_with_files_cache_parameters(
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--files-cache', 'ctime,size') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1050,12 +1128,14 @@ def test_create_archive_with_local_path_calls_borg_via_local_path():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg1', 'create') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg1',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1084,12 +1164,14 @@ def test_create_archive_with_remote_path_calls_borg_with_remote_path_parameters(
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--remote-path', 'borg1') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1118,12 +1200,14 @@ def test_create_archive_with_umask_calls_borg_with_umask_parameters():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--umask', '740') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1151,12 +1235,14 @@ def test_create_archive_with_lock_wait_calls_borg_with_lock_wait_parameters():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--lock-wait', '5') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1184,12 +1270,14 @@ def test_create_archive_with_stats_calls_borg_with_stats_parameter_and_warning_o
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--stats') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.WARNING,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1218,12 +1306,14 @@ def test_create_archive_with_stats_and_log_info_calls_borg_with_stats_parameter_
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--info', '--stats') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
insert_logging_mock(logging.INFO)
|
|
|
|
|
@@ -1253,12 +1343,14 @@ def test_create_archive_with_files_calls_borg_with_list_parameter_and_warning_ou
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--list', '--filter', 'AME-') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.WARNING,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1287,12 +1379,14 @@ def test_create_archive_with_files_and_log_info_calls_borg_with_list_parameter_a
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--list', '--filter', 'AME-', '--info') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
insert_logging_mock(logging.INFO)
|
|
|
|
|
@@ -1322,12 +1416,14 @@ def test_create_archive_with_progress_and_log_info_calls_borg_with_progress_para
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--info', '--progress') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=module.DO_NOT_CAPTURE,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
insert_logging_mock(logging.INFO)
|
|
|
|
|
@@ -1357,12 +1453,14 @@ def test_create_archive_with_progress_calls_borg_with_progress_parameter():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--progress') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=module.DO_NOT_CAPTURE,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1392,6 +1490,7 @@ def test_create_archive_with_progress_and_stream_processes_calls_borg_with_progr
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command_with_processes').with_args(
|
|
|
('borg', 'create', '--one-file-system', '--read-special', '--progress')
|
|
|
+ ARCHIVE_WITH_PATHS,
|
|
@@ -1400,6 +1499,7 @@ def test_create_archive_with_progress_and_stream_processes_calls_borg_with_progr
|
|
|
output_file=module.DO_NOT_CAPTURE,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1429,12 +1529,14 @@ def test_create_archive_with_json_calls_borg_with_json_parameter():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--json') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=None,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
).and_return('[]')
|
|
|
|
|
|
json_output = module.create_archive(
|
|
@@ -1465,12 +1567,14 @@ def test_create_archive_with_stats_and_json_calls_borg_without_stats_parameter()
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--json') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=None,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
).and_return('[]')
|
|
|
|
|
|
json_output = module.create_archive(
|
|
@@ -1502,12 +1606,14 @@ def test_create_archive_with_source_directories_glob_expands():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', 'repo::{}'.format(DEFAULT_ARCHIVE_NAME), 'foo', 'food'),
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
flexmock(module.glob).should_receive('glob').with_args('foo*').and_return(['foo', 'food'])
|
|
|
|
|
@@ -1536,12 +1642,14 @@ def test_create_archive_with_non_matching_source_directories_glob_passes_through
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', 'repo::{}'.format(DEFAULT_ARCHIVE_NAME), 'foo*'),
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
flexmock(module.glob).should_receive('glob').with_args('foo*').and_return([])
|
|
|
|
|
@@ -1570,12 +1678,14 @@ def test_create_archive_with_glob_calls_borg_with_expanded_directories():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', 'repo::{}'.format(DEFAULT_ARCHIVE_NAME), 'foo', 'food'),
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1603,12 +1713,14 @@ def test_create_archive_with_archive_name_format_calls_borg_with_archive_name():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', 'repo::ARCHIVE_NAME', 'foo', 'bar'),
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1636,12 +1748,14 @@ def test_create_archive_with_archive_name_format_accepts_borg_placeholders():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', 'repo::Documents_{hostname}-{now}', 'foo', 'bar'),
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1669,12 +1783,14 @@ def test_create_archive_with_repository_accepts_borg_placeholders():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '{fqdn}::Documents_{hostname}-{now}', 'foo', 'bar'),
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1702,12 +1818,14 @@ def test_create_archive_with_extra_borg_options_calls_borg_with_extra_options():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'create', '--extra', '--options') + ARCHIVE_WITH_PATHS,
|
|
|
output_log_level=logging.INFO,
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|
|
@@ -1736,6 +1854,7 @@ def test_create_archive_with_stream_processes_calls_borg_with_processes():
|
|
|
flexmock(module).should_receive('ensure_files_readable')
|
|
|
flexmock(module).should_receive('make_pattern_flags').and_return(())
|
|
|
flexmock(module).should_receive('make_exclude_flags').and_return(())
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
flexmock(module).should_receive('execute_command_with_processes').with_args(
|
|
|
('borg', 'create', '--one-file-system', '--read-special') + ARCHIVE_WITH_PATHS,
|
|
|
processes=processes,
|
|
@@ -1743,6 +1862,7 @@ def test_create_archive_with_stream_processes_calls_borg_with_processes():
|
|
|
output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
working_directory=None,
|
|
|
+ extra_environment=None,
|
|
|
)
|
|
|
|
|
|
module.create_archive(
|