StackStorm / StackStorm/orquesta

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

Open
#275 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
111
Forks
44
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WorkflowTestCase spec and the WorkflowRehearsal test case, then trace how workflow variables are evaluated when st2.action_execution_id is referenced. Add support for passing context through the spec and using it during rehearsal, and verify that the reported context assertion no longer occurs for workflows using st2 context.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.