This docker-locust allows you to run locust.io in any CI tools e.g. Jenkins and generate HTML report at the end of load test.
- docker-compose version 1.6.0+
Run the application with the command:
local.sh deploy
You will be prompted for certain inputs required
Target url: https://targeturl.com
Path of load testing script: example/simple.py
Number of slave(s): 5
Run type [automatic/manual]: manual
Or you can simplify it with following command:
local.sh deploy https://targeturl.com example/simple.py 5 manual
Note: The load test script will be automatically saved in Docker image when the given command above is executed.
Simply after load test run, append "/htmlreport" to the URL which will download the report of the recent run. Example:
docker-locust can be run automatically by using CI tool like jenkins.
Sample case:
- Target url: https://targeturl.com
- Number of slaves: 5
- Number of users [total users that will be simulated]: 100
- Hatch rate [number of user will be added per second]: 5
- Duration [in seconds]: 20
Steps:
-
Put following command in "Execute shell" field:
(echo 100 && echo 5 && echo 30) | bash local.sh deploy https://targeturl.com example/simple.py 5 automatic
-
Install html-publisher-plugin in jenkins to display load test result. Example configuration in jenkins job:
Run the unit tests with this command:
local.sh test
All output from containers can be see by running:
docker-compose logs -f