Note: This requires Python version 3.10+
The tests can execute in three modes:
- Direct access: use a known master secret
- Firefox accounts OAuth: create test accounts and use OAuth JWTs
- Self-signed JWT: generate and sign JWTs locally with a given private key
To run the syncstorage load tests, you'll need a Python >=3.10 development environment with Poetry installed. You can also directly use poetry run to execute commands as described in the usage examples below.
The easiest solution is to use pyenv and the pyenv-virtualenv plugin for your virtual environments as a way to isolate the dependencies from other projects.
-
Install
pyenvusing the latest documentation for your platform. -
Follow the instructions to install the
pyenv-virtualenvplugin. See the pyenv-virtualenv documentation. -
Ensure you've added
pyenvandpyenv-virtualenvto your PATH.Example:
export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)"
-
Install Python version, create virtualenv, activate and install dependencies from inside the project directory.
Note: You can skip creating a virtual environment and invoke commands directly using
poetry run.$ cd syncstorage-loadtest # Install Python 3.10+ $ pyenv install 3.10 # Create named, associated virtualenv $ pyenv virtualenv 3.10 syncstorage-loadtest # or whatever name you prefer $ pyenv local syncstorage-loadtest # activates virtual env whenever you enter this directory # Install Poetry and dependencies $ pip install poetry $ poetry install
-
Once you're in your virtual environment, run the load tests using:
poetry run molotov [options] loadtest.py
If you already have Poetry installed:
poetry installWith a known syncstorage master secret:
SERVER_URL="http://localhost:8000#secretValue" poetry run molotov --max-runs 5 -cxv loadtest.pyWith FxA stage accounts:
SERVER_URL="https://token.stage.mozaws.net" \
FXA_API_HOST="https://api-accounts.stage.mozaws.net" \
FXA_OAUTH_HOST="https://oauth.stage.mozaws.net" \
poetry run molotov --workers 3 --duration 60 -v loadtest.pyAssuming an RSA keypair was generated, the private key pem was saved and accessible, and the token server was started with the public key JWK configured. The presence of OAUTH_PRIVATE_KEY_FILE triggers this mode when using OAuth.
Run with self-signed JWTs:
SERVER_URL="http://localhost:8000" \
OAUTH_PRIVATE_KEY_FILE="/path/to/load_test.pem" \
poetry run molotov --workers 100 --duration 300 -v loadtest.pyTo run it inside docker:
docker run -e TEST_REPO=https://github.com/mozilla-services/syncstorage-loadtest -e TEST_NAME=test tarekziade/molotov:latestHappy Breaking!