commit | 18c8af1920072e3cd51efcbd39d8402da28c8794 | [log] [tgz] |
---|---|---|
author | Thomas Draebing <thomas.draebing@sap.com> | Tue Sep 24 14:43:12 2019 +0200 |
committer | Matthias Sohn <matthias.sohn@sap.com> | Mon Nov 11 17:11:44 2019 -0800 |
tree | 22985f49c36a0effbba125ecfe70be0b2847b2a0 | |
parent | 23ed1b1f16aebf1d2057150ca5282f8221125465 [diff] |
Parse config recursively So far the config was only parsed two levels deep, not allowing to apply defaults deeper than that. This would lead to issues as soon as there is for example a second parameter for each action that can be configured. Now the parser goes through the config recursively allowing an indefinite depth of the config dictionary. Change-Id: I7a0eed1e0266dbe52b19716df81e93881dceebf7
This project provides a tool to load test Gerrit by running a set of actions typically used by Gerrit users.
The python scripts are formatted using black
[2]. The code style is further checked by pylint
[3].
To install the tools, run:
pipenv install --dev
To lint the files, run:
pipenv run black $(find . -name '*.py') && pipenv run pylint $(find . -name '*.py')
Black will automatically format all python-files. Pylint, however, will not automatically fix issues in the code. Please fix the issues pylint is showing or in reasonable cases disable the respective rules in a reasonable scope.
The tool is meant to be run in a container. To build this container, run:
docker build -t gerrit/loadtester ./container
A configuration file in yaml-format can be used to configure the test run. The config.sample.yaml
-file gives an example-configuration.
The single configuration values are listed here:
key | description | default value |
---|---|---|
gerrit.url | URL of the Gerrit test server | http://localhost:8080 |
gerrit.user | Gerrit user used for tests | admin |
gerrit.password | Password of Gerrit user | secret |
testrun.duration | Duration for which to run the tests | null (indefinitely) |
actions.* | Probability with which an action is performed in each cycle (0 : never, 1 : always) | 1 |
The following actions can be performed by the tests:
key | description |
---|---|
clone_project | Test performs a clone of a project, that is assigned to the simulated user |
create_project | Test creates a new project via REST |
fetch_project | Test fetches a project, that is assigned to the simulated user and was already cloned |
push_for_review | Test creates random commits in a cloned project and pushes them to refs/for/master |
push_to_branch | Test creates random commits in a cloned project and pushes them to the remote's master |
query_changes | Queries changes via REST |
query_projects | Queries projects via REST |
review_change | Reviews a change via REST |
To run an instance of the load tester. run:
docker run -it gerrit/loadtester \ --config $CONFIG_FILE \ --duration $TEST_DURATION \ --password $GERRIT_PWD \ --url $GERRIT_URL \ --user $GERRIT_USER
The options are:
--config
(default: None
): Path to a config file (optional). The config file has to be present in the container, either by building it in or by mounting it. Parameters will overwrite configuration from file.--duration
(default: None
): Duration, for which to run the tests in seconds (optional; if not set, test runs until stopped)--password
(default: secret
): Password of Gerrit user used for executing actions--url
: URL of Gerrit (REQUIRED; e.g. https://gerrit.example.com
)--user
(default: admin
): User to be used for executing actionsThe docker containers may be used to run the load tests in Kubernetes to simulate multiple users (each instance acts as a single user). This project provides an example deployment yaml: ./load-tester.deployment.yaml
. Further, an example deployment for a logging stack based on ElasticSearch, FluentBit and Kibana to collect the logs created by the load testing scripts is provided in ./efk/
.
[1] https://github.com/pypa/pipenv [2] https://github.com/psf/black [3] https://www.pylint.org/