Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-278-Remove-core-tasks 4ad3600b2 -> 4c723c9c3
tiny test fix Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/4c723c9c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/4c723c9c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/4c723c9c Branch: refs/heads/ARIA-278-Remove-core-tasks Commit: 4c723c9c393b6d7849ed8aed54af4399e2b34954 Parents: 4ad3600 Author: max-orlov <ma...@gigaspaces.com> Authored: Wed Jun 14 18:17:23 2017 +0300 Committer: max-orlov <ma...@gigaspaces.com> Committed: Wed Jun 14 18:32:48 2017 +0300 ---------------------------------------------------------------------- tests/orchestrator/context/test_serialize.py | 11 +++----- tests/orchestrator/workflows/core/test_task.py | 30 ++++++++++----------- 2 files changed, 18 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4c723c9c/tests/orchestrator/context/test_serialize.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/context/test_serialize.py b/tests/orchestrator/context/test_serialize.py index aa19f56..ef215cd 100644 --- a/tests/orchestrator/context/test_serialize.py +++ b/tests/orchestrator/context/test_serialize.py @@ -33,12 +33,6 @@ def test_serialize_operation_context(context, executor, tmpdir): test_file.write(TEST_FILE_CONTENT) resource = context.resource resource.service_template.upload(TEST_FILE_ENTRY_ID, str(test_file)) - graph = _mock_workflow(ctx=context) # pylint: disable=no-value-for-parameter - workflow_runner.construct_execution_tasks(context.execution, graph, executor.__class__) - context.execution = context.execution - execution_graph = workflow_runner.get_execution_graph(context.execution) - eng = engine.Engine(executor, context, execution_graph) - eng.execute() node = context.model.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME) plugin = mock.models.create_plugin() @@ -54,7 +48,10 @@ def test_serialize_operation_context(context, executor, tmpdir): context.model.node.update(node) graph = _mock_workflow(ctx=context) # pylint: disable=no-value-for-parameter - eng = engine.Engine(executor=executor, workflow_context=context, tasks_graph=graph) + workflow_runner.construct_execution_tasks(context.execution, graph, executor.__class__) + context.execution = context.execution + execution_graph = workflow_runner.get_execution_graph(context.execution) + eng = engine.Engine(executor, context, execution_graph) eng.execute() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4c723c9c/tests/orchestrator/workflows/core/test_task.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/workflows/core/test_task.py b/tests/orchestrator/workflows/core/test_task.py index c0d3616..f0f3a3b 100644 --- a/tests/orchestrator/workflows/core/test_task.py +++ b/tests/orchestrator/workflows/core/test_task.py @@ -25,6 +25,7 @@ from aria.orchestrator.workflows import ( core, exceptions, ) +from aria.modeling import models from tests import mock, storage @@ -70,8 +71,8 @@ class TestOperationTask(object): node, interface_name=NODE_INTERFACE_NAME, operation_name=NODE_OPERATION_NAME) - core_task = core.task.OperationTask(api_task=api_task, executor=None) - return api_task, core_task + model_task = models.Task.from_api_task(api_task, None) + return api_task, model_task def _create_relationship_operation_task(self, ctx, relationship): with workflow_context.current.push(ctx): @@ -79,7 +80,7 @@ class TestOperationTask(object): relationship, interface_name=RELATIONSHIP_INTERFACE_NAME, operation_name=RELATIONSHIP_OPERATION_NAME) - core_task = core.task.OperationTask(api_task=api_task, executor=None) + core_task = models.Task.from_api_task(api_task, None) return api_task, core_task def test_node_operation_task_creation(self, ctx): @@ -96,25 +97,21 @@ class TestOperationTask(object): ) node.interfaces[interface.name] = interface ctx.model.node.update(node) - api_task, core_task = self._create_node_operation_task(ctx, node) - storage_task = ctx.model.task.get_by_name(core_task.name) - assert storage_task.plugin is storage_plugin - assert storage_task.execution_name == ctx.execution.name - assert storage_task.actor == core_task.context.node - assert core_task.model_task == storage_task - assert core_task.name == api_task.name - assert core_task.function == api_task.function - assert core_task.actor == api_task.actor == node - assert core_task.arguments == api_task.arguments == storage_task.arguments - assert core_task.plugin == storage_plugin + api_task, model_task = self._create_node_operation_task(ctx, node) + assert model_task.name == api_task.name + assert model_task.function == api_task.function + assert model_task.actor == api_task.actor == node + assert model_task.arguments == api_task.arguments + assert model_task.plugin == storage_plugin def test_relationship_operation_task_creation(self, ctx): relationship = ctx.model.relationship.list()[0] ctx.model.relationship.update(relationship) - _, core_task = self._create_relationship_operation_task( + _, model_Task = self._create_relationship_operation_task( ctx, relationship) - assert core_task.model_task.actor == relationship + assert model_Task.actor == relationship + @pytest.mark.skip("Currently not supported for model tasks") def test_operation_task_edit_locked_attribute(self, ctx): node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME) @@ -131,6 +128,7 @@ class TestOperationTask(object): with pytest.raises(exceptions.TaskException): core_task.due_at = now + @pytest.mark.skip("Currently not supported for model tasks") def test_operation_task_edit_attributes(self, ctx): node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME)