Trait goose::GooseDefaultType [−][src]
pub trait GooseDefaultType<T> { fn set_default(
self,
key: GooseDefault,
value: T
) -> Result<Box<Self>, GooseError>; }
Expand description
All run-time options can optionally be configured with custom defaults.
For example, you can optionally configure a default host for the load test. This is
used if no per-GooseTaskSet
host is defined,
no --host
CLI option is configured, and if the
GooseTask
itself doesn’t hard-code the host in
the base url of its request. In that case, this host is added to all requests.
For example, a load test could be configured to default to running against a local
development container, and the --host
option could be used to override the host
value to run the load test against the production environment.
Example
use goose::prelude::*; fn main() -> Result<(), GooseError> { GooseAttack::initialize()? .set_default(GooseDefault::Host, "local.dev")?; Ok(()) }
The following run-time options can be configured with a custom default using a
borrowed string slice (&str
):
- GooseDefault::Host
- GooseDefault::GooseLog
- GooseDefault::RequestsFormat
- GooseDefault::TaskLog
- GooseDefault::ErrorLog
- GooseDefault::DebugLog
- GooseDefault::TelnetHost
- GooseDefault::WebSocketHost
- GooseDefault::ManagerBindHost
- GooseDefault::ManagerHost
The following run-time options can be configured with a custom default using a
usize
integer:
- GooseDefault::Users
- GooseDefault::HatchRate
- GooseDefault::RunTime
- GooseDefault::RunningMetrics
- GooseDefault::LogLevel
- GooseDefault::Verbose
- GooseDefault::ThrottleRequests
- GooseDefault::ExpectWorkers
- GooseDefault::TelnetPort
- GooseDefault::WebSocketPort
- GooseDefault::ManagerBindPort
- GooseDefault::ManagerPort
The following run-time flags can be configured with a custom default using a
bool
(and otherwise default to false
).
- GooseDefault::NoResetMetrics
- GooseDefault::NoMetrics
- GooseDefault::NoTaskMetrics
- GooseDefault::NoErrorSummary
- GooseDefault::NoDebugBody
- GooseDefault::NoTelnet
- GooseDefault::NoWebSocket
- GooseDefault::NoAutoStart
- GooseDefault::StatusCodes
- GooseDefault::StickyFollow
- GooseDefault::Manager
- GooseDefault::NoHashCheck
- GooseDefault::Worker
The following run-time flags can be configured with a custom default using a
GooseLogFormat
.
Another Example
use goose::prelude::*; fn main() -> Result<(), GooseError> { GooseAttack::initialize()? // Do not reset the metrics after the load test finishes starting. .set_default(GooseDefault::NoResetMetrics, true)? // Display info level logs while the test runs. .set_default(GooseDefault::Verbose, 1)? // Log all requests made during the test to `./goose-request.log`. .set_default(GooseDefault::RequestLog, "goose-request.log")?; Ok(()) }
Required methods
fn set_default(
self,
key: GooseDefault,
value: T
) -> Result<Box<Self>, GooseError>