GithubHelp home page GithubHelp logo

chaostoolkit-locust's Introduction

Locust extension for the Chaos Toolkit

Locust is a python based open source performance testing tool: https://locust.io/ Chaostoolkit-locust module provides actions to start/stop Locust open source performance testing tool. It also provides proves to check it status and to get the locust test run statistics.

Install

The extension is not yet pushed to PyPi. If you would like to use the extension please checkout the source code and compile it locally.

Install python dependencies

First navigate to the project root and run the following command:

python3 -m pip install -r requirements.txt

If you use pipenv and virtual python environment please use the following command:

pipenv install -r requirements.txt

Install python dev dependencies

python3 -m pip install -r requirements-dev.txt
pipenv install -r requirements-dev.txt

Build extension locally

python3 setup.py bdist_wheel;
python3 -m pip install dist/chaostoolkit_locust-0.0.1-py3-none-any.whl

Usage

To use the probe and check Locust.io status, please insert the following into an experiment file:

{
  "steady-state-hypothesis": {
    "title": "Locust server must be running",
    "probes": [
      {
        "type": "probe",
        "name": "is_locust_running",
        "tolerance": true,
        "provider": {
          "type": "python",
          "module": "chaoslocust.probes",
          "func": "is_locust_running"
        }
      }
    ]
  }
}

If you want to start Locust.io, please use the following action in an experiment file:

{
  "method": [
    {
      "type": "action",
      "name": "start_locust_test",
      "provider": {
        "type": "python",
        "module": "chaoslocust.actions",
        "func": "start_locust",
        "arguments": {
          "user_count": 10,
          "spawn_rate": 1,
          "host": "localhost"
        }
      }
    }
  ]
}

If you want to stop Locust.io, please use the following action in an experiment file:

{
  "method": [
    {
      "type": "action",
      "name": "stop_locust_test",
      "provider": {
        "type": "python",
        "module": "chaoslocust.actions",
        "func": "stop_locust"
      }
    }
  ]
}

If you want to probe a Locust.io execution time statistics value, please use the following action in an experiment file:

{
  "method": [
    {
      "type": "probe",
      "name": "avg_latency_should_be_in_tolerance_range",
      "tolerance": {
        "type": "range",
        "range": [0, 10]
      },
      "provider": {
        "type": "python",
        "module": "chaoslocust.probes",
        "func": "get_current_stats",
        "arguments": {
          "metric_name": "current_response_time_percentile_50"
        }
      }
    }
  ]
}

Test

To run the extension unit tests:

pytest ./tests

Contribute

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

chaostoolkit-locust's People

Contributors

brian-burton avatar gaborgerencser-vodafone avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.