The load testing project for the [azure-databricks-operator](https://github.com/microsoft/azure-databricks-operator/) can be found under `/locust`. Tests are built and run using the python [Locust load testing framework](https://docs.locust.io/en/stable/index.html).
## Table of contents <!-- omit in toc -->
- [Load testing with locust](#load-testing-with-locust)
Tests are written using `pytest`. More information [is available here](https://docs.pytest.org/en/latest/).
> Before proceeding make sure your container or environment is up and running
1. Run the tests from the root of the project
```bash
make test-locust
```
2. All being well you should see the following output:
```bash
============================================================================================= test session starts ==============================================================================================
platform linux -- Python 3.7.4, pytest-5.3.2, py-1.8.0, pluggy-0.13.1
> Note: If one of these port-forwards stops working use `ps aux | grep kubectl` and look for the process id of the one thats broken then use `kill 21283` (your id in there) to stop it. Then rerun the port-forward command
-`/locust_files/db_locust` contains all files related to how Locust can interact with Databricks using K8s via the [azure-databricks-operator](https://github.com/microsoft/azure-databricks-operator/)
-`db_locust`: The brain of the behaviour driven tests. Inherits from the default `Locust`, read more [here](https://docs.locust.io/en/stable/testing-other-systems.html)
-`db_client.py`: Core client used by the `db_locust`. It is a wrapper of "sub" clients that interface to specific databricks operator Kinds
-`db_run_client.py`: all actions relating to `run` api interfaces
- More clients to be added - ***this is where the majority of contributions will be made***
-`db_decorator.py`: A simple decorator for Databricks operations that gives basic metric logging and error handling
Best way I've found is to import the JSON for the board into the Grafana instance, edit it using the UI then export it back to JSON and update the file in the repo.
The endpoint is exposed at `/export/prometheus`. When running the tests with the web endpoints enabled, you can visit <http://localhost:8089/export/prometheus> to see the exported stats.
- When the port you're forwarding your Locust server to is not exposed from the container, you cannot hit it from your localhost machine. Use the [VSCode temporary port-forwarding](https://code.visualstudio.com/docs/remote/containers#_temporarily-forwarding-a-port) to resolve this.