All Projects → yandex-load → yandex-tank-api

yandex-load / yandex-tank-api

Licence: MIT license
HTTP API for Yandex.Tank

Programming Languages

python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language
coffeescript
4710 projects
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to yandex-tank-api

k6-example-data-generation
Example repository showing how to utilise k6 and faker to load test using generated data
Stars: ✭ 32 (+100%)
Mutual labels:  load-testing
jmeter-to-k6
Converts JMeter .jmx files to k6 JS code
Stars: ✭ 57 (+256.25%)
Mutual labels:  load-testing
mzbench
Distributed Benchmarking
Stars: ✭ 39 (+143.75%)
Mutual labels:  load-testing
eat
Json based scenario testing tool(which can have test for functional and non-functional)
Stars: ✭ 41 (+156.25%)
Mutual labels:  load-testing
awesome-locust
A collection of resources covering different aspects of Locust load testing tool usage.
Stars: ✭ 40 (+150%)
Mutual labels:  load-testing
ultron
new repository: https://github.com/wosai/ultron
Stars: ✭ 15 (-6.25%)
Mutual labels:  load-testing
apistress
Very simple stress testing tool for API
Stars: ✭ 22 (+37.5%)
Mutual labels:  load-testing
load-testing-toolkit
Collection of open-source tools for debugging, benchmarking, load and stress testing your code or services.
Stars: ✭ 65 (+306.25%)
Mutual labels:  load-testing
k6-reporter
Output K6 test run results as formatted & easy to read HTML reports
Stars: ✭ 160 (+900%)
Mutual labels:  load-testing
ezab
A suite of tools for benchmarking (load testing) web servers and databases
Stars: ✭ 16 (+0%)
Mutual labels:  load-testing
postman-to-k6
Converts Postman collections to k6 script code
Stars: ✭ 269 (+1581.25%)
Mutual labels:  load-testing
TankLogo
1v1 tank war model built by NetLogo 💥
Stars: ✭ 50 (+212.5%)
Mutual labels:  tank
goku
goku is a HTTP load testing application written in Rust
Stars: ✭ 29 (+81.25%)
Mutual labels:  load-testing
jmeter-grpc-request
JMeter gRPC Request load test plugin for gRPC
Stars: ✭ 137 (+756.25%)
Mutual labels:  load-testing
cucumber-performance
A performance testing framework for cucumber
Stars: ✭ 28 (+75%)
Mutual labels:  load-testing
benchmark-thrift
An open source application designed to load test Thrift applications
Stars: ✭ 41 (+156.25%)
Mutual labels:  load-testing
karate
Test Automation Made Simple
Stars: ✭ 6,384 (+39800%)
Mutual labels:  load-testing
artillery-engine-kinesis
Experimental AWS Kinesis support for Artillery 🕳
Stars: ✭ 12 (-25%)
Mutual labels:  load-testing
jmeter-aci-terraform
Scalable cloud load/stress testing pipeline solution with Apache JMeter and Terraform to dynamically provision and destroy the required infrastructure on Azure.
Stars: ✭ 114 (+612.5%)
Mutual labels:  load-testing
chef-load
chef-load - a tool for simulating load on a Chef Infra Server and/or a Chef Automate server
Stars: ✭ 30 (+87.5%)
Mutual labels:  load-testing

Yandex.Tank API

This is an HTTP server that controls Yandex.Tank execution. It allows the client to:

  • set a breakpoint before an arbitrary test stage (and reset it later)
  • launch Yandex.Tank and begin the test
  • upload files into the test working directory
  • terminate the launched Tank at an arbitrary moment
  • obtain the test status
  • download the artifacts in a safe manner, without interference to another tests

Start API server

by running yandex-tank-api-server [options...] in console

API-managed Tank

General information on Yandex.Tank installation and usage can be found in its documentation. This section covers the difference between console Tank and API-managed Tank configuration and provides more details on the sequence of the test stages.

Tank configuration

API-managed Tank is configured via configuration files only. They have the same syntax and options as the console Tank configs.

The configuration parameters are applied in the following order:

  1. common Yandex.Tank configuration files that reside in /etc/yandex-tank/
  2. Yandex.Tank API defaults in /etc/yandex-tank-api/defaults
  3. the configuration file sent by the client when launching the test
  4. Yandex.Tank API overriding configs in /etc/yandex-tank-api/override

Test stages

When the client launches a new test, a new session is created and a separate Tank worker process is spawned. After this, the test stages are executed in the following order:

  1. lock

    Attempt to acquire the tank lock. This stage fails if another test started via console is running.

  2. init

    Logging is set up and tank configuration files are read at this stage.

  3. configure

    The configure() method is called for each module. Most of the dynamic configuration is done here.

  4. prepare

    The prepare_test() method is called for each module. Heavy and time-consuming tasks (such as stpd-file generation and monitoring agent setup) are done here.

  5. start

    The start_test() method is called for each module. This should take as little time as possible. Load generation begins at this moment.

  6. poll

    Once per second the is_test_finished() method is called for each module. This stage ends when any of the modules requests to stop the test.

  7. end

    The end_test() method is called for each module. This should take as little time as possible.

  8. postprocess

    The post_process() method is called for each module. Heavy and time-consuming tasks are performed here.

  9. unlock

    The tank lock is released and the Tank worker exits.

  10. finished

 This is a virtual stage. Reaching this stage means that the Tank worker has already terminated.

