Allow to set configuration via config file

Change-Id: I84307abb7600918a88cf001fa2ec7292f47a9d50
9 files changed
tree: 8085a726655a18632c07c622892389bece82c1c8
  1. container/
  2. efk/
  3. .pylintrc
  4. config.sample.yaml
  5. load-tester.deployment.yaml
  6. Pipfile
  7. Pipfile.lock
  8. README.md
README.md

Gerrit Load Testing

This project provides a tool to load test Gerrit by running a set of actions typically used by Gerrit users.

Requirements

  • Python 3
  • Pipenv [1]

Contribute

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.

Build

The tool is meant to be run in a container. To build this container, run:

docker build -t gerrit/loadtester ./container

Configuration

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:

keydescriptiondefault value
gerrit.urlURL of the Gerrit test serverhttp://localhost:8080
gerrit.userGerrit user used for testsadmin
gerrit.passwordPassword of Gerrit usersecret
testrun.durationDuration for which to run the testsnull (indefinitely)

Run

Docker

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 actions

Kubernetes

The 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/.

Links

[1] https://github.com/pypa/pipenv [2] https://github.com/psf/black [3] https://www.pylint.org/