Public helpers for testing Continuum workflows.
The helpers in this module are deliberately small and stable. They cover the v0.1 testing loop:
- run workflows against the in-memory journal
- load or persist event histories
- replay a committed golden history
- inject signals and timers in deterministic tests
- check out an Ecto SQL Sandbox connection for Postgres-backed tests
The in-memory journal is process-local and not durable. Use unique run IDs
or call reset_in_memory!/0 between tests that need a clean journal.
Summary
Functions
Assert that a workflow replays from history without drift.
Assert that a workflow replays from history to expected.
Check out an Ecto SQL Sandbox connection.
Persist a run history to path as an Erlang external term.
Inject a fired timer event for the latest pending timer in a run's history.
Load a run's event history from a journal.
Inject a signal into a run and wake its local engine when one exists.
Load a history previously written by dump_history!/3.
Replay a workflow from an existing history.
Reset the in-memory journal.
Start a workflow run against the Postgres journal.
Start a workflow run synchronously against the in-memory journal.
Types
Functions
Assert that a workflow replays from history without drift.
Returns the replayed result.
Assert that a workflow replays from history to expected.
Check out an Ecto SQL Sandbox connection.
Pass shared: true when workflow engines or workers need to use the test
process' checked-out connection.
Persist a run history to path as an Erlang external term.
The resulting file is intended for golden-history tests committed to the repository.
Inject a fired timer event for the latest pending timer in a run's history.
Load a run's event history from a journal.
Inject a signal into a run and wake its local engine when one exists.
Load a history previously written by dump_history!/3.
@spec replay(module(), term(), [map()], keyword()) :: replay_result()
Replay a workflow from an existing history.
Returns {:ok, result} when the workflow completes from history, or
{:suspended, reason} if the history ends at a pending effect.
@spec reset_in_memory!() :: :ok
Reset the in-memory journal.
Start a workflow run against the Postgres journal.
Start a workflow run synchronously against the in-memory journal.