File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -2975,6 +2975,24 @@ def test_700_run_service(self, mock_subprocess):
29752975 )
29762976 self .assertFalse (start_mock .called )
29772977
2978+ mock_subprocess .reset_mock ()
2979+ start_mock .reset_mock ()
2980+ with self .subTest ("connection_timeout" ):
2981+ vm .is_running = lambda : True
2982+ vm .is_qrexec_running = lambda stubdom = False : True
2983+ self .loop .run_until_complete (
2984+ vm .run_service ("test.service" , connection_timeout = 10 )
2985+ )
2986+ mock_subprocess .assert_called_once_with (
2987+ "/usr/bin/qrexec-client" ,
2988+ "-d" ,
2989+ "test-inst-vm" ,
2990+ "-w" ,
2991+ "10" ,
2992+ "user:QUBESRPC test.service dom0" ,
2993+ )
2994+ self .assertFalse (start_mock .called )
2995+
29782996 @unittest .mock .patch ("qubes.vm.qubesvm.QubesVM.run" )
29792997 def test_710_run_for_stdio (self , mock_run ):
29802998 vm = self .get_vm (cls = qubes .vm .standalonevm .StandaloneVM , name = "vm" )
Original file line number Diff line number Diff line change @@ -1769,6 +1769,7 @@ async def run_service(
17691769 filter_esc = False ,
17701770 autostart = False ,
17711771 gui = False ,
1772+ connection_timeout = None ,
17721773 ** kwargs ,
17731774 ):
17741775 """Run service on this VM
@@ -1782,6 +1783,8 @@ async def run_service(
17821783 :param bool autostart: if :py:obj:`True`, machine will be started if \
17831784 it is not running
17841785 :param bool gui: when autostarting, also start gui daemon
1786+ :param int connection_timeout: override default qrexec connection
1787+ timeout (in seconds)
17851788 :rtype: asyncio.subprocess.Process
17861789
17871790 .. note::
@@ -1827,6 +1830,7 @@ async def run_service(
18271830 qubes .config .system_path ["qrexec_client_path" ],
18281831 "-d" ,
18291832 str (name ),
1833+ * (("-w" , str (connection_timeout )) if connection_timeout else ()),
18301834 * (("-t" , "-T" ) if filter_esc else ()),
18311835 "{}:QUBESRPC {} {}" .format (user , service , source ),
18321836 ** kwargs ,
You can’t perform that action at this time.
0 commit comments