How do I run a workflow that fails?
Table of Contents
The fail-fast configuration of the identity workflow. The ores-shell block
below is tangled into the runnable script library as identity_fail_fast.ores.
1. Question
How do I run a workflow whose only step fails?
2. Answer
The single step reports fail and declares no compensation, so there is nothing to unwind. The engine moves the instance through compensating and settles it at compensated, which --expect-state asserts.
workflow start identity_workflow '{"steps":[{"name":"boom","behaviour":"fail"}]}' --instance-id 10000000-0000-4000-8000-000000000004
workflow wait 10000000-0000-4000-8000-000000000004 --timeout 60 --expect-state compensated
workflow wait fails unless the instance reaches the state named, so this
script fails when the path it covers does nothing.
3. Script
projects/ores.shell/scripts/library/workflow/identity_fail_fast.ores –
generated from this recipe by compass build --direct tangle_shell_scripts
(do not edit the .ores by hand).
4. Tested by
Manual: compass shell -f identity_fail_fast.ores against a running fleet.
5. See also
- Add the identity workflow and the commands that drive it – the fixture.