-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtox.ini
164 lines (147 loc) · 5.24 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
[tox]
no_package = True
skip_missing_interpreters = True
env_list = lint, unit
[vars]
application = kafka-bundle
src_path = {tox_root}
tests_path = {tox_root}/tests
lib_path = {tox_root}/lib
all_path = {tox_root} {[vars]src_path} {[vars]tests_path}
tf_path = {tox_root}/terraform
[testenv]
allowlist_externals =
/bin/bash
/var/lib/snapd/snap/bin/juju
/var/lib/snapd/snap/bin/juju-wait
poetry
terraform
cp
whitelist_externals =
poetry
terraform
set_env =
PYTHONPATH = {tox_root}/lib:{[vars]src_path}
PYTHONBREAKPOINT=ipdb.set_trace
PY_COLORS=1
pass_env =
PYTHONPATH
CHARM_BUILD_DIR
MODEL_SETTINGS
BUILD_DIRECTORY
FOLDER
TLS
deps =
poetry
[testenv:format]
description = Apply coding style standards to code
commands =
poetry install
poetry export -f requirements.txt -o requirements.txt
poetry install --only fmt
poetry run ruff check --fix {[vars]tests_path} --extend-exclude {tox_root}/tests/integration/bundle/app-charm/*.py
poetry run black {[vars]tests_path}
terraform fmt {[vars]tf_path}
[testenv:lint]
description = Check code against coding style standards
commands =
poetry install --only lint
poetry run codespell {tox_root} \
--skip {tox_root}/.git \
--skip {tox_root}/.tox \
--skip {tox_root}/build \
--skip {tox_root}/lib \
--skip {tox_root}/venv \
--skip {tox_root}/tests/integration/bundle/app-charm/lib \
--skip {tox_root}/.mypy_cache \
--skip {tox_root}/poetry.lock \
--skip {tox_root}/icon.svg \
--skip {tox_root}/terraform/dev
poetry run ruff check {[vars]tests_path} --extend-exclude {tox_root}/tests/integration/bundle/app-charm/*.py
poetry run black --check --diff {[vars]tests_path}
[testenv:render]
description = Check code against coding style standards
pass_env =
BUILD_DIRECTORY
FOLDER
TLS
commands =
poetry install --only render
poetry run jinja2 -D tls={env:TLS} {env:FOLDER}/bundle.yaml.j2 -o {env:BUILD_DIRECTORY}/bundle.yaml
cp {env:FOLDER}/charmcraft.yaml {env:BUILD_DIRECTORY}
cp {env:FOLDER}/metadata.yaml {env:BUILD_DIRECTORY}
cp {env:FOLDER}/README.md {env:BUILD_DIRECTORY}
[testenv:integration-terraform]
description = Run vm integration tests using Terraform
set_env =
{[testenv]set_env}
# Workaround for https://github.com/python-poetry/poetry/issues/6958
POETRY_INSTALLER_PARALLEL = false
pass_env =
{[testenv]pass_env}
CI
commands =
poetry install --with integration
poetry run pytest -vv tests/integration/terraform/ --tb native --log-cli-level=INFO -s {posargs}
[testenv:integration-bundle]
description = Run vm bundle integration tests
set_env =
{[testenv]set_env}
# Workaround for https://github.com/python-poetry/poetry/issues/6958
POETRY_INSTALLER_PARALLEL = false
pass_env =
{[testenv]pass_env}
CI
commands =
poetry install --with integration
poetry run pytest -vv tests/integration/bundle/ --tb native --log-cli-level=INFO -s {posargs}
[testenv:integration-e2e]
description = Run vm e2e integration tests. Add `--tls` to specify tls tests. Add `--model=<MODEL> --no-deploy` to run on existing deployments.
set_env =
{[testenv]set_env}
# Workaround for https://github.com/python-poetry/poetry/issues/6958
POETRY_INSTALLER_PARALLEL = false
pass_env =
{[testenv]pass_env}
CI
commands =
poetry install --with integration
poetry run pytest -vv tests/integration/e2e/test_e2e.py --tb native --ignore={[vars]tests_path} --log-cli-level=INFO -s {posargs}
[testenv:integration-e2e-basic-flow]
description = Run vm e2e integration tests. Add `--tls` to specify tls tests. Add `--model=<MODEL> --no-deploy` to run on existing deployments.
set_env =
{[testenv]set_env}
# Workaround for https://github.com/python-poetry/poetry/issues/6958
POETRY_INSTALLER_PARALLEL = false
pass_env =
{[testenv]pass_env}
CI
commands =
poetry install --with integration
poetry run pytest -vv tests/integration/e2e/test_basic_flow.py --tb native --ignore={[vars]tests_path} --log-cli-level=INFO -s {posargs}
[testenv:integration-e2e-password-rotation]
description = Run vm e2e integration tests. Add `--tls` to specify tls tests. Add `--model=<MODEL> --no-deploy` to run on existing deployments.
set_env =
{[testenv]set_env}
# Workaround for https://github.com/python-poetry/poetry/issues/6958
POETRY_INSTALLER_PARALLEL = false
pass_env =
{[testenv]pass_env}
CI
commands =
poetry install --with integration
poetry run pytest -vv tests/integration/e2e/test_password_rotation.py --tb native --ignore={[vars]tests_path} --log-cli-level=INFO -s {posargs}
[testenv:integration-e2e-backup]
description = Run vm e2e integration tests. Add `--tls` to specify tls tests. Add `--model=<MODEL> --no-deploy` to run on existing deployments.
set_env =
{[testenv]set_env}
# Workaround for https://github.com/python-poetry/poetry/issues/6958
POETRY_INSTALLER_PARALLEL = false
pass_env =
{[testenv]pass_env}
CI
commands =
poetry install --with integration
poetry run pytest -vv tests/integration/e2e/test_backup.py --tb native --ignore={[vars]tests_path} --log-cli-level=INFO -s {posargs}