def test_disable_failed(self, mock_net_destroy, mock_net_disable, mock_net_stop, mock_status): mock_status.return_value = "" mock_net_disable.side_effect = DisableServiceError( "test service", "test error") assert_raise_library_error( lambda: lib.qdevice_destroy(self.lib_env, "net"), (severity.ERROR, report_codes.SERVICE_DISABLE_ERROR, { "service": "test service", "reason": "test error", })) mock_net_stop.assert_called_once_with("mock_runner", "corosync-qnetd") mock_net_disable.assert_called_once_with("mock_runner", "corosync-qnetd") mock_net_destroy.assert_not_called() assert_report_item_list_equal( self.mock_reporter.report_item_list, [(severity.INFO, report_codes.SERVICE_STOP_STARTED, { "service": "quorum device", }), (severity.INFO, report_codes.SERVICE_STOP_SUCCESS, { "service": "quorum device", })])
def test_failed(self, mock_net_disable): mock_net_disable.side_effect = DisableServiceError( "test service", "test error") assert_raise_library_error( lambda: lib.qdevice_disable(self.lib_env, "net"), (severity.ERROR, report_codes.SERVICE_DISABLE_ERROR, { "service": "test service", "reason": "test error", })) mock_net_disable.assert_called_once_with("mock_runner", "corosync-qnetd")
def test_failed(self, mock_disable, mock_is_systemctl): mock_disable.side_effect = DisableServiceError("booth", "msg", "name") assert_raise_library_error( lambda: commands.disable_booth(self.mock_env, "name"), (Severities.ERROR, report_codes.SERVICE_DISABLE_ERROR, { "service": "booth", "reason": "msg", "node": None, "instance": "name", })) mock_disable.assert_called_once_with(self.mock_run, "booth", "name") mock_is_systemctl.assert_called_once_with()
def test_failed(self, mock_net_disable): mock_net_disable.side_effect = DisableServiceError( "test service", "test error") assert_raise_library_error( lambda: lib.qdevice_disable(self.lib_env, "net"), ( severity.ERROR, reports.codes.SERVICE_ACTION_FAILED, { "action": reports.const.SERVICE_ACTION_DISABLE, "service": "test service", "reason": "test error", "node": "", "instance": "", }, ), ) mock_net_disable.assert_called_once_with("mock_runner", "corosync-qnetd")