Fixing run action when error occurs
Closes-Bug: #1498803 Change-Id: I2e47ce5ce80c0d8918f4dc0d060935f321ccd9b9
This commit is contained in:
parent
ba5b18c5f5
commit
117dc15cf5
@ -44,13 +44,15 @@ class DefaultExecutor(base.Executor, coordination.Service):
|
||||
"""
|
||||
|
||||
def send_error_back(error_msg):
|
||||
error_result = wf_utils.Result(error=error_msg)
|
||||
|
||||
if action_ex_id:
|
||||
self._engine_client.on_action_complete(
|
||||
action_ex_id,
|
||||
wf_utils.Result(error=error_msg)
|
||||
error_result
|
||||
)
|
||||
else:
|
||||
return error_msg
|
||||
return error_result
|
||||
|
||||
action_cls = a_f.construct_action_class(action_class_str, attributes)
|
||||
|
||||
|
@ -56,6 +56,17 @@ class RunActionEngineTest(base.EngineTestCase):
|
||||
|
||||
self.assertEqual('Hello!', action_ex.output['result'])
|
||||
|
||||
@mock.patch.object(
|
||||
std_actions.EchoAction,
|
||||
'run',
|
||||
mock.Mock(side_effect=exc.ActionException("some error"))
|
||||
)
|
||||
def test_run_action_error(self):
|
||||
# Start action and see the result.
|
||||
action_ex = self.engine.start_action('std.echo', {'output': 'Hello!'})
|
||||
|
||||
self.assertIn('some error', action_ex.output['result'])
|
||||
|
||||
def test_run_action_save_result(self):
|
||||
# Start action.
|
||||
action_ex = self.engine.start_action(
|
||||
|
Loading…
Reference in New Issue
Block a user