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