[−][src]Struct goose::GooseAttack
Internal global state for load test.
Implementations
impl GooseAttack
[src]
Goose's internal global state.
pub fn initialize() -> Result<GooseAttack, GooseError>
[src]
Load configuration from command line and initialize a GooseAttack.
Example
use goose::prelude::*; let mut goose_attack = GooseAttack::initialize();
pub fn initialize_with_config(
configuration: GooseConfiguration
) -> Result<GooseAttack, GooseError>
[src]
configuration: GooseConfiguration
) -> Result<GooseAttack, GooseError>
Initialize a GooseAttack with an already loaded configuration. This should only be called by worker instances.
Example
use goose::{GooseAttack, GooseConfiguration}; use gumdrop::Options; let configuration = GooseConfiguration::parse_args_default_or_exit(); let mut goose_attack = GooseAttack::initialize_with_config(configuration);
pub fn initialize_logger(&self)
[src]
pub fn register_taskset(self, taskset: GooseTaskSet) -> Self
[src]
A load test must contain one or more GooseTaskSet
s. Each task set must
be registered into Goose's global state with this method for it to run.
Example
use goose::prelude::*; fn main() -> Result<(), GooseError> { GooseAttack::initialize()? .register_taskset(taskset!("ExampleTasks") .register_task(task!(example_task)) ) .register_taskset(taskset!("OtherTasks") .register_task(task!(other_task)) ); Ok(()) } async fn example_task(user: &GooseUser) -> GooseTaskResult { let _goose = user.get("/foo").await?; Ok(()) } async fn other_task(user: &GooseUser) -> GooseTaskResult { let _goose = user.get("/bar").await?; Ok(()) }
pub fn test_start(self, task: GooseTask) -> Self
[src]
Optionally define a task to run before users are started and all task sets start running. This is would generally be used to set up anything required for the load test.
When running in a distributed Gaggle, this task is only run one time by the Manager.
Example
use goose::prelude::*; fn main() -> Result<(), GooseError> { GooseAttack::initialize()? .test_start(task!(setup)); Ok(()) } async fn setup(user: &GooseUser) -> GooseTaskResult { // do stuff to set up load test ... Ok(()) }
pub fn test_stop(self, task: GooseTask) -> Self
[src]
Optionally define a task to run after all users have finished running all defined task sets. This would generally be used to clean up anything that was specifically set up for the load test.
When running in a distributed Gaggle, this task is only run one time by the Manager.
Example
use goose::prelude::*; fn main() -> Result<(), GooseError> { GooseAttack::initialize()? .test_stop(task!(teardown)); Ok(()) } async fn teardown(user: &GooseUser) -> GooseTaskResult { // do stuff to tear down the load test ... Ok(()) }
pub fn execute(self) -> Result<GooseMetrics, GooseError>
[src]
Execute the load test.
Example
use goose::prelude::*; fn main() -> Result<(), GooseError> { let _goose_metrics = GooseAttack::initialize()? .register_taskset(taskset!("ExampleTasks") .register_task(task!(example_task).set_weight(2)?) .register_task(task!(another_example_task).set_weight(3)?) ) .execute()?; Ok(()) } async fn example_task(user: &GooseUser) -> GooseTaskResult { let _goose = user.get("/foo").await?; Ok(()) } async fn another_example_task(user: &GooseUser) -> GooseTaskResult { let _goose = user.get("/bar").await?; Ok(()) }
Trait Implementations
impl Clone for GooseAttack
[src]
fn clone(&self) -> GooseAttack
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'_> GooseDefaultType<&'_ str> for GooseAttack
[src]
fn set_default(
self,
key: GooseDefault,
value: &str
) -> Result<Box<Self>, GooseError>
[src]
self,
key: GooseDefault,
value: &str
) -> Result<Box<Self>, GooseError>
impl GooseDefaultType<bool> for GooseAttack
[src]
fn set_default(
self,
key: GooseDefault,
value: bool
) -> Result<Box<Self>, GooseError>
[src]
self,
key: GooseDefault,
value: bool
) -> Result<Box<Self>, GooseError>
impl GooseDefaultType<usize> for GooseAttack
[src]
fn set_default(
self,
key: GooseDefault,
value: usize
) -> Result<Box<Self>, GooseError>
[src]
self,
key: GooseDefault,
value: usize
) -> Result<Box<Self>, GooseError>
Auto Trait Implementations
impl !RefUnwindSafe for GooseAttack
impl Send for GooseAttack
impl Sync for GooseAttack
impl Unpin for GooseAttack
impl !UnwindSafe for GooseAttack
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,