View Source Runbox.Runtime.Stage.Sandbox (runbox v13.0.3)
Sandbox is helper for executing runs without started Altworx application.
Sandbox can be used for scenarios unit testing and also for interactive
development of scenarios. When used for unit testing, it can be used
directly or via Runbox.Runtime.Stage.Sandbox.TestRunner
.
This module is only for StageBased scenarios.
For interactive development of scenarios, run iex --erl "-runbox mode slave" -S mix
from command line in your scenarios application root directory and then use Sandbox
functions to execute your runs (of course use recompile
before run execution if you
changed scenario code).
Summary
Functions
Starts new run for scenario_id
and waits until all input messages are processed.
Functions
@spec execute_run( Runbox.Runtime.Sandbox.topics(), scenario_id :: String.t(), Runbox.Runtime.Sandbox.opts() ) :: {:ok, [Runbox.Scenario.OutputAction.t()]} | {:error, any()}
Starts new run for scenario_id
and waits until all input messages are processed.
Returns all output actions generated by run execution. Input messages for each runtime
topic used by scenario should be defined in topics
argument. Undefined topics are
considered empty. Messages in each topic must be in ascending order by timestamp
.
There are few options that can be specified.
:start_from
- specify the start from value for the run. The value is used to filter out messages (as in a real run, input topics only use messages withtimestamp >= start_from
) and the value is provided to template'sinit
callback.:modules
- list of modules containing scenarios (manifests, templates). If list of modules is specifiedexecute_run
does not search scenario in:scenarios
application release, but in given modules. It opens possibility to write ad-hoc scenarios with only dependency on Runbox application, for example use it in Livebook. To see example of such livebook just runlivebook server --home .
in runbox root directory, go to generated livebook server link in browser and finally opensandbox-scenario-demo.livemd
document. Running docker or altworx is not needed, only runbox app (and its deps) is required!