You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-3Lines changed: 31 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,21 +17,22 @@ Please note that this tool is in the early development stage and should not be u
17
17
The project in its current form suits our short-term needs and will receive limited support. We encourage you to fork the project and extend it with additional functionality you might need.
18
18
19
19
## Development
20
-
You should install [pre-commit](https://pre-commit.com/) so that automated linting and formatting checks are performed before each commit.
20
+
You should install [pre-commit](https://pre-commit.com/) so that automated linting and formatting checks are performed before each commit.
21
21
22
22
Run:
23
23
```bash
24
24
pip install pre-commit
25
25
pre-commit install
26
26
```
27
27
### Running locally
28
-
1. Make sure you have python3 installed (>3.9.10)
28
+
1. Make sure you have python3 installed (>3.11)
29
29
2. Set up your python environment
30
30
```bash
31
31
pip3 install virtualenv
32
32
virtualenv venv
33
33
source venv/bin/activate
34
34
pip install -r requirements.txt
35
+
pip install -r requirements-dev.txt
35
36
```
36
37
1. Generate valid exporter config and validation file. For example see [config example](config/exporter_example/config.yml) and [validation example](config/exporter_example/validation.yml).
37
38
2. Export paths of generated configuration files relative to `src/exporter.py`:
@@ -53,8 +54,35 @@ export CONFIG_FILE_PATH="src/config.yml" # For example if we saved config file
53
54
3. Execute
54
55
```bash
55
56
docker-compose build
56
-
docker-compose-up
57
+
docker-composeup
57
58
curl localhost:8000/metrics # Exporter
58
59
curl localhost:3000 # Grafana
59
60
curl localhost:9090 # Prometheus
60
61
```
62
+
63
+
### Testing
64
+
Testing is performed using [pytest](https://docs.pytest.org/) run by [coverage.py](https://coverage.readthedocs.io/) to generate test coverage reporting.
65
+
[pylint](https://pylint.readthedocs.io/) is used to lint the pyhton code.
66
+
These dependencies can be found in the [requirements-dev.txt](requirements-dev.txt) file. Unit testing and linting is performed on every commit push to the repository. 90% test coverage and no linter errors/warnings are a requirement for the tests to pass.
67
+
68
+
#### Testing Locally (venv)
69
+
Tests can be run locally in the virtual environment.
70
+
1. Run the unit tests with coverage.py from within the `src` directory.
71
+
```bash
72
+
coverage run --branch -m pytest
73
+
```
74
+
2. Generate the coverage report. To view the report open the generated `index.html` file in a browser.
75
+
```bash
76
+
coverage html
77
+
```
78
+
3. Run the linter to find any errors/warnings.
79
+
```bash
80
+
pylint src/*py
81
+
```
82
+
83
+
#### Testing Locally (docker)
84
+
The tests and linter can be run using docker by building the `test` docker stage.
0 commit comments