[−][src]Struct goose::GooseAttack
Internal global state for load test.
Implementations
impl GooseAttack
[src]
Goose's internal global state.
pub fn initialize() -> GooseAttack
[src]
Load configuration from command line and initialize a GooseAttack.
Example
use goose::GooseAttack; let mut goose_attack = GooseAttack::initialize();
pub fn initialize_with_config(config: GooseConfiguration) -> GooseAttack
[src]
Initialize a GooseAttack with an already loaded configuration. This should only be called by worker instances.
Example
use goose::{GooseAttack, GooseConfiguration}; use structopt::StructOpt; let configuration = GooseConfiguration::from_args(); let mut goose_attack = GooseAttack::initialize_with_config(configuration);
pub fn setup(self) -> 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::GooseAttack; use goose::goose::{GooseTaskSet, GooseTask, GooseClient}; GooseAttack::initialize() .register_taskset(GooseTaskSet::new("ExampleTasks") .register_task(GooseTask::new(example_task)) ) .register_taskset(GooseTaskSet::new("OtherTasks") .register_task(GooseTask::new(other_task)) ); fn example_task(client: &mut GooseClient) { let _response = client.get("/foo"); } fn other_task(client: &mut GooseClient) { let _response = client.get("/bar"); }
pub fn set_host(self, host: &str) -> Self
[src]
Optionally configure a default host for the load test. This is used if
no per-GooseTaskSet host is defined, no --host
CLI option is configurared,
and if the GooseTask itself doesn't hard-code the host in its request. The
host is prepended on all requests.
For example, your load test may default to running against your local development
container, and the --host
option could be used to override host to run the load
test against production.
Example
use goose::GooseAttack; GooseAttack::initialize() .set_host("local.dev");
pub fn execute(self)
[src]
Execute the load test.
Example
use goose::GooseAttack; use goose::goose::{GooseTaskSet, GooseTask, GooseClient}; GooseAttack::initialize() .register_taskset(GooseTaskSet::new("ExampleTasks") .register_task(GooseTask::new(example_task).set_weight(2)) .register_task(GooseTask::new(another_example_task).set_weight(3)) ) .execute(); fn example_task(client: &mut GooseClient) { let _response = client.get("/foo"); } fn another_example_task(client: &mut GooseClient) { let _response = client.get("/bar"); }
pub fn launch_clients(
self,
started: Instant,
sleep_duration: Duration,
socket: Option<Socket>
) -> GooseAttack
[src]
self,
started: Instant,
sleep_duration: Duration,
socket: Option<Socket>
) -> GooseAttack
Called internally in single-process mode and distributed load test gaggle-mode.
Trait Implementations
impl Clone for GooseAttack
[src]
fn clone(&self) -> GooseAttack
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
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>,