[
https://issues.apache.org/jira/browse/ARIA-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15943337#comment-15943337
]
ASF GitHub Bot commented on ARIA-120:
-------------------------------------
Github user mxmrlv commented on a diff in the pull request:
https://github.com/apache/incubator-ariatosca/pull/77#discussion_r108177973
--- Diff: tests/orchestrator/workflows/builtin/__init__.py ---
@@ -13,18 +13,65 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from tests import mock
+from aria.orchestrator.workflows.builtin import workflows
-def assert_node_install_operations(operations, with_relationships=False):
- all_operations = mock.operations.OPERATIONS_INSTALL if
with_relationships else \
- mock.operations.NODE_OPERATIONS_INSTALL
- for i, operation in enumerate(operations):
- assert operation.name.startswith(all_operations[i] + '.')
+def _assert_relationships(operations, expected_op_full_name,
relationships=0):
+ """
+ :param operations: and iterable of operations
+ :param expected_op_full_name: Note that source/target doesn't really
matter since they are
+ dropped
+ :param relationships: the number of relationships
+ :return:
+ """
+ expected_op_name = expected_op_full_name.rsplit('_', 1)[0]
+ for _ in xrange(relationships):
+ # Since the target and source operations start of the same way, we
only need to retrieve the
+ # suffix once
+ operation = next(operations)
+ relationship_id_1 = operation.actor.id
+ edge1 = operation.runs_on
+ _assert_cfg_interface_op(operation, expected_op_name)
-def assert_node_uninstall_operations(operations, with_relationships=False):
- all_operations = mock.operations.OPERATIONS_UNINSTALL if
with_relationships else \
- mock.operations.NODE_OPERATIONS_UNINSTALL
- for i, operation in enumerate(operations):
- assert operation.name.startswith(all_operations[i] + '.')
+ operation = next(operations)
+ relationship_id_2 = operation.actor.id
+ edge2 = operation.runs_on
+ _assert_cfg_interface_op(operation, expected_op_name)
+
+ assert relationship_id_1 == relationship_id_2
+ print '++++' + edge1, edge2
+ assert edge1 != edge2
+
+
+def assert_node_install_operations(operations, relationships=0):
+ operations = iter(operations)
+
+ _assert_std_interface_op(next(operations), workflows.NORMATIVE_CREATE)
+ _assert_relationships(operations,
workflows.NORMATIVE_PRE_CONFIGURE_SOURCE, relationships)
+ _assert_std_interface_op(next(operations),
workflows.NORMATIVE_CONFIGURE)
+ _assert_relationships(operations,
workflows.NORMATIVE_POST_CONFIGURE_SOURCE, relationships)
+ _assert_std_interface_op(next(operations), workflows.NORMATIVE_START)
+ _assert_relationships(operations, workflows.NORMATIVE_ADD_SOURCE,
relationships)
+
+
+def assert_node_uninstall_operations(operations, relationships=0):
+ operations = iter(operations)
+
+ _assert_std_interface_op(next(operations), workflows.NORMATIVE_STOP)
+ _assert_relationships(operations, workflows.NORMATIVE_REMOVE_SOURCE,
relationships)
+ _assert_std_interface_op(next(operations), workflows.NORMATIVE_DELETE)
+
+
+def _assert_cfg_interface_op(op, operation_name):
+ op = op.name.split('@', 1)[0].rsplit('_', 1)[0].lower()
+ predicted_name = \
+ '{0}:{1}'.format(workflows.NORMATIVE_CONFIGURE_INTERFACE,
operation_name).lower()
+ assert op == predicted_name
+
+
+def _assert_std_interface_op(op, operation_name):
--- End diff --
save interface_name and operation_name onto the ApiTask
> Builtin workflows have wrong execution order in relationship operations
> -----------------------------------------------------------------------
>
> Key: ARIA-120
> URL: https://issues.apache.org/jira/browse/ARIA-120
> Project: AriaTosca
> Issue Type: Bug
> Reporter: Maxim Orlov
>
> The execution order of relationships based operations of a node is wrong.
> In the current state, all of the pre_configure source operations are executed
> before any pre_configure target operations are executed.
> In the desired state, each source-target operations of a single relationship
> are executed side by side (concurrently), and only once both are done, the
> execution of the next relationship's source-target operations commences.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)