Merge "Fixing run action when error occurs"

This commit is contained in:
Jenkins 2015-09-23 16:19:59 +00:00 committed by Gerrit Code Review
commit 850c805045
2 changed files with 15 additions and 2 deletions

View File

@ -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)

View File

@ -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(