Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/175#discussion_r126371221
  
    --- Diff: tests/orchestrator/test_workflow_runner.py ---
    @@ -441,8 +509,42 @@ def mock_resuming_task(ctx):
         ctx.node.attributes['invocations'] += 1
     
         if ctx.node.attributes['invocations'] != 1:
    -        events['is_active'].set()
    -        if not events['is_resumed'].isSet():
    +        custom_events['is_active'].set()
    +        if not custom_events['is_resumed'].isSet():
                 # if resume was called, increase by one. o/w fail the 
execution - second task should
                 # fail as long it was not a part of resuming the workflow
                 raise BaseException("wasn't resumed yet")
    +
    +
    +@workflow
    +def mock_sequential_workflow(ctx, graph):
    +    node = 
ctx.model.node.get_by_name(tests_mock.models.DEPENDENCY_NODE_NAME)
    +    graph.sequence(
    +        api.task.OperationTask(node,
    +                               interface_name='aria.interfaces.lifecycle',
    +                               operation_name='create',
    +                               retry_interval=1,
    +                               max_attempts=10),
    +    )
    +
    +
    +@operation
    +def mock_failed_first_task(ctx):
    +    """
    +    The task should run atmost ctx.task.max_attempts - 1 times, and only 
then pass.
    +    overall, the number of invocations should be ctx.task.max_attempts - 1
    +    """
    +    ctx.node.attributes['invocations'] += 1
    +
    +    if ctx.node.attributes['invocations'] == 2:
    +        custom_events['is_active'].set()
    +        # unfreeze the thread only when all of the invocations are done
    +        while ctx.node.attributes['invocations'] < ctx.task.max_attempts - 
1:
    +            pass
    --- End diff --
    
    sleep(5)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to