forked from Yelp/paasta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
188 lines (174 loc) · 5.95 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
[tox]
skipsdist=True
envlist=py38-linux
docker_compose_version = 1.26.2
requires =
tox==3.28.0
[testenv]
basepython = python3.8
passenv = SSH_AUTH_SOCK PAASTA_ENV DOCKER_HOST CI
setenv =
TZ = UTC
deps =
--requirement={toxinidir}/requirements.txt
--requirement={toxinidir}/requirements-dev.txt
--editable={toxinidir}
commands =
# these are only available at yelp so we optionally install them so that internal devs don't need to
# manually do so (through pip or make)
# that said, most of the time people will run make test which will use tox to install these in a
# faster way - so this is really just here for anyone that like to just invoke
# `tox` directly and with no explicit env
-pip install -r yelp_package/extra_requirements_yelp.txt
[testenv:dev-api]
envdir = .tox/py38-linux/
passenv = PAASTA_TEST_CLUSTER KUBECONFIG PAASTA_SYSTEM_CONFIG_DIR
deps =
--requirement={toxinidir}/requirements.txt
--requirement={toxinidir}/requirements-dev.txt
--requirement={toxinidir}/yelp_package/extra_requirements_yelp.txt
--editable={toxinidir}
commands =
python -m paasta_tools.run-paasta-api-in-dev-mode
[testenv:playground-api]
envdir = .tox/py38-linux/
passenv = PAASTA_TEST_CLUSTER KUBECONFIG PAASTA_SYSTEM_CONFIG_DIR PAASTA_API_SOA_DIR USER
setenv =
KUBECONFIG = ./k8s_itests/kubeconfig
PAASTA_TEST_CLUSTER = kind-{env:USER}-k8s-test
PAASTA_SYSTEM_CONFIG_DIR = ./etc_paasta_playground/
PAASTA_API_SOA_DIR = ./soa_config_playground
deps =
--requirement={toxinidir}/requirements.txt
--requirement={toxinidir}/requirements-dev.txt
--requirement={toxinidir}/yelp_package/extra_requirements_yelp.txt
--editable={toxinidir}
commands =
python -m paasta_tools.run-paasta-api-playground
[testenv:tests]
envdir = .tox/py38-linux/
commands =
check-requirements -vv
pre-commit install -f --install-hooks
pre-commit run --all-files
coverage erase
coverage run -m py.test {posargs:tests}
coverage report -m
[testenv:tests-yelpy]
envdir = .tox/py38-linux/
deps =
--requirement={toxinidir}/requirements.txt
--requirement={toxinidir}/requirements-dev.txt
--requirement={toxinidir}/yelp_package/extra_requirements_yelp.txt
--editable={toxinidir}
commands =
check-requirements -vv
pre-commit install -f --install-hooks
pre-commit run --all-files
coverage erase
coverage run -m py.test {posargs:tests}
coverage report -m
[testenv:docs]
commands =
/bin/rm -rf docs/source/generated/
# The last arg to apidoc is a list of excluded paths
sphinx-apidoc -f -e -o docs/source/generated/ paasta_tools
sphinx-build -j auto -b html -d docs/build/doctrees docs/source docs/build/html
[testenv:k8s_itests]
basepython = python3.8
whitelist_externals = bash
# one day we'll use a fully pinned venv here...
deps =
urllib3<2.0
requests<2.32.0 # required for older docker-py (<=7.0.0) to function: https://github.com/psf/requests/issues/6707
cryptography<42
docker-compose=={[tox]docker_compose_version}
setenv =
passenv =
KIND_CLUSTER
KUBECONFIG
KUBECONTEXT
PAASTA_SYSTEM_CONFIG_DIR
SOA_DIR
PAASTA_API_PORT
KUBE_RESOURCE_DIR
USER
PAASTA_CONFIG_DIR
DOCKER_TLS_VERIFY
DOCKER_HOST
DOCKER_CERT_PATH
INDEX_URL_BUILD_ARG
changedir=k8s_itests/
commands =
# Build /etc/paasta used by docker-compose
{toxinidir}/k8s_itests/scripts/setup.sh
# Run paasta-tools k8s_itests in docker
docker-compose down
docker-compose --verbose build --parallel --build-arg DOCKER_REGISTRY={env:DOCKER_REGISTRY:docker-dev.yelpcorp.com/} --build-arg {env:INDEX_URL_BUILD_ARG:UNUSED}=https://pypi.org/simple
docker-compose up \
--abort-on-container-exit
[testenv:example_cluster]
changedir=example_cluster/
passenv = DOCKER_TLS_VERIFY DOCKER_HOST DOCKER_CERT_PATH INDEX_URL_BUILD_ARG
deps =
docker-compose=={[tox]docker_compose_version}
commands =
docker-compose down
docker-compose --verbose build --build-arg DOCKER_REGISTRY={env:DOCKER_REGISTRY:docker-dev.yelpcorp.com/} --build-arg PIP_INDEX_URL={env:PIP_INDEX_URL:https://pypi.yelpcorp.com/simple}
# Fire up the mesos cluster in background
# Run the paastatools container in foreground to catch the output
# the `docker-compose run` vs `docker-compose up` is important here, as docker-compose run will
# exit with the right code.
#
# dnephin says we need the --rm otherwise these containers won't be cleaned
# up. I guess we only need this for run'd containers, not up'd containers?
# IDK, the docs don't really specify.
docker-compose run --rm playground ./example_cluster/example-cluster-test.sh
docker-compose stop
docker-compose rm --force
[testenv:general_itests]
basepython = python3.8
setenv =
PAASTA_SYSTEM_CONFIG_DIR = {toxinidir}/general_itests/fake_etc_paasta
changedir=general_itests/
passenv = DOCKER_TLS_VERIFY DOCKER_HOST DOCKER_CERT_PATH DOCKER_REGISTRY
deps =
{[testenv]deps}
behave==1.2.5
commands =
# TODO: upgrade behave if they ever take this reasonable PR
pip install git+https://github.com/Yelp/[email protected]_533-fork
pylint -E {toxinidir}/paasta_tools/mesos/ --ignore master.py,task.py
behave {posargs}
[testenv:mypy]
basepython = python3.8
deps =
{[testenv]deps}
mypy==0.720
setenv =
MYPYPATH = {toxinidir}
ignore_errors = True
whitelist_externals =
/bin/sh
mypy_paths =
paasta_tools
tests/frameworks
tests/test_kubernetes_tools.py
tests/test_long_running_service_tools.py
tests/test_setup_kubernetes_job.py
tests/test_setup_prometheus_adapter_config.py
tests/test_secret_tools.py
tests/secret_providers/test_secret_providers.py
tests/secret_providers/test_vault.py
tests/test_utils.py
commands =
mypy {posargs:{[testenv:mypy]mypy_paths}}
[testenv:install-hooks]
basepython = python3.8
deps = pre-commit
commands = pre-commit install -f --install-hooks
[flake8]
max-line-length = 120
extend-ignore = E501,E203,W503
[pep8]
ignore = E265,E501