|
@@ -9,7 +9,9 @@ from borgmatic.hooks.data_source import mysql as module
|
|
|
def test_database_names_to_dump_passes_through_name():
|
|
|
environment = flexmock()
|
|
|
|
|
|
- names = module.database_names_to_dump({'name': 'foo'}, {}, environment, dry_run=False)
|
|
|
+ names = module.database_names_to_dump(
|
|
|
+ {'name': 'foo'}, {}, 'root', 'trustsome1', environment, dry_run=False
|
|
|
+ )
|
|
|
|
|
|
assert names == ('foo',)
|
|
|
|
|
@@ -21,7 +23,9 @@ def test_database_names_to_dump_bails_for_dry_run():
|
|
|
).replace_with(lambda value, config: value)
|
|
|
flexmock(module).should_receive('execute_command_and_capture_output').never()
|
|
|
|
|
|
- names = module.database_names_to_dump({'name': 'all'}, {}, environment, dry_run=True)
|
|
|
+ names = module.database_names_to_dump(
|
|
|
+ {'name': 'all'}, {}, 'root', 'trustsome1', environment, dry_run=True
|
|
|
+ )
|
|
|
|
|
|
assert names == ()
|
|
|
|
|
@@ -31,12 +35,24 @@ def test_database_names_to_dump_queries_mysql_for_database_names():
|
|
|
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
'resolve_credential'
|
|
|
).replace_with(lambda value, config: value)
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('root', 'trustsome1').and_return(99)
|
|
|
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
|
|
|
- ('mysql', '--skip-column-names', '--batch', '--execute', 'show schemas'),
|
|
|
+ (
|
|
|
+ 'mysql',
|
|
|
+ '--defaults-extra-file=/dev/fd/99',
|
|
|
+ '--skip-column-names',
|
|
|
+ '--batch',
|
|
|
+ '--execute',
|
|
|
+ 'show schemas',
|
|
|
+ ),
|
|
|
environment=environment,
|
|
|
).and_return('foo\nbar\nmysql\n').once()
|
|
|
|
|
|
- names = module.database_names_to_dump({'name': 'all'}, {}, environment, dry_run=False)
|
|
|
+ names = module.database_names_to_dump(
|
|
|
+ {'name': 'all'}, {}, 'root', 'trustsome1', environment, dry_run=False
|
|
|
+ )
|
|
|
|
|
|
assert names == ('foo', 'bar')
|
|
|
|
|
@@ -56,6 +72,9 @@ def test_dump_data_sources_dumps_each_database():
|
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
|
processes = [flexmock(), flexmock()]
|
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
|
+ flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
+ 'resolve_credential'
|
|
|
+ ).and_return(None)
|
|
|
flexmock(module.os).should_receive('environ').and_return({'USER': 'root'})
|
|
|
flexmock(module).should_receive('database_names_to_dump').and_return(('foo',)).and_return(
|
|
|
('bar',)
|
|
@@ -65,6 +84,8 @@ def test_dump_data_sources_dumps_each_database():
|
|
|
flexmock(module).should_receive('execute_dump_command').with_args(
|
|
|
database={'name': name},
|
|
|
config={},
|
|
|
+ username=None,
|
|
|
+ password=None,
|
|
|
dump_path=object,
|
|
|
database_names=(name,),
|
|
|
environment={'USER': 'root'},
|
|
@@ -89,10 +110,10 @@ def test_dump_data_sources_dumps_with_password():
|
|
|
database = {'name': 'foo', 'username': 'root', 'password': 'trustsome1'}
|
|
|
process = flexmock()
|
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
|
- flexmock(module.os).should_receive('environ').and_return({'USER': 'root'})
|
|
|
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
'resolve_credential'
|
|
|
).replace_with(lambda value, config: value)
|
|
|
+ flexmock(module.os).should_receive('environ').and_return({'USER': 'root'})
|
|
|
flexmock(module).should_receive('database_names_to_dump').and_return(('foo',)).and_return(
|
|
|
('bar',)
|
|
|
)
|
|
@@ -100,9 +121,11 @@ def test_dump_data_sources_dumps_with_password():
|
|
|
flexmock(module).should_receive('execute_dump_command').with_args(
|
|
|
database=database,
|
|
|
config={},
|
|
|
+ username='root',
|
|
|
+ password='trustsome1',
|
|
|
dump_path=object,
|
|
|
database_names=('foo',),
|
|
|
- environment={'USER': 'root', 'MYSQL_PWD': 'trustsome1'},
|
|
|
+ environment={'USER': 'root'},
|
|
|
dry_run=object,
|
|
|
dry_run_label=object,
|
|
|
).and_return(process).once()
|
|
@@ -121,11 +144,16 @@ def test_dump_data_sources_dumps_all_databases_at_once():
|
|
|
databases = [{'name': 'all'}]
|
|
|
process = flexmock()
|
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
|
+ flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
+ 'resolve_credential'
|
|
|
+ ).and_return(None)
|
|
|
flexmock(module.os).should_receive('environ').and_return({'USER': 'root'})
|
|
|
flexmock(module).should_receive('database_names_to_dump').and_return(('foo', 'bar'))
|
|
|
flexmock(module).should_receive('execute_dump_command').with_args(
|
|
|
database={'name': 'all'},
|
|
|
config={},
|
|
|
+ username=None,
|
|
|
+ password=None,
|
|
|
dump_path=object,
|
|
|
database_names=('foo', 'bar'),
|
|
|
environment={'USER': 'root'},
|
|
@@ -147,6 +175,9 @@ def test_dump_data_sources_dumps_all_databases_separately_when_format_configured
|
|
|
databases = [{'name': 'all', 'format': 'sql'}]
|
|
|
processes = [flexmock(), flexmock()]
|
|
|
flexmock(module).should_receive('make_dump_path').and_return('')
|
|
|
+ flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
+ 'resolve_credential'
|
|
|
+ ).and_return(None)
|
|
|
flexmock(module.os).should_receive('environ').and_return({'USER': 'root'})
|
|
|
flexmock(module).should_receive('database_names_to_dump').and_return(('foo', 'bar'))
|
|
|
|
|
@@ -154,6 +185,8 @@ def test_dump_data_sources_dumps_all_databases_separately_when_format_configured
|
|
|
flexmock(module).should_receive('execute_dump_command').with_args(
|
|
|
database={'name': name, 'format': 'sql'},
|
|
|
config={},
|
|
|
+ username=None,
|
|
|
+ password=None,
|
|
|
dump_path=object,
|
|
|
database_names=(name,),
|
|
|
environment={'USER': 'root'},
|
|
@@ -175,11 +208,15 @@ def test_dump_data_sources_dumps_all_databases_separately_when_format_configured
|
|
|
|
|
|
|
|
|
def test_database_names_to_dump_runs_mysql_with_list_options():
|
|
|
- database = {'name': 'all', 'list_options': '--defaults-extra-file=my.cnf'}
|
|
|
+ database = {'name': 'all', 'list_options': '--defaults-file=my.cnf'}
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('root', 'trustsome1').and_return(99)
|
|
|
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
|
|
|
(
|
|
|
'mysql',
|
|
|
- '--defaults-extra-file=my.cnf',
|
|
|
+ '--defaults-extra-file=/dev/fd/99',
|
|
|
+ '--defaults-file=my.cnf',
|
|
|
'--skip-column-names',
|
|
|
'--batch',
|
|
|
'--execute',
|
|
@@ -188,20 +225,27 @@ def test_database_names_to_dump_runs_mysql_with_list_options():
|
|
|
environment=None,
|
|
|
).and_return(('foo\nbar')).once()
|
|
|
|
|
|
- assert module.database_names_to_dump(database, {}, None, '') == ('foo', 'bar')
|
|
|
+ assert module.database_names_to_dump(database, {}, 'root', 'trustsome1', None, '') == (
|
|
|
+ 'foo',
|
|
|
+ 'bar',
|
|
|
+ )
|
|
|
|
|
|
|
|
|
def test_database_names_to_dump_runs_non_default_mysql_with_list_options():
|
|
|
database = {
|
|
|
'name': 'all',
|
|
|
- 'list_options': '--defaults-extra-file=my.cnf',
|
|
|
+ 'list_options': '--defaults-file=my.cnf',
|
|
|
'mysql_command': 'custom_mysql',
|
|
|
}
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('root', 'trustsome1').and_return(99)
|
|
|
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
|
|
|
environment=None,
|
|
|
full_command=(
|
|
|
'custom_mysql', # Custom MySQL command
|
|
|
- '--defaults-extra-file=my.cnf',
|
|
|
+ '--defaults-extra-file=/dev/fd/99',
|
|
|
+ '--defaults-file=my.cnf',
|
|
|
'--skip-column-names',
|
|
|
'--batch',
|
|
|
'--execute',
|
|
@@ -209,7 +253,10 @@ def test_database_names_to_dump_runs_non_default_mysql_with_list_options():
|
|
|
),
|
|
|
).and_return(('foo\nbar')).once()
|
|
|
|
|
|
- assert module.database_names_to_dump(database, {}, None, '') == ('foo', 'bar')
|
|
|
+ assert module.database_names_to_dump(database, {}, 'root', 'trustsome1', None, '') == (
|
|
|
+ 'foo',
|
|
|
+ 'bar',
|
|
|
+ )
|
|
|
|
|
|
|
|
|
def test_execute_dump_command_runs_mysqldump():
|
|
@@ -219,11 +266,15 @@ def test_execute_dump_command_runs_mysqldump():
|
|
|
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
'resolve_credential'
|
|
|
).replace_with(lambda value, config: value)
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('root', 'trustsome1').and_return(99)
|
|
|
flexmock(module.dump).should_receive('create_named_pipe_for_dump')
|
|
|
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
(
|
|
|
'mysqldump',
|
|
|
+ '--defaults-extra-file=/dev/fd/99',
|
|
|
'--add-drop-database',
|
|
|
'--databases',
|
|
|
'foo',
|
|
@@ -238,6 +289,8 @@ def test_execute_dump_command_runs_mysqldump():
|
|
|
module.execute_dump_command(
|
|
|
database={'name': 'foo'},
|
|
|
config={},
|
|
|
+ username='root',
|
|
|
+ password='trustsome1',
|
|
|
dump_path=flexmock(),
|
|
|
database_names=('foo',),
|
|
|
environment=None,
|
|
@@ -255,11 +308,15 @@ def test_execute_dump_command_runs_mysqldump_without_add_drop_database():
|
|
|
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
'resolve_credential'
|
|
|
).replace_with(lambda value, config: value)
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('root', 'trustsome1').and_return(99)
|
|
|
flexmock(module.dump).should_receive('create_named_pipe_for_dump')
|
|
|
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
(
|
|
|
'mysqldump',
|
|
|
+ '--defaults-extra-file=/dev/fd/99',
|
|
|
'--databases',
|
|
|
'foo',
|
|
|
'--result-file',
|
|
@@ -273,6 +330,8 @@ def test_execute_dump_command_runs_mysqldump_without_add_drop_database():
|
|
|
module.execute_dump_command(
|
|
|
database={'name': 'foo', 'add_drop_database': False},
|
|
|
config={},
|
|
|
+ username='root',
|
|
|
+ password='trustsome1',
|
|
|
dump_path=flexmock(),
|
|
|
database_names=('foo',),
|
|
|
environment=None,
|
|
@@ -290,11 +349,15 @@ def test_execute_dump_command_runs_mysqldump_with_hostname_and_port():
|
|
|
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
'resolve_credential'
|
|
|
).replace_with(lambda value, config: value)
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('root', 'trustsome1').and_return(99)
|
|
|
flexmock(module.dump).should_receive('create_named_pipe_for_dump')
|
|
|
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
(
|
|
|
'mysqldump',
|
|
|
+ '--defaults-extra-file=/dev/fd/99',
|
|
|
'--add-drop-database',
|
|
|
'--host',
|
|
|
'database.example.org',
|
|
@@ -315,6 +378,8 @@ def test_execute_dump_command_runs_mysqldump_with_hostname_and_port():
|
|
|
module.execute_dump_command(
|
|
|
database={'name': 'foo', 'hostname': 'database.example.org', 'port': 5433},
|
|
|
config={},
|
|
|
+ username='root',
|
|
|
+ password='trustsome1',
|
|
|
dump_path=flexmock(),
|
|
|
database_names=('foo',),
|
|
|
environment=None,
|
|
@@ -332,20 +397,22 @@ def test_execute_dump_command_runs_mysqldump_with_username_and_password():
|
|
|
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
'resolve_credential'
|
|
|
).replace_with(lambda value, config: value)
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('root', 'trustsome1').and_return(99)
|
|
|
flexmock(module.dump).should_receive('create_named_pipe_for_dump')
|
|
|
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
(
|
|
|
'mysqldump',
|
|
|
+ '--defaults-extra-file=/dev/fd/99',
|
|
|
'--add-drop-database',
|
|
|
- '--user',
|
|
|
- 'root',
|
|
|
'--databases',
|
|
|
'foo',
|
|
|
'--result-file',
|
|
|
'dump',
|
|
|
),
|
|
|
- environment={'MYSQL_PWD': 'trustsome1'},
|
|
|
+ environment={},
|
|
|
run_to_completion=False,
|
|
|
).and_return(process).once()
|
|
|
|
|
@@ -353,9 +420,11 @@ def test_execute_dump_command_runs_mysqldump_with_username_and_password():
|
|
|
module.execute_dump_command(
|
|
|
database={'name': 'foo', 'username': 'root', 'password': 'trustsome1'},
|
|
|
config={},
|
|
|
+ username='root',
|
|
|
+ password='trustsome1',
|
|
|
dump_path=flexmock(),
|
|
|
database_names=('foo',),
|
|
|
- environment={'MYSQL_PWD': 'trustsome1'},
|
|
|
+ environment={},
|
|
|
dry_run=False,
|
|
|
dry_run_label='',
|
|
|
)
|
|
@@ -370,11 +439,15 @@ def test_execute_dump_command_runs_mysqldump_with_options():
|
|
|
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
'resolve_credential'
|
|
|
).replace_with(lambda value, config: value)
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('root', 'trustsome1').and_return(99)
|
|
|
flexmock(module.dump).should_receive('create_named_pipe_for_dump')
|
|
|
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
(
|
|
|
'mysqldump',
|
|
|
+ '--defaults-extra-file=/dev/fd/99',
|
|
|
'--stuff=such',
|
|
|
'--add-drop-database',
|
|
|
'--databases',
|
|
@@ -390,6 +463,8 @@ def test_execute_dump_command_runs_mysqldump_with_options():
|
|
|
module.execute_dump_command(
|
|
|
database={'name': 'foo', 'options': '--stuff=such'},
|
|
|
config={},
|
|
|
+ username='root',
|
|
|
+ password='trustsome1',
|
|
|
dump_path=flexmock(),
|
|
|
database_names=('foo',),
|
|
|
environment=None,
|
|
@@ -407,11 +482,15 @@ def test_execute_dump_command_runs_non_default_mysqldump():
|
|
|
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
'resolve_credential'
|
|
|
).replace_with(lambda value, config: value)
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('root', 'trustsome1').and_return(99)
|
|
|
flexmock(module.dump).should_receive('create_named_pipe_for_dump')
|
|
|
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
(
|
|
|
'custom_mysqldump', # Custom MySQL dump command
|
|
|
+ '--defaults-extra-file=/dev/fd/99',
|
|
|
'--add-drop-database',
|
|
|
'--databases',
|
|
|
'foo',
|
|
@@ -429,6 +508,8 @@ def test_execute_dump_command_runs_non_default_mysqldump():
|
|
|
'mysql_dump_command': 'custom_mysqldump',
|
|
|
}, # Custom MySQL dump command specified
|
|
|
config={},
|
|
|
+ username='root',
|
|
|
+ password='trustsome1',
|
|
|
dump_path=flexmock(),
|
|
|
database_names=('foo',),
|
|
|
environment=None,
|
|
@@ -442,6 +523,9 @@ def test_execute_dump_command_runs_non_default_mysqldump():
|
|
|
def test_execute_dump_command_with_duplicate_dump_skips_mysqldump():
|
|
|
flexmock(module.dump).should_receive('make_data_source_dump_filename').and_return('dump')
|
|
|
flexmock(module.os.path).should_receive('exists').and_return(True)
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('root', 'trustsome1').and_return(99)
|
|
|
flexmock(module.dump).should_receive('create_named_pipe_for_dump').never()
|
|
|
flexmock(module).should_receive('execute_command').never()
|
|
|
|
|
@@ -449,6 +533,8 @@ def test_execute_dump_command_with_duplicate_dump_skips_mysqldump():
|
|
|
module.execute_dump_command(
|
|
|
database={'name': 'foo'},
|
|
|
config={},
|
|
|
+ username='root',
|
|
|
+ password='trustsome1',
|
|
|
dump_path=flexmock(),
|
|
|
database_names=('foo',),
|
|
|
environment=None,
|
|
@@ -465,6 +551,9 @@ def test_execute_dump_command_with_dry_run_skips_mysqldump():
|
|
|
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
'resolve_credential'
|
|
|
).replace_with(lambda value, config: value)
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('root', 'trustsome1').and_return(99)
|
|
|
flexmock(module.dump).should_receive('create_named_pipe_for_dump')
|
|
|
|
|
|
flexmock(module).should_receive('execute_command').never()
|
|
@@ -473,6 +562,8 @@ def test_execute_dump_command_with_dry_run_skips_mysqldump():
|
|
|
module.execute_dump_command(
|
|
|
database={'name': 'foo'},
|
|
|
config={},
|
|
|
+ username='root',
|
|
|
+ password='trustsome1',
|
|
|
dump_path=flexmock(),
|
|
|
database_names=('foo',),
|
|
|
environment=None,
|
|
@@ -675,13 +766,16 @@ def test_restore_data_source_dump_runs_mysql_with_username_and_password():
|
|
|
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
'resolve_credential'
|
|
|
).replace_with(lambda value, config: value)
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('root', 'trustsome1').and_return(99)
|
|
|
flexmock(module.os).should_receive('environ').and_return({'USER': 'root'})
|
|
|
flexmock(module).should_receive('execute_command_with_processes').with_args(
|
|
|
- ('mysql', '--batch', '--user', 'root'),
|
|
|
+ ('mysql', '--defaults-extra-file=/dev/fd/99', '--batch'),
|
|
|
processes=[extract_process],
|
|
|
output_log_level=logging.DEBUG,
|
|
|
input_file=extract_process.stdout,
|
|
|
- environment={'USER': 'root', 'MYSQL_PWD': 'trustsome1'},
|
|
|
+ environment={'USER': 'root'},
|
|
|
).once()
|
|
|
|
|
|
module.restore_data_source_dump(
|
|
@@ -717,10 +811,14 @@ def test_restore_data_source_dump_with_connection_params_uses_connection_params_
|
|
|
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
'resolve_credential'
|
|
|
).replace_with(lambda value, config: value)
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('cliusername', 'clipassword').and_return(99)
|
|
|
flexmock(module.os).should_receive('environ').and_return({'USER': 'root'})
|
|
|
flexmock(module).should_receive('execute_command_with_processes').with_args(
|
|
|
(
|
|
|
'mysql',
|
|
|
+ '--defaults-extra-file=/dev/fd/99',
|
|
|
'--batch',
|
|
|
'--host',
|
|
|
'clihost',
|
|
@@ -728,13 +826,11 @@ def test_restore_data_source_dump_with_connection_params_uses_connection_params_
|
|
|
'cliport',
|
|
|
'--protocol',
|
|
|
'tcp',
|
|
|
- '--user',
|
|
|
- 'cliusername',
|
|
|
),
|
|
|
processes=[extract_process],
|
|
|
output_log_level=logging.DEBUG,
|
|
|
input_file=extract_process.stdout,
|
|
|
- environment={'USER': 'root', 'MYSQL_PWD': 'clipassword'},
|
|
|
+ environment={'USER': 'root'},
|
|
|
).once()
|
|
|
|
|
|
module.restore_data_source_dump(
|
|
@@ -772,10 +868,14 @@ def test_restore_data_source_dump_without_connection_params_uses_restore_params_
|
|
|
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
|
|
|
'resolve_credential'
|
|
|
).replace_with(lambda value, config: value)
|
|
|
+ flexmock(module.borgmatic.hooks.data_source.mariadb).should_receive(
|
|
|
+ 'make_defaults_file_pipe'
|
|
|
+ ).with_args('restoreuser', 'restorepass').and_return(99)
|
|
|
flexmock(module.os).should_receive('environ').and_return({'USER': 'root'})
|
|
|
flexmock(module).should_receive('execute_command_with_processes').with_args(
|
|
|
(
|
|
|
'mysql',
|
|
|
+ '--defaults-extra-file=/dev/fd/99',
|
|
|
'--batch',
|
|
|
'--host',
|
|
|
'restorehost',
|
|
@@ -783,13 +883,11 @@ def test_restore_data_source_dump_without_connection_params_uses_restore_params_
|
|
|
'restoreport',
|
|
|
'--protocol',
|
|
|
'tcp',
|
|
|
- '--user',
|
|
|
- 'restoreuser',
|
|
|
),
|
|
|
processes=[extract_process],
|
|
|
output_log_level=logging.DEBUG,
|
|
|
input_file=extract_process.stdout,
|
|
|
- environment={'USER': 'root', 'MYSQL_PWD': 'restorepass'},
|
|
|
+ environment={'USER': 'root'},
|
|
|
).once()
|
|
|
|
|
|
module.restore_data_source_dump(
|