Use lighty-core build rather than package dep
[transportpce.git] / tox.ini
1 [tox]
2 minversion = 3.7.0
3 envlist = buildcontroller,testsPCE,
4     sims121,build_karaf_tests121,tests121,
5     sims221,build_karaf_tests221,tests221,
6     sims71,build_karaf_tests71,tests71,
7     build_karaf_tests_hybrid,tests_hybrid,
8     docs
9     docs-linkcheck
10     checkbashisms
11     pre-commit
12     gitlint
13     pylint
14 skipsdist = true
15 setupdir = tests/
16
17 [testenv]
18 passenv = USE_LIGHTY http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY OLM_TIMER1 OLM_TIMER2
19 setenv =
20 #    USE_LIGHTY=True
21     OLM_TIMER1=3000
22     OLM_TIMER2=2000
23
24 usedevelop = true
25 basepython = python3
26 deps =
27   -r{toxinidir}/tests/requirements.txt
28   -r{toxinidir}/tests/test-requirements.txt
29   setuptools>=7.0
30 changedir = {toxinidir}/tests
31 parallel_show_output = true
32
33 [testenv:buildcontroller]
34 whitelist_externals = build_controller.sh
35 commands =
36   ./build_controller.sh
37
38 [testenv:sims121]
39 whitelist_externals = install_honeynode.sh
40 depends = buildcontroller
41 # sims profiles does not strictly depends on buildcontroller
42 # but this dependency avoids race condition in the gate
43 commands =
44   ./install_honeynode.sh 1.2.1
45
46 [testenv:sims221]
47 whitelist_externals = install_honeynode.sh
48 depends = buildcontroller
49 commands =
50   ./install_honeynode.sh 2.2.1
51
52 [testenv:sims71]
53 whitelist_externals = install_honeynode.sh
54 depends = buildcontroller
55 commands =
56   ./install_honeynode.sh 7.1
57
58 [testenv:testsPCE]
59 depends = buildcontroller
60 whitelist_externals = launch_tests.sh
61 passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
62 #setenv =
63 #    USE_LIGHTY=True
64 commands =
65   ./launch_tests.sh pce {posargs:}
66
67 [testenv:build_karaf_tests121]
68 depends = buildcontroller
69 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
70 whitelist_externals = launch_tests.sh
71 passenv = LAUNCHER USE_LIGHTY
72 setenv =
73 #    USE_LIGHTY=True
74     USE_ODL_ALT_KARAF_ENV=./karaf121.env
75     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
76 commands =
77   ./build_karaf_for_tests.sh
78
79 [testenv:tests121]
80 depends = buildcontroller,build_karaf_tests121,sims121,testsPCE
81 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
82 whitelist_externals = launch_tests.sh
83 passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
84 setenv =
85 #    USE_LIGHTY=True
86 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
87     USE_ODL_ALT_KARAF_ENV=./karaf121.env
88     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
89 commands =
90   ./launch_tests.sh 1.2.1 {posargs:}
91 # By default, all tests in the folder transportpce_tests/1.2.1/ are run.
92 # Though, a restricted list of tests can be passed as argument to 'tox -e tests121'.
93 # For example, 'tox -e tests121 portmapping' will run only the portmapping test.
94 # and 'tox -e tests121 "portmapping pce"' will run the portmapping and pce tests.
95 # Additionnally, a different launcher command than 'nosetests --with-xunit' can be
96 # used by exporting the variable LAUNCHER. For example 'export LAUNCHER="python3"'
97 # which is more verbose than nose or 'export LAUNCHER="ls -l"' to only list script
98 # files attributes.
99
100 [testenv:build_karaf_tests221]
101 depends = buildcontroller
102 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
103 whitelist_externals = launch_tests.sh
104 passenv = LAUNCHER USE_LIGHTY
105 setenv =
106 #    USE_LIGHTY=True
107     USE_ODL_ALT_KARAF_ENV=./karaf221.env
108     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
109 commands =
110   ./build_karaf_for_tests.sh
111
112 [testenv:tests221]
113 depends = buildcontroller,build_karaf_tests221,sims221,tests71
114 # tests71 dependency is only here to chain tests in the gate and avoid ressources starvation
115 whitelist_externals = launch_tests.sh
116 passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
117 setenv =
118 #    USE_LIGHTY=True
119 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
120     USE_ODL_ALT_KARAF_ENV=./karaf221.env
121     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
122 commands =
123   ./launch_tests.sh 2.2.1 {posargs:}
124
125 [testenv:build_karaf_tests71]
126 depends = buildcontroller
127 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
128 whitelist_externals = launch_tests.sh
129 passenv = LAUNCHER USE_LIGHTY
130 setenv =
131 #    USE_LIGHTY=True
132     USE_ODL_ALT_KARAF_ENV=./karaf71.env
133     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
134 commands =
135   ./build_karaf_for_tests.sh
136
137 [testenv:tests71]
138 depends = buildcontroller,build_karaf_tests71,sims71
139 whitelist_externals = launch_tests.sh
140 passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
141 setenv =
142 #    USE_LIGHTY=True
143 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
144     USE_ODL_ALT_KARAF_ENV=./karaf71.env
145     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
146 commands =
147   ./launch_tests.sh 7.1 {posargs:}
148
149 [testenv:build_karaf_tests_hybrid]
150 depends = buildcontroller
151 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
152 whitelist_externals = launch_tests.sh
153 passenv = LAUNCHER USE_LIGHTY
154 setenv =
155 #    USE_LIGHTY=True
156     USE_ODL_ALT_KARAF_ENV=./karaf121.env
157     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
158 commands =
159   ./build_karaf_for_tests.sh
160
161 [testenv:tests_hybrid]
162 depends = buildcontroller,sims121,sims221,sims71,tests121,tests221,tests71
163 #the last dependency is to avoid temporarily concurrent ressources problem in parallel mode
164 whitelist_externals = launch_tests.sh
165 passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
166 setenv =
167 #    USE_LIGHTY=True
168     USE_ODL_ALT_KARAF_ENV=./karaf121.env
169     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
170 commands =
171 #  nosetests --with-xunit transportpce_tests/hybrid/test01_device_change_notifications.py
172   ./launch_tests.sh hybrid {posargs:}
173
174 [testenv:gnpy]
175 depends = buildcontroller
176 whitelist_externals = launch_tests.sh
177                       dockercmd.sh
178 passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
179 commands =
180   #sudo docker pull atriki/gnpyrest:v1.2
181   ./dockercmd.sh run -d -p 8008:5000 --name gnpy_tpce_rest1 atriki/gnpyrest:v1.2
182   ./launch_tests.sh with_docker gnpy
183   ./dockercmd.sh container rm -f gnpy_tpce_rest1
184
185 [testenv:nbinotifications]
186 depends = buildcontroller,sims221
187 whitelist_externals = launch_tests.sh
188                       dockercmd.sh
189 passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION OLM_TIMER1 OLM_TIMER2
190 setenv =
191     OLM_TIMER1=3000
192     OLM_TIMER2=2000
193
194 commands =
195   ./dockercmd.sh run -d -p 2181:2181 -p 9092:9092 --env ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 --name tpce_kafka1 teivah/kafka:2.0.0
196   ./launch_tests.sh with_docker nbinotifications
197   ./dockercmd.sh container rm -f tpce_kafka1
198
199 [testenv:docs]
200 passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
201 basepython = python3
202 deps = -rdocs/requirements.txt
203 commands =
204     sphinx-build -q -W -b html -n -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/html
205
206 [testenv:docs-linkcheck]
207 passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
208 basepython = python3
209 deps = -rdocs/requirements.txt
210 commands = sphinx-build -q -b linkcheck -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/linkcheck
211
212 [testenv:checkbashisms]
213 deps =
214 whitelist_externals = sh
215                       checkbashisms
216                       sudo
217                       find
218 commands =
219     sh -c 'command checkbashisms>/dev/null || sudo yum install devscripts-minimal || (echo "checkbashisms command not found - please install it (e.g. sudo apt-get install devscripts | yum install devscripts-minimal )" >&2 && exit 1)'
220     find . -not -path '*/\.*' -name *.sh -exec checkbashisms -f  \{\} +
221
222 [testenv:spelling]
223 basepython = python3
224 deps =
225     -rdocs/requirements.txt
226     sphinxcontrib-spelling
227     PyEnchant
228 commands = sphinx-build -b spelling  -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/spelling
229
230 [testenv:autopep8]
231 basepython = python3
232 deps = autopep8
233 commands =
234     autopep8 --max-line-length 120 --in-place --recursive transportpce_tests/
235
236 [testenv:pylint_full]
237 basepython = python3
238 deps = pylint>=2.6.0
239 whitelist_externals = find
240 commands =
241     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  \{\} +
242
243 [testenv:pylint]
244 basepython = python3
245 deps = pylint>=2.6.0
246 whitelist_externals = find
247 commands =
248     find transportpce_tests/ -name *.py -exec pylint --fail-under=10 --max-line-length=120 --disable=missing-docstring --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}$" \{\} +
249
250 [testenv:pyang]
251 basepython = python3
252 deps = pyang
253 whitelist_externals = find
254 commands =
255     pyang --version
256     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/ \{\} +
257 #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/ \{\} +
258
259 [testenv:pyangformat]
260 basepython = python3
261 deps = pyang
262 whitelist_externals = sh
263 commands =
264     pyang --version
265     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'
266
267 [testenv:pre-commit-install]
268 basepython = python3
269 deps = pre-commit
270 commands =
271     pre-commit install
272     pre-commit install --hook-type commit-msg
273
274 [testenv:pre-commit-uninstall]
275 basepython = python3
276 deps = pre-commit
277 commands =
278     pre-commit uninstall
279     pre-commit uninstall --hook-type commit-msg
280
281 [testenv:pre-commit-autoupdate]
282 basepython = python3
283 deps = pre-commit
284 commands =
285     pre-commit autoupdate
286
287 [testenv:pre-commit]
288 basepython = python3
289 deps = pre-commit
290 passenv = HOME
291 commands =
292     pre-commit run --all-files --show-diff-on-failure
293     pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG
294     # Gitlint only proposes a pre-commit configuration for the commit-msg stage but none for the commit stage.
295     # Its default arguments --passed and --msg-filename are different from CI recommandations.
296     # As a result, the line above is always skipped in jenkins CI since there cannot be a .git/COMMIT_EDITMSG file.
297     # A dedicated gitlint profile for CI is proposed below. Also to behave fine locally, this profile must have access
298     # to the HOME variable so that Gitlint can retrieve Git user settings.
299
300 [testenv:gitlint]
301 basepython = python3
302 deps = gitlint
303 commands =
304     gitlint
305