StackStorm / orquesta

Orquesta is a graph based workflow engine for StackStorm. Questions? https://github.com/StackStorm/st2/discussions
https://docs.stackstorm.com/orquesta/
Apache License 2.0
98 stars 39 forks source link

With Items Causing Workflow Tests to Fail When Items are an Empty List #268

Open FileMagic opened 2 months ago

FileMagic commented 2 months ago

Let's say that you have a workflow:

example_workflow.yaml

version: 1.0
tasks:
  start:
    action: core.noop
    next:
      - when: <% succeeded() %>
        do:
          - with_items_task_example
  with_items_task_example: # This shouldn't run
  action: core.echo
  with:
    items: <% [] %>
  input:
    message: <% item() %>

You can try to write the following workflow test: workflow_test.yaml

---
  workflow: "example_workflow.yaml"
  expected_routes: [[]]
  inputs: {}

  expected_task_sequence:
    - start
    - with_items_task_example

  mock_action_executions: []

  expected_workflow_status: succeeded

If we were to test this using the orquesta test, this would fail due to the items from the with items call within the with_items_task_example task. The error would be - ERROR - list assignment index out of range.

I am guessing that orquesta when running the test doesn't properly handle the list. Where as if you were to run this in st2 it would run without a hitch.