From b825e365b9d05af7aa2af8b210c5d98559fd222e Mon Sep 17 00:00:00 2001 From: Nikolay Mahotkin Date: Tue, 28 Apr 2015 14:49:51 +0300 Subject: [PATCH] Adding 'Task name' in Action Execution CLI Change-Id: I0358a264ff1a229dfe2da78c9a64315e83f39c12 Depends-On: I881e34d17f180673afa9053abb0b5dd8dbe79a42 --- mistralclient/commands/v2/action_executions.py | 2 ++ .../functional/cli/v2/cli_multi_tenancy_tests.py | 5 ++++- .../tests/functional/cli/v2/cli_tests_v2.py | 12 +++++++++++- mistralclient/tests/unit/v2/test_cli_action_execs.py | 7 ++++--- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/mistralclient/commands/v2/action_executions.py b/mistralclient/commands/v2/action_executions.py index 183cddbb..45e7576f 100644 --- a/mistralclient/commands/v2/action_executions.py +++ b/mistralclient/commands/v2/action_executions.py @@ -35,6 +35,7 @@ def format(action_ex=None, lister=False): 'ID', 'Name', 'Workflow name', + 'Task name', 'State', 'State info', 'Is accepted', @@ -48,6 +49,7 @@ def format(action_ex=None, lister=False): action_ex.id, action_ex.name, action_ex.workflow_name, + action_ex.task_name, action_ex.state, state_info, action_ex.accepted, diff --git a/mistralclient/tests/functional/cli/v2/cli_multi_tenancy_tests.py b/mistralclient/tests/functional/cli/v2/cli_multi_tenancy_tests.py index 51e38441..101152a8 100644 --- a/mistralclient/tests/functional/cli/v2/cli_multi_tenancy_tests.py +++ b/mistralclient/tests/functional/cli/v2/cli_multi_tenancy_tests.py @@ -351,7 +351,10 @@ class ActionExecutionIsolationCLITests(base_v2.MistralClientTestBase): def test_action_execution_isolation(self): wf = self.workflow_create(self.wf_def) - self.execution_create(wf[0]["Name"]) + wf_exec = self.execution_create(wf[0]["Name"]) + direct_ex_id = self.get_value_of_field(wf_exec, 'ID') + + self.wait_execution_success(direct_ex_id) act_execs = self.mistral_admin("action-execution-list") self.assertIn(wf[0]["Name"], diff --git a/mistralclient/tests/functional/cli/v2/cli_tests_v2.py b/mistralclient/tests/functional/cli/v2/cli_tests_v2.py index 4ff5069c..514bd084 100644 --- a/mistralclient/tests/functional/cli/v2/cli_tests_v2.py +++ b/mistralclient/tests/functional/cli/v2/cli_tests_v2.py @@ -646,12 +646,22 @@ class ActionExecutionCLITests(base_v2.MistralClientTestBase): def test_act_execution_get(self): self.wait_execution_success(self.direct_ex_id) + task = self.mistral_admin( + 'task-list', params=self.direct_ex_id)[0] + + act_ex_from_list = self.mistral_admin( + 'action-execution-list', params=task['ID'])[0] + act_ex = self.mistral_admin( - 'action-execution-get', params=self.direct_ex_id) + 'action-execution-get', params=act_ex_from_list['ID']) wf_name = self.get_value_of_field(act_ex, 'Workflow name') status = self.get_value_of_field(act_ex, 'State') + self.assertEqual( + act_ex_from_list['ID'], + self.get_value_of_field(act_ex, 'ID') + ) self.assertEqual(wf_name, self.direct_wf['Name']) self.assertEqual(status, 'SUCCESS') diff --git a/mistralclient/tests/unit/v2/test_cli_action_execs.py b/mistralclient/tests/unit/v2/test_cli_action_execs.py index 317ac0f4..62f1d576 100644 --- a/mistralclient/tests/unit/v2/test_cli_action_execs.py +++ b/mistralclient/tests/unit/v2/test_cli_action_execs.py @@ -26,6 +26,7 @@ ACTION_EX_DICT = { 'id': '123', 'name': 'some', 'workflow_name': 'thing', + 'task_name': 'task1', 'state': 'RUNNING', 'state_info': 'RUNNING somehow.', 'accepted': True @@ -59,7 +60,7 @@ class TestCLIActionExecutions(base.BaseCommandTest): app_args=['id', '--state', 'ERROR']) self.assertEqual( - ('123', 'some', 'thing', 'RUNNING', + ('123', 'some', 'thing', 'task1', 'RUNNING', 'RUNNING somehow.', True), result[1] ) @@ -72,7 +73,7 @@ class TestCLIActionExecutions(base.BaseCommandTest): result = self.call(action_ex_cmd.List) self.assertEqual( - [('123', 'some', 'thing', 'RUNNING', + [('123', 'some', 'thing', 'task1', 'RUNNING', 'RUNNING somehow.', True)], result[1] ) @@ -85,7 +86,7 @@ class TestCLIActionExecutions(base.BaseCommandTest): result = self.call(action_ex_cmd.Get, app_args=['id']) self.assertEqual( - ('123', 'some', 'thing', 'RUNNING', + ('123', 'some', 'thing', 'task1', 'RUNNING', 'RUNNING somehow.', True), result[1] )