orquesta icon indicating copy to clipboard operation
orquesta copied to clipboard

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

Open FileMagic opened this issue 1 year ago • 0 comments

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.

FileMagic avatar Jun 27 '24 17:06 FileMagic