The last session status is temporarily stored after tank exit. The test artifacts are stored forever and should be deleted by external means when not needed.

Pausing the test sequence

When the session is started, the client can specify the test stage before which the test will be paused (the breakpoint) . After completing the stages preceding the breakpoint, the Tank will wait until the breakpoint is moved further. You cannot move the breakpoint back.

The breakpoint can be set before any stage. One of the most frequent use cases is to set the breakpoint before the start stage to synchronize several tanks. Another is setting the breakpoint before the unlock stage to download the artifacts without interference to other tests. Third is setting the breakpoint before the init stage to upload additional files. Beware that setting the breakpoint between the init and the poll stages can lead to very exotic behaviour.

API requests

All API requests are asynchronous: we do not wait the tank process to perform requested action. HTTP code 200 is returned when no error occured while processing the request. However, this does not necessarily mean that the requested action will be successfully performed. The client should check the session status to detect Tank failures.

All handles, except for /artifact, return JSON. On errors this is a JSON object with a key 'reason'.

List of API requests

  1. POST /validate

Request body: Yandex.Tank config in .yaml format (the same as for console Tank)

Checks if config provided is valid within local defaults

Reply on success:

{
  "config": "<yaml string>", // your config
  "errors": [] // empty if valid
}

Error codes and corresponding reasons in the reply:

  • 400, 'Config is not a valid YAML.'
  1. POST /run?[test=...]&[break=...]

Request body: Yandex.Tank config in .yaml format (the same as for console Tank)

Creates a new session with an unique session ID and launches a new Tank worker.

Parameters:

  • test: Prefix of the session ID. Should be a valid directory name. Default: current datetime in the %Y%m%d%H%M%S format
  • break: the test stage before which the tank will stop and wait until the next break is set. Default: "finished"

Reply on success:

{
  "session": "20150625210015_0000000001", //ID of the launched session
  "test": "20150625210015_0000000001" //Deprecated, do not use
}

Error codes and corresponding reasons in the reply:

  • 400, 'Specified break is not a valid test stage name.'
  • 409, 'The test with this ID is already running.'
  • 409, 'The test with this ID has already finished.'
  • 503, 'Another session is already running.'
  1. GET /run?session=...&[break=...]

Sets a new break point for the running session.

Parameters:

  • session: session ID
  • break: the test stage before which the tank will stop and wait until the next break is set. Default: "finished"

Return codes and corresponding reasons:

  • 200, 'Will try to set break before [new break point]'
  • 400, 'Specified break is not a valid test stage name.'
  • 404, 'No session with this ID.'
  • 418, ... (returned when client tries to move the break point back)
  • 500, 'Session failed.'
  1. GET /stop?session=...

Terminates the current test.

Parameters:

  • session: ID of the session to terminate

Return codes and corresponding reasons:

  • 200, 'Will try to stop tank process.'
  • 404, 'No session with this ID.'
  • 409, 'This session is already stopped.'
  1. GET /status?session=...

Returns the status of the specified session. Parameters:

  • session: ID of the session.

Status examples:

{
  "status": "running",
  "stage_completed": true,
  "break": "start",
  "current_stage": "prepare",
  "test": "9f43f3104c2549b98bf74b817dc71cef",
  "failures": []
}
{
  "status": "failed", 
  "retcode": 1, 
  "stage_completed": true, 
  "break": "finished", 
  "current_stage": "finished", 
  "test": "9f43f3104c2549b98bf74b817dc71cef", 
  "failures": [
      {
          "reason": "Interrupted", 
          "stage": "prepare"
      }
  ]
}

Error code and the corresponding reason:

  • 404, 'No session with this ID.'
  1. GET /status?

Returns a JSON object where keys are known session IDs and values are the corresponding statuses.

  1. GET /artifact?session=...

Returns a JSON array of artifact filenames.

Parameters:

  • test: ID of the test

Error codes and the corresponding reasons:

  • 404, 'No test with this ID found.'
  • 404, 'Test was not performed, no artifacts.'
  1. GET /artifact?session=...&filename=...

Sends the specified artifact file to the client.

Parameters:

  • session: ID of the session
  • filename: the artifact file name

Error codes and the corresponding reasons:

  • 404, 'No session with this ID found'
  • 404, 'Test was not performed, no artifacts.'
  • 404, 'No such file'
  • 503, 'File is too large and test is running' (when the file size exceeds 128 kB and some test is running)
  1. POST /upload?session=...&filename=...

Stores the request body on the server in the tank working directory for the session under the specified filename. The session should be running.

Parameters:

  • session: ID of the session
  • filename: the name to store the file under

Error codes and the corresponding reasons:

  • 404, 'Specified session is not running'

Writing plugins

Some custom plugins might need to know if they are wokring in the console Tank or under API.

API worker process uses a subclass of a standard TankCore as a tank core. Thus, a plugin can detect execution under API by simply checking that

str(self.core.__class__)=='yandex_tank_api.worker.TankCore'
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].