chaperon v0.1.0 Chaperon.LoadTest View Source
Implementation & helper module for defining load_tests. LoadTests define a list of scenarios and their config to run them with.
Example
defmodule LoadTest.Staging do
use Chaperon.LoadTest
# You can define a default config that is used by default.
# Any additional config passed at runtime will be merged into this.
# If default_config/0 is not defined, it defaults to %{}.
def default_config, do: %{
scenario_timeout: 15_000,
base_url: "http://staging.mydomain.com"
}
def scenarios, do: [
# session name is "my_session_name"
{MyScenarioModule, "my_session_name", %{
delay: 2 |> seconds,
my_config_key: "my_config_val"
}},
# will get an assigned session name based on module name and UUID
{MyScenarioModule, %{
delay: 10 |> seconds,
my_config_key: "my_config_val"
}},
# same as above but spawned 10 times (across the cluster):
{{10, MyScenarioModule}, "my_session_name", %{
random_delay: 5 |> seconds,
my_config_key: "my_config_val"
}},
# run Scenario A, followed by Scenario B as a new scenario
{[A, B], %{
# ...
}},
# same as above, but spawned 10 times
{{10, [A, B]}, %{
# ...
}}
]
end
Link to this section Summary
Link to this section Types
Link to this type
t()
View Source
t() :: %Chaperon.LoadTest{config: map, name: atom, scenarios: [Chaperon.Scenario.t]}
Link to this section Functions
Link to this function
merge_sessions(results)
View Source
merge_sessions(Chaperon.LoadTest.Results.t) :: Chaperon.Session.t
Merges metrics & results of all Chaperon.Session
s in a list.
Link to this function
prepare_merge(session)
View Source
prepare_merge(Chaperon.Session.t) :: Chaperon.Session.t
Prepares session
to be merged.
This wraps all metrics and results with the session’s name to be able to differentiate later on for which session they were recorded.