MCPcopy Index your code
hub / github.com/github/spec-kit / test_shell_run_resolves_run_id

Method test_shell_run_resolves_run_id

tests/test_workflows.py:3609–3632  ·  view source on GitHub ↗

`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)

Source from the content-addressed store, hash-verified

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("""
3617schema_version: "1.0"
3618workflow:
3619 id: "stamp-run-id"
3620 name: "Stamp Run Id"
3621 version: "1.0.0"
3622steps:
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

Callers

nothing calls this directly

Calls 3

executeMethod · 0.95
WorkflowEngineClass · 0.90
from_stringMethod · 0.80

Tested by

no test coverage detected