Run perltidy on debug tools
[transportpce.git] / tox.ini
1 [tox]
2 minversion = 3.7.0
3 envlist = buildcontroller
4      testsPCE,
5      sims121,build_karaf_tests121,tests121,
6      sims221,build_karaf_tests221,tests_tapi,tests221,
7      sims71,build_karaf_tests71,tests71,
8      build_karaf_tests_hybrid,tests_hybrid,
9      buildlighty,
10      docs
11      docs-linkcheck
12      checkbashisms
13      pre-commit
14      pylint
15 skipsdist = true
16 setupdir = tests/
17
18 [testenv]
19 passenv = USE_LIGHTY, NO_ODL_STARTUP, http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY, no_proxy, NO_PROXY, OLM_TIMER1, OLM_TIMER2
20 setenv =
21 #    USE_LIGHTY=True,
22     OLM_TIMER1=3000
23     OLM_TIMER2=2000
24
25 usedevelop = true
26 basepython = python3
27 deps =
28   -r{toxinidir}/tests/requirements.txt
29   -r{toxinidir}/tests/test-requirements.txt
30   setuptools>=7.0
31 changedir = {toxinidir}/tests
32 parallel_show_output = true
33
34 [testenv:buildcontroller]
35 allowlist_externals = build_controller.sh
36 commands =
37   ./build_controller.sh
38
39 [testenv:buildlighty]
40 allowlist_externals = build.sh
41 depends = buildcontroller,tests_hybrid
42 changedir = {toxinidir}/lighty
43 commands =
44   ./build.sh
45
46 [testenv:sims121]
47 allowlist_externals = install_honeynode.sh
48 depends = buildcontroller
49 # sims profiles does not strictly depends on buildcontroller
50 # but this dependency avoids race condition in the gate
51 commands =
52   ./install_honeynode.sh 1.2.1
53
54 [testenv:sims221]
55 allowlist_externals = install_honeynode.sh
56 depends = buildcontroller
57 commands =
58   ./install_honeynode.sh 2.2.1
59
60 [testenv:sims71]
61 allowlist_externals = install_honeynode.sh
62 depends = buildcontroller
63 commands =
64   ./install_honeynode.sh 7.1
65
66 [testenv:testsPCE]
67 depends = buildcontroller
68 #the following lines retrieve unofficial package of GNPy with REST support from Orange opensource Gitlab repo
69 setenv =
70     PIP_EXTRA_INDEX_URL = https://gitlab.com/api/v4/projects/33090323/packages/pypi/simple
71 #    USE_LIGHTY=True
72 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
73 deps =
74   -r{toxinidir}/tests/requirements.txt
75   -r{toxinidir}/tests/test-requirements.txt
76   setuptools>=7.0
77   gnpy4tpce==2.4.7
78 allowlist_externals = launch_tests.sh
79 passenv = LAUNCHER, USE_LIGHTY, NO_ODL_STARTUP, USE_ODL_RESTCONF_VERSION
80 basepython = python3
81 commands =
82   ./launch_tests.sh pce {posargs:}
83
84 [testenv:build_karaf_tests121]
85 depends = buildcontroller
86 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
87 allowlist_externals = launch_tests.sh
88 passenv = LAUNCHER, USE_LIGHTY
89 setenv =
90 #    USE_LIGHTY=True
91     USE_ODL_ALT_KARAF_ENV=./karaf121.env
92     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
93 commands =
94   ./build_karaf_for_tests.sh
95
96 [testenv:tests121]
97 depends = buildcontroller,build_karaf_tests121,sims121,testsPCE
98 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
99 allowlist_externals = launch_tests.sh
100 passenv = LAUNCHER, USE_LIGHTY, NO_ODL_STARTUP, USE_ODL_RESTCONF_VERSION
101 setenv =
102 #    USE_LIGHTY=True
103 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
104     USE_ODL_ALT_KARAF_ENV=./karaf121.env
105     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
106 commands =
107   ./launch_tests.sh 1.2.1 {posargs:}
108 # By default, all tests in the folder transportpce_tests/1.2.1/ are run.
109 # Though, a restricted list of tests can be passed as argument to 'tox -e tests121'.
110 # For example, 'tox -e tests121 portmapping' will run only the portmapping test.
111 # and 'tox -e tests121 "portmapping pce"' will run the portmapping and pce tests.
112 # Additionnally, a different launcher command than 'nosetests --with-xunit' can be
113 # used by exporting the variable LAUNCHER. For example 'export LAUNCHER="python3"'
114 # which is more verbose than nose or 'export LAUNCHER="ls -l"' to only list script
115 # files attributes.
116
117 [testenv:build_karaf_tests221]
118 depends = buildcontroller
119 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
120 allowlist_externals = launch_tests.sh
121 passenv = LAUNCHER, USE_LIGHTY
122 setenv =
123 #    USE_LIGHTY=True
124     USE_ODL_ALT_KARAF_ENV=./karaf221.env
125     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
126 commands =
127   ./build_karaf_for_tests.sh
128
129 [testenv:tests221]
130 depends = buildcontroller,build_karaf_tests221,sims221,tests71
131 # tests71 dependency is only here to chain tests in the gate and avoid ressources starvation
132 allowlist_externals = launch_tests.sh
133 passenv = LAUNCHER, USE_LIGHTY, NO_ODL_STARTUP, USE_ODL_RESTCONF_VERSION
134 setenv =
135 #    USE_LIGHTY=True
136 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
137     USE_ODL_ALT_KARAF_ENV=./karaf221.env
138     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
139 commands =
140   ./launch_tests.sh 2.2.1 {posargs:}
141
142 [testenv:build_karaf_tests71]
143 depends = buildcontroller
144 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
145 allowlist_externals = launch_tests.sh
146 passenv = LAUNCHER, USE_LIGHTY
147 setenv =
148 #    USE_LIGHTY=True
149     USE_ODL_ALT_KARAF_ENV=./karaf71.env
150     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
151 commands =
152   ./build_karaf_for_tests.sh
153
154 [testenv:tests71]
155 depends = buildcontroller,build_karaf_tests71,sims71,tests_tapi
156 allowlist_externals = launch_tests.sh
157 passenv = LAUNCHER, USE_LIGHTY, NO_ODL_STARTUP, USE_ODL_RESTCONF_VERSION
158 setenv =
159 #    USE_LIGHTY=True
160 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
161     USE_ODL_ALT_KARAF_ENV=./karaf71.env
162     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
163 commands =
164   ./launch_tests.sh 7.1 {posargs:}
165
166 [testenv:build_karaf_tests_hybrid]
167 depends = buildcontroller
168 allowlist_externals = launch_tests.sh
169 passenv = LAUNCHER, USE_LIGHTY
170 setenv =
171 #    USE_LIGHTY=True
172     USE_ODL_ALT_KARAF_ENV=./karaf121.env
173     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
174 commands =
175   ./build_karaf_for_tests.sh
176
177 [testenv:tests_hybrid]
178 depends = buildcontroller,build_karaf_tests_hybrid,sims121,sims221,sims71,tests121,tests221,tests71
179 #the last dependency is to avoid temporarily concurrent ressources problem in parallel mode
180 allowlist_externals = launch_tests.sh
181 passenv = LAUNCHER, USE_LIGHTY, NO_ODL_STARTUP, USE_ODL_RESTCONF_VERSION
182 setenv =
183 #    USE_LIGHTY=True
184 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
185     USE_ODL_ALT_KARAF_ENV=./karaf121.env
186     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
187 commands =
188 #  nosetests --with-xunit transportpce_tests/hybrid/test01_device_change_notifications.py
189   ./launch_tests.sh hybrid {posargs:}
190
191 [testenv:tests_tapi]
192 depends = buildcontroller,build_karaf_tests221,sims221
193 allowlist_externals = launch_tests.sh add_tapi_feature_to_tests221.sh
194 passenv = LAUNCHER, USE_LIGHTY, NO_ODL_STARTUP, OLM_TIMER1, OLM_TIMER2, USE_ODL_RESTCONF_VERSION
195 setenv =
196 #    USE_LIGHTY=True
197 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
198     USE_ODL_ALT_KARAF_ENV=./karaf221.env
199     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
200     INSTALL_TAPI=True
201     OLM_TIMER1=3000
202     OLM_TIMER2=2000
203
204 commands =
205 #  ./add_tapi_feature_to_tests221.sh
206   ./launch_tests.sh tapi {posargs:}
207
208 [testenv:with_docker]
209 depends = buildcontroller,sims221
210 allowlist_externals = launch_tests.sh
211                       dockercmd.sh
212 passenv = LAUNCHER, USE_LIGHTY, NO_ODL_STARTUP, USE_ODL_RESTCONF_VERSION, OLM_TIMER1 OLM_TIMER2
213 setenv =
214     OLM_TIMER1=3000
215     OLM_TIMER2=2000
216     INSTALL_TAPI=True
217     INSTALL_NBINOTIFICATIONS=True
218 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
219
220 commands =
221   ./dockercmd.sh run -d -p 2181:2181 -p 9092:9092 --env ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 --name tpce_kafka1 teivah/kafka:2.0.0
222   ./launch_tests.sh with_docker {posargs:}
223   ./dockercmd.sh container rm -f tpce_kafka1
224
225 [testenv:docs]
226 passenv = http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY, no_proxy, NO_PROXY
227 basepython = python3
228 deps = -rdocs/requirements.txt
229 commands =
230     sphinx-build -q -W --keep-going -b html -n -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/html
231
232 [testenv:docs-linkcheck]
233 passenv = http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY, no_proxy, NO_PROXY
234 basepython = python3
235 deps = -rdocs/requirements.txt
236 commands = sphinx-build -q -b linkcheck -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/linkcheck
237
238 [testenv:checkbashisms]
239 deps =
240 allowlist_externals = sh
241                       checkbashisms
242                       sudo
243                       find
244 commands =
245     sh -c 'command checkbashisms>/dev/null || sudo yum install -y devscripts-checkbashisms || sudo yum install -y devscripts-minimal || sudo yum install -y devscripts \
246         || sudo yum install -y https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Everything/x86_64/os/Packages/d/devscripts-checkbashisms-2.19.6-2.fc31.x86_64.rpm \
247         || (echo "checkbashisms command not found - please install it \
248              (e.g. sudo apt-get install devscripts | yum install devscripts-minimal )" >&2 && exit 1)'
249     find . -not -path '*/\.*' -name *.sh -exec checkbashisms -f  \{\} +
250
251 [testenv:spelling]
252 basepython = python3
253 deps =
254     -rdocs/requirements.txt
255     sphinxcontrib-spelling
256     PyEnchant
257 commands = sphinx-build -b spelling -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/spelling
258
259 [testenv:autopep8]
260 basepython = python3
261 deps = autopep8
262 commands =
263     autopep8 --max-line-length 120 --in-place --recursive transportpce_tests/
264
265 [testenv:pylint_full]
266 basepython = python3
267 deps = pylint>=2.6.0
268 allowlist_externals = find
269 commands =
270     find transportpce_tests/ -name *.py -exec pylint --fail-under=9.22 --max-line-length=120 --disable=missing-docstring --module-rgx="([a-z0-9_]+$)|([0-9.]{1,30}$)" --method-rgx="(([a-z_][a-zA-Z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-zA-Z][a-zA-Z0-9_]+__))$" --variable-rgx="[a-zA-Z_][a-zA-Z0-9_]{1,30}$" --reports=y --score=y  --output-format=colorized  \{\} +
271
272 [testenv:pylint]
273 basepython = python3
274 deps = pylint>=2.6.0
275 allowlist_externals = find
276 commands =
277     find transportpce_tests/ -name *.py -exec pylint --fail-under=10 --max-line-length=120 --disable=missing-docstring,import-error --disable=fixme --disable=duplicate-code --module-rgx="([a-z0-9_]+$)|([0-9.]{1,30}$)" --method-rgx="(([a-z_][a-zA-Z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-zA-Z][a-zA-Z0-9_]+__))$" --variable-rgx="[a-zA-Z_][a-zA-Z0-9_]{1,30}$" \{\} +
278
279 [testenv:pyang]
280 basepython = python3
281 deps = pyang
282 allowlist_externals = find
283 commands =
284     pyang --version
285     find ../api/ -name target -prune -o -name *.yang -exec pyang --lint --canonical --max-line-length=120 -p../api/src/main/yang/:../ordmodels/common/src/main/yang/:../ordmodels/service/src/main/yang/:../tapimodels/src/main/yang/ \{\} +
286 #find ../api/ ../ordmodels/ ../tapimodels/ -name target -prune -o -name *.yang -exec pyang --lint --canonical --max-line-length=120 -p../api/src/main/yang/:../ordmodels/common/src/main/yang/:../ordmodels/service/src/main/yang/:../tapimodels/src/main/yang/ \{\} +
287
288 [testenv:pyangformat]
289 basepython = python3
290 deps = pyang
291 allowlist_externals = sh
292 commands =
293     pyang --version
294     sh -c 'find ../api/ -name target -prune -o -name *.yang -print | while read -r fname; do pyang -f yang --yang-canonical --yang-remove-unused-imports --max-line-length=120 --keep-comments -p../api/src/main/yang/:../ordmodels/common/src/main/yang/:../ordmodels/service/src/main/yang/:../tapimodels/src/main/yang/ "$fname"  -o /tmp/tmpfile.$$ && mv /tmp/tmpfile.$$ "$fname";done'
295
296 [testenv:pre-commit-install]
297 basepython = python3
298 deps = pre-commit
299 commands =
300     pre-commit install
301     pre-commit install --hook-type commit-msg
302
303 [testenv:pre-commit-uninstall]
304 basepython = python3
305 deps = pre-commit
306 commands =
307     pre-commit uninstall
308     pre-commit uninstall --hook-type commit-msg
309
310 [testenv:pre-commit-autoupdate]
311 basepython = python3
312 deps = pre-commit
313 commands =
314     pre-commit autoupdate
315
316 [testenv:pre-commit]
317 basepython = python3
318 deps = pre-commit
319 passenv = HOME
320 commands =
321     pre-commit run --all-files --show-diff-on-failure
322     pre-commit run gitlint-ci --hook-stage manual
323
324 [testenv:gitlint]
325 basepython = python3
326 deps = gitlint
327 commands =
328     gitlint --config ../.gitlint
329
330
331 [testenv:allure-report-init]
332 basepython = python3
333 deps = allure-pytest>=2.10.0
334 # allure is under Apache License 2.0
335 allowlist_externals =
336     mkdir
337     sed
338 commands =
339     mkdir -p allure-report
340     sed -i_ '$a\allure-pytest # Apache License 2.0' ./test-requirements.txt
341
342
343 [testenv:allure-report-serve]
344 basepython = python3
345 allowlist_externals =
346     allure
347 commands =
348     allure serve "allure-report"