def test_instance_systemctl(self, mock_systemctl): mock_systemctl.return_value = True self.mock_runner.run.return_value = ("", "", 0) lib.start_service(self.mock_runner, self.service, instance="test") self.mock_runner.run.assert_called_once_with([ _systemctl, "start", "{0}@{1}.service".format(self.service, "test") ])
def test_not_systemctl(self, mock_systemctl): mock_systemctl.return_value = False self.mock_runner.run.return_value = ("", 0) lib.start_service(self.mock_runner, self.service) self.mock_runner.run.assert_called_once_with( ["service", self.service, "start"] )
def test_instance_not_systemctl(self, mock_systemctl): mock_systemctl.return_value = False self.mock_runner.run.return_value = ("Starting...", "", 0) lib.start_service(self.mock_runner, self.service, instance="test") self.mock_runner.run.assert_called_once_with( [_service, self.service, "start"] )
def test_systemctl(self, mock_systemctl): mock_systemctl.return_value = True self.mock_runner.run.return_value = ("", "", 0) lib.start_service(self.mock_runner, self.service) self.mock_runner.run.assert_called_once_with( [_systemctl, "start", self.service + ".service"] )
def test_not_systemctl_failed(self, mock_systemctl): mock_systemctl.return_value = False self.mock_runner.run.return_value = ("", 1) self.assertRaises( lib.StartServiceError, lambda: lib.start_service(self.mock_runner, self.service) ) self.mock_runner.run.assert_called_once_with( ["service", self.service, "start"] )
def start_booth(env): """ Start specified instance of booth service. Currently it is supported only systemd systems. On non systems it can be run like this: BOOTH_CONF_FILE=<booth-file-path> /etc/initd/booth-arbitrator env -- LibraryEnvironment """ external.ensure_is_systemd() name = env.booth.name try: external.start_service(env.cmd_runner(), "booth", name) except external.StartServiceError as e: raise LibraryError(reports.service_start_error( "booth", e.message, instance=name )) env.report_processor.process(reports.service_start_success( "booth", instance=name ))
def qdevice_start(runner): """ start qdevice now on local host """ external.start_service(runner, __service_name)
def test_instance_not_systemctl(self, mock_systemctl): mock_systemctl.return_value = False self.mock_runner.run.return_value = ("Starting...", "", 0) lib.start_service(self.mock_runner, self.service, instance="test") self.mock_runner.run.assert_called_once_with( [_service, self.service, "start"])
def test_systemctl(self, mock_systemctl): mock_systemctl.return_value = True self.mock_runner.run.return_value = ("", "", 0) lib.start_service(self.mock_runner, self.service) self.mock_runner.run.assert_called_once_with( [_systemctl, "start", self.service + ".service"])