def test_verify_container_mountpoints_failure(config_files, monkeypatch):
with open(config_files, "r") as main_file:
def fake_lxc_exec_command(*popenargs, **kwargs):
if get_command(popenargs) == 'lxc' and get_sub_command(popenargs) == 'exec':
if get_command_parameter(popenargs, '--') == 'test':
return subprocess.CompletedProcess("failure", 1, 'failure')
else:
return subprocess.CompletedProcess("fakerun", 0, '')
else:
return subprocess.run(*popenargs, **kwargs)
monkeypatch.setattr(mockablerun, 'run_mockable', fake_lxc_exec_command)
parser = ConfigurationParser(main_file)
coordinator = SharedFolderCoordinator(parser)
with pytest.raises(FatalError) as error:
coordinator.verify_container_mountpoints('fake-container')
assert 'fake-container' in error.value.message
assert '/foo/bar/target_mountpoint' in error.value.message
评论列表
文章目录