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