1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements. See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 from aria.orchestrator.workflows.api import task
19 from aria.orchestrator.workflows.builtin.execute_operation import execute_operation
21 from tests import mock, storage
26 context = mock.context.simple(str(tmpdir), inmemory=False)
28 storage.release_sqlite_storage(context.model)
31 def test_execute_operation(ctx):
32 node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME)
33 interface_name, operation_name = mock.operations.NODE_OPERATIONS_INSTALL[0]
34 interface = mock.models.create_interface(
38 operation_kwargs=dict(function='test')
40 node.interfaces[interface.name] = interface
41 ctx.model.node.update(node)
47 interface_name=interface_name,
48 operation_name=operation_name,
50 allow_kwargs_override=False,
51 run_by_dependency_order=False,
58 assert len(execute_tasks) == 1
59 assert getattr(execute_tasks[0].actor, '_wrapped', execute_tasks[0].actor) == node
60 assert execute_tasks[0].operation_name == operation_name
61 assert execute_tasks[0].interface_name == interface_name
64 # TODO: add more scenarios