2021-11-23 08:30:38 +00:00
|
|
|
[tox]
|
2022-08-18 11:31:47 +00:00
|
|
|
envlist =
|
|
|
|
lint,
|
|
|
|
jsonnet-{check,lint,fix},
|
|
|
|
jsonnet-bundler-{install,update},
|
|
|
|
promql-query-{test,lint},
|
2023-04-02 02:28:16 +00:00
|
|
|
alerts-{fix,check,lint,test}
|
|
|
|
|
2021-11-23 08:30:38 +00:00
|
|
|
skipsdist = true
|
|
|
|
|
|
|
|
[testenv:jsonnet-bundler-{install,update}]
|
2022-12-08 06:53:33 +00:00
|
|
|
allowlist_externals =
|
2021-11-23 08:30:38 +00:00
|
|
|
jb
|
|
|
|
description =
|
|
|
|
install: Install the jsonnet dependencies
|
|
|
|
update: Update the jsonnet dependencies
|
|
|
|
commands =
|
|
|
|
install: jb install
|
|
|
|
update: jb update
|
|
|
|
|
|
|
|
[testenv:jsonnet-{check,fix,lint}]
|
|
|
|
basepython = python3
|
2022-12-08 06:53:33 +00:00
|
|
|
allowlist_externals =
|
2021-11-23 08:30:38 +00:00
|
|
|
find
|
|
|
|
jb
|
|
|
|
jsonnet
|
2023-04-02 02:28:16 +00:00
|
|
|
jsonnetfmt
|
2021-11-23 08:30:38 +00:00
|
|
|
sh
|
2024-01-26 14:05:52 +00:00
|
|
|
./lint-jsonnet.sh
|
2021-11-23 08:30:38 +00:00
|
|
|
description =
|
|
|
|
check: Ensure that auto-generated files matches the current version
|
2022-08-16 13:38:18 +00:00
|
|
|
fix: Update generated files from jsonnet file with latest changes
|
2021-11-23 08:30:38 +00:00
|
|
|
lint: Test if jsonnet files are linted (without any update)
|
|
|
|
deps =
|
|
|
|
-rrequirements-grafonnet.txt
|
|
|
|
depends = jsonnet-bundler-install
|
|
|
|
commands =
|
|
|
|
check: sh test-jsonnet.sh
|
|
|
|
lint: ./lint-jsonnet.sh --test
|
|
|
|
fix: jsonnet -J vendor -m dashboards_out dashboards.jsonnet
|
|
|
|
|
|
|
|
[testenv:lint]
|
|
|
|
description =
|
|
|
|
Run python linters
|
|
|
|
deps =
|
|
|
|
-rrequirements-lint.txt
|
|
|
|
setenv =
|
|
|
|
commands =
|
|
|
|
pylint --rcfile=.pylintrc tests_dashboards
|
|
|
|
mypy tests_dashboards
|
|
|
|
isort tests_dashboards
|
|
|
|
|
|
|
|
[testenv:promql-query-test]
|
|
|
|
description =
|
|
|
|
lint: Run promtool check on grafana queries
|
|
|
|
test: Run promtool unit testing on grafana queries.
|
|
|
|
deps =
|
|
|
|
-rrequirements-lint.txt
|
|
|
|
depends = grafonnet-check
|
|
|
|
setenv =
|
2022-12-08 06:53:33 +00:00
|
|
|
allowlist_externals =
|
2021-11-23 08:30:38 +00:00
|
|
|
promtool
|
|
|
|
commands =
|
|
|
|
behave tests_dashboards/features
|
|
|
|
|
2023-04-02 02:28:16 +00:00
|
|
|
[testenv:alerts-{fix,check,lint,test}]
|
2021-11-23 08:30:38 +00:00
|
|
|
deps =
|
|
|
|
-rrequirements-alerts.txt
|
|
|
|
pytest
|
|
|
|
depends = grafonnet-check
|
2022-12-08 06:53:33 +00:00
|
|
|
allowlist_externals =
|
2021-11-23 08:30:38 +00:00
|
|
|
promtool
|
2023-04-02 02:28:16 +00:00
|
|
|
jsonnet
|
2021-11-23 08:30:38 +00:00
|
|
|
commands =
|
2022-08-16 13:38:18 +00:00
|
|
|
fix: jsonnet -J vendor -S alerts.jsonnet -o prometheus_alerts.yml
|
2022-02-07 10:53:29 +00:00
|
|
|
lint: promtool check rules prometheus_alerts.yml
|
2021-11-23 08:30:38 +00:00
|
|
|
test: pytest -rA tests_alerts/test_syntax.py tests_alerts/test_unittests.py
|
|
|
|
python3 ./tests_alerts/validate_rules.py
|