Skip to content

Repository files navigation

Fatigue

Demo

Continuous IntegrationCrates.iodocs.rsdocs.rs

A load testing tool that's sure to cause stress fractures.

Overview

fatigue is a load testing tool with a simple, yet expressive, config format that makes it easy to topple your services in a matter of minutes. It boasts impressive request per second rates while respecting your system's resources.

Quick Start

  1. Run the test API.

    cargo run -p test-api

  2. Run fatigue

    fatigue -p ./examples/simple.yaml

Configuration

The configuration syntax is divided into three sections. A complete example of all of the features of the configuration file syntax can be seen in examples/complete.yaml.

Configuration values can be overridden with environment variables prefixed via fatigue with a dot as the separator (ie fatigue.run.base_url=http://localhost:8000). See figment documentation for more information.

run

This section describes basic information about the load test run.

run:
base_url: http://localhost:8000concurrency: 32duration:
timed:
duration: 20swarm_up: 1s

Test duration can also take a hard coded amount of iterations. An iteration is a single iteration of all of the actions in a given plan. Multiple concurrent workers will contribute to the iteration count.

run:
...duration:
iteration:
iterations: 1000warm_up: 1s

static_context

The context is data that flows between actions. Actions can modify a context within their given iteration, but we will often want to setup the context once for the entire test run. Static context information is saved under a key based on the static context action's name. Each static context action will have a default name if one is not set, and subsequent context actions can override prior context actions if there are name conflicts.

literal

The literal context action takes any value in properties and assigns it to the context key dictated by name.

static_context:
- type: literalname: usersproperties:
names:
- bob
- johnages:
- 1
- 2

json

The json context action can load a json file, or load raw json.

static_context:
- type: jsonname: json-from-fileproperties:
path: ./test-1.json
- type: jsonname: json-from-rawproperties:
raw: | { "a": "b" }

csv

The csv context action loads csvs, using header names if present or numbered columns if not.

static_context:
- type: csvname: with-headerproperties:
path: ./with_header.csv
- type: csvname: without-headerproperties:
path: ./without_header.csvhas_headers: false

To use header-less csvs, you must use bracket notation to access the fields.

actions:
- type: requestname: say hello - csv without headerproperties:
path: | {% for item in without-header %} /hello/{{item["0"]}}/{{item["2"]}} {% endfor %}

actions

request

The request action sends an http request.

actions:
- type: requestproperties:
path: /ping

path is required at a minimum, however this becomes much more flexible when combined with liquid templating. Both path and body support liquid templates, and the context is present for these templating operations. The response body from a prior http call can also be saved into the current context, and then re-used in later http calls. In order to inject the response body into the context, response_context_key must be set.

actions:
- type: requestname: get list itemsproperties:
path: /listresponse_context_key: items
- type: requestname: get itemproperties:
path: | {% for id in items %} /list/{{id}} {% endfor %} - type: requestname: create itemproperties:
path: /listmethod: POSTbody: | { "id": "{{items[0]}}", "data": "{{items[0]}}" }

delay

The delay action puts a pause in the action chain. milliseconds or seconds must be defined, but cannot both be defined.

actions:
- type: delayproperties:
milliseconds: 10
- type: delayproperties:
seconds: 1

print_context

print_context is useful for debugging context related issues, and will print the current context to console output. It will run for each iteration, so it's best to keep this disabled when not actively in use.

actions:
- type: print_contextproperties: { }

Extensibility

APIs are still in flux and this section of the documentation is highly likely to change. Once we're to a stable-ish place, this will be written. For now, read the code in fatigue/src if you want to learn more about this.

Contribution

Contributing

Inspiration

This project was inspired by drill. After using that quite a bit at $DAYJOB I wanted to contribute some changes to that project, but after reviewing the code I realized that some of the things I wanted to do would've required some pretty hefty refactors. I then decided to start from scratch. Props to fcsonline to the great tool - it's saved me a ton of time.

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages