`run: "echo {{ context.run_id }}"` substitutes the engine-assigned run id into the spawned shell, and the same value appears on `state.run_id`.
(self, project_dir)
| 3607 | """End-to-end tests for `{{ context.run_id }}` in workflow YAML.""" |
| 3608 | |
| 3609 | def test_shell_run_resolves_run_id(self, project_dir): |
| 3610 | """`run: "echo {{ context.run_id }}"` substitutes the |
| 3611 | engine-assigned run id into the spawned shell, and the |
| 3612 | same value appears on `state.run_id`. |
| 3613 | """ |
| 3614 | from specify_cli.workflows.engine import WorkflowDefinition, WorkflowEngine |
| 3615 | |
| 3616 | definition = WorkflowDefinition.from_string(""" |
| 3617 | schema_version: "1.0" |
| 3618 | workflow: |
| 3619 | id: "stamp-run-id" |
| 3620 | name: "Stamp Run Id" |
| 3621 | version: "1.0.0" |
| 3622 | steps: |
| 3623 | - id: stamp |
| 3624 | type: shell |
| 3625 | run: "echo RUN_ID={{ context.run_id }}" |
| 3626 | """) |
| 3627 | engine = WorkflowEngine(project_dir) |
| 3628 | state = engine.execute(definition, run_id="abc12345") |
| 3629 | |
| 3630 | assert state.run_id == "abc12345" |
| 3631 | stdout = state.step_results["stamp"]["output"]["stdout"] |
| 3632 | assert stdout.strip() == "RUN_ID=abc12345" |
| 3633 | |
| 3634 | def test_command_input_args_resolves_run_id(self, project_dir): |
| 3635 | """`input.args: "{{ context.run_id }}"` is resolved by |
nothing calls this directly
no test coverage detected