|
@@ -236,9 +236,6 @@ def test_use_streaming_false_for_no_databases():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_runs_pg_dump_for_each_database():
|
|
def test_dump_data_sources_runs_pg_dump_for_each_database():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
processes = [flexmock(), flexmock()]
|
|
processes = [flexmock(), flexmock()]
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
@@ -287,9 +284,6 @@ def test_dump_data_sources_runs_pg_dump_for_each_database():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_raises_when_no_database_names_to_dump():
|
|
def test_dump_data_sources_raises_when_no_database_names_to_dump():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
@@ -307,9 +301,6 @@ def test_dump_data_sources_raises_when_no_database_names_to_dump():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_does_not_raise_when_no_database_names_to_dump():
|
|
def test_dump_data_sources_does_not_raise_when_no_database_names_to_dump():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
@@ -326,9 +317,6 @@ def test_dump_data_sources_does_not_raise_when_no_database_names_to_dump():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_with_duplicate_dump_skips_pg_dump():
|
|
def test_dump_data_sources_with_duplicate_dump_skips_pg_dump():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
@@ -356,9 +344,6 @@ def test_dump_data_sources_with_duplicate_dump_skips_pg_dump():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_with_dry_run_skips_pg_dump():
|
|
def test_dump_data_sources_with_dry_run_skips_pg_dump():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
@@ -389,9 +374,6 @@ def test_dump_data_sources_with_dry_run_skips_pg_dump():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_runs_pg_dump_with_hostname_and_port():
|
|
def test_dump_data_sources_runs_pg_dump_with_hostname_and_port():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo', 'hostname': 'database.example.org', 'port': 5433}]
|
|
databases = [{'name': 'foo', 'hostname': 'database.example.org', 'port': 5433}]
|
|
process = flexmock()
|
|
process = flexmock()
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
@@ -438,9 +420,6 @@ def test_dump_data_sources_runs_pg_dump_with_hostname_and_port():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_runs_pg_dump_with_username_and_password():
|
|
def test_dump_data_sources_runs_pg_dump_with_username_and_password():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo', 'username': 'postgres', 'password': 'trustsome1'}]
|
|
databases = [{'name': 'foo', 'username': 'postgres', 'password': 'trustsome1'}]
|
|
process = flexmock()
|
|
process = flexmock()
|
|
flexmock(module).should_receive('make_environment').and_return(
|
|
flexmock(module).should_receive('make_environment').and_return(
|
|
@@ -487,9 +466,6 @@ def test_dump_data_sources_runs_pg_dump_with_username_and_password():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_with_username_injection_attack_gets_escaped():
|
|
def test_dump_data_sources_with_username_injection_attack_gets_escaped():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo', 'username': 'postgres; naughty-command', 'password': 'trustsome1'}]
|
|
databases = [{'name': 'foo', 'username': 'postgres; naughty-command', 'password': 'trustsome1'}]
|
|
process = flexmock()
|
|
process = flexmock()
|
|
flexmock(module).should_receive('make_environment').and_return(
|
|
flexmock(module).should_receive('make_environment').and_return(
|
|
@@ -536,9 +512,6 @@ def test_dump_data_sources_with_username_injection_attack_gets_escaped():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_runs_pg_dump_with_directory_format():
|
|
def test_dump_data_sources_runs_pg_dump_with_directory_format():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo', 'format': 'directory'}]
|
|
databases = [{'name': 'foo', 'format': 'directory'}]
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
@@ -583,9 +556,6 @@ def test_dump_data_sources_runs_pg_dump_with_directory_format():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_runs_pg_dump_with_string_compression():
|
|
def test_dump_data_sources_runs_pg_dump_with_string_compression():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo', 'compression': 'winrar'}]
|
|
databases = [{'name': 'foo', 'compression': 'winrar'}]
|
|
processes = [flexmock()]
|
|
processes = [flexmock()]
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
@@ -633,9 +603,6 @@ def test_dump_data_sources_runs_pg_dump_with_string_compression():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_runs_pg_dump_with_integer_compression():
|
|
def test_dump_data_sources_runs_pg_dump_with_integer_compression():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo', 'compression': 0}]
|
|
databases = [{'name': 'foo', 'compression': 0}]
|
|
processes = [flexmock()]
|
|
processes = [flexmock()]
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
@@ -683,9 +650,6 @@ def test_dump_data_sources_runs_pg_dump_with_integer_compression():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_runs_pg_dump_with_options():
|
|
def test_dump_data_sources_runs_pg_dump_with_options():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo', 'options': '--stuff=such'}]
|
|
databases = [{'name': 'foo', 'options': '--stuff=such'}]
|
|
process = flexmock()
|
|
process = flexmock()
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
@@ -729,9 +693,6 @@ def test_dump_data_sources_runs_pg_dump_with_options():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_runs_pg_dumpall_for_all_databases():
|
|
def test_dump_data_sources_runs_pg_dumpall_for_all_databases():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'all'}]
|
|
databases = [{'name': 'all'}]
|
|
process = flexmock()
|
|
process = flexmock()
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
@@ -764,9 +725,6 @@ def test_dump_data_sources_runs_pg_dumpall_for_all_databases():
|
|
|
|
|
|
|
|
|
|
def test_dump_data_sources_runs_non_default_pg_dump():
|
|
def test_dump_data_sources_runs_non_default_pg_dump():
|
|
- flexmock(module.borgmatic.hooks.command).should_receive('Before_after_hooks').and_return(
|
|
|
|
- flexmock()
|
|
|
|
- )
|
|
|
|
databases = [{'name': 'foo', 'pg_dump_command': 'special_pg_dump --compress *'}]
|
|
databases = [{'name': 'foo', 'pg_dump_command': 'special_pg_dump --compress *'}]
|
|
process = flexmock()
|
|
process = flexmock()
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|
|
flexmock(module).should_receive('make_environment').and_return({'PGSSLMODE': 'disable'})
|