orquesta icon indicating copy to clipboard operation
orquesta copied to clipboard

Make it possible to use `context` in `WorkflowRehearsal` Test Cases

Open jpavlav opened this issue 4 months ago • 0 comments

I was working on some unit tests for some st2 workflows and the WorkflowRehearsal test case doesn't account for times when the st2 context may be accessed in the workflow. I have a workflow that defines in the vars section a variable that includes st2.action_execution_id. It results in an exception like this one:

E   AssertionError: {'context': [{'type': 'yaql', 'expression'[161 chars]t'}]} != {}
E   + {}
E   - {'context': [{'expression': '<% ctx().st2.action_execution_id %>',
E   -               'message': 'Variable "st2" is referenced before assignment.',
E   -               'schema_path': 'properties.output',
E   -               'spec_path': 'output[1]',
E   -               'type': 'yaql'}]}

It would be useful to be able to pass in context to the WorkflowTestCase spec and then update the WorkflowRehearsal test case to make use of it.

jpavlav avatar Oct 14 '25 19:10 jpavlav