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