[][src]Struct goose::goose::GooseTaskSet

pub struct GooseTaskSet {
    pub name: String,
    pub task_sets_index: usize,
    pub weight: usize,
    pub min_wait: usize,
    pub max_wait: usize,
    pub tasks: Vec<GooseTask>,
    pub weighted_tasks: Vec<Vec<usize>>,
    pub weighted_on_start_tasks: Vec<Vec<usize>>,
    pub weighted_on_stop_tasks: Vec<Vec<usize>>,
    pub host: Option<String>,
}

An individual task set.

Fields

name: String

The name of the task set.

task_sets_index: usize

An integer reflecting where this task set lives in the internal GooseTest.task_sets vector.

weight: usize

An integer value that controls the frequency that this task set will be assigned to a client.

min_wait: usize

An integer value indicating the minimum number of seconds a client will sleep after running a task.

max_wait: usize

An integer value indicating the maximum number of seconds a client will sleep after running a task.

tasks: Vec<GooseTask>

A vector containing one copy of each GooseTask that will run by clients running this task set.

weighted_tasks: Vec<Vec<usize>>

A vector of vectors of integers, controlling the sequence and order GooseTasks are run.

weighted_on_start_tasks: Vec<Vec<usize>>

A vector of vectors of integers, controlling the sequence and order on_start GooseTasks are run when the client first starts.

weighted_on_stop_tasks: Vec<Vec<usize>>

A vector of vectors of integers, controlling the sequence and order on_stop GooseTasks are run when a client stops.

host: Option<String>

An optional default host to run this TaskSet against.

Methods

impl GooseTaskSet[src]

pub fn new(name: &str) -> Self[src]

Creates a new GooseTaskSet. Once created, GooseTasks must be assigned to it, and finally it must be registered with the GooseState object. The returned object must be stored in a mutable value.

Example

    let mut example_tasks = GooseTaskSet::new("ExampleTasks");

pub fn register_task(self, task: GooseTask) -> Self[src]

Registers a GooseTask with a GooseTaskSet, where it is stored in the GooseTaskSet.tasks vector. The function associated with the task will be run during the load test.

Example

    let mut example_tasks = GooseTaskSet::new("ExampleTasks");
    example_tasks.register_task(GooseTask::new(a_task_function));

pub fn set_weight(self, weight: usize) -> Self[src]

Sets a weight on a task set. The larger the value of weight, the more often the task set will be assigned to clients. For example, if you have task set foo with a weight of 3, and task set bar with a weight of 1, and you spin up a load test with 8 clients, 6 of them will be running the foo task set, and 2 will be running the bar task set.

Example

    let mut example_tasks = GooseTaskSet::new("ExampleTasks").set_weight(3);

pub fn set_host(self, host: &str) -> Self[src]

Set a default host for the task set. If no --host flag is set when running the load test, this host will be pre-pended on all requests. For example, this can configure your load test to run against your local development environment by default, and the --host option could be used to override host when running the load test against production.

Example

    let mut example_tasks = GooseTaskSet::new("ExampleTasks").set_host("http://10.1.1.42");

pub fn set_wait_time(self, min_wait: usize, max_wait: usize) -> Self[src]

Configure a task_set to to pause after running each task. The length of the pause will be randomly selected from min_weight to max_wait inclusively. For example, if min_wait is 0 and max_weight is 2, the client will randomly sleep for 0, 1 or 2 seconds after each task completes.

Example

    let mut example_tasks = GooseTaskSet::new("ExampleTasks").set_wait_time(0, 1);

Trait Implementations

impl Clone for GooseTaskSet[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,