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,
18 passenv = USE_LIGHTY http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY OLM_TIMER1 OLM_TIMER2
27 -r{toxinidir}/tests/requirements.txt
28 -r{toxinidir}/tests/test-requirements.txt
30 changedir = {toxinidir}/tests
31 parallel_show_output = true
33 [testenv:buildcontroller]
34 whitelist_externals = build_controller.sh
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
44 ./install_honeynode.sh 1.2.1
47 whitelist_externals = install_honeynode.sh
48 depends = buildcontroller
50 ./install_honeynode.sh 2.2.1
53 whitelist_externals = install_honeynode.sh
54 depends = buildcontroller
56 ./install_honeynode.sh 7.1
59 depends = buildcontroller
60 whitelist_externals = launch_tests.sh
61 passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
65 ./launch_tests.sh pce {posargs:}
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
74 USE_ODL_ALT_KARAF_ENV=./karaf121.env
75 USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
77 ./build_karaf_for_tests.sh
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
86 # USE_ODL_RESTCONF_VERSION=draft-bierman02
87 USE_ODL_ALT_KARAF_ENV=./karaf121.env
88 USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
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
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
107 USE_ODL_ALT_KARAF_ENV=./karaf221.env
108 USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
110 ./build_karaf_for_tests.sh
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
119 # USE_ODL_RESTCONF_VERSION=draft-bierman02
120 USE_ODL_ALT_KARAF_ENV=./karaf221.env
121 USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
123 ./launch_tests.sh 2.2.1 {posargs:}
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
132 USE_ODL_ALT_KARAF_ENV=./karaf71.env
133 USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
135 ./build_karaf_for_tests.sh
138 depends = buildcontroller,build_karaf_tests71,sims71
139 whitelist_externals = launch_tests.sh
140 passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
143 # USE_ODL_RESTCONF_VERSION=draft-bierman02
144 USE_ODL_ALT_KARAF_ENV=./karaf71.env
145 USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
147 ./launch_tests.sh 7.1 {posargs:}
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
156 USE_ODL_ALT_KARAF_ENV=./karaf121.env
157 USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
159 ./build_karaf_for_tests.sh
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
168 USE_ODL_ALT_KARAF_ENV=./karaf121.env
169 USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
171 # nosetests --with-xunit transportpce_tests/hybrid/test01_device_change_notifications.py
172 ./launch_tests.sh hybrid {posargs:}
175 depends = buildcontroller
176 whitelist_externals = launch_tests.sh
178 passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
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
185 [testenv:nbinotifications]
186 depends = buildcontroller,sims221
187 whitelist_externals = launch_tests.sh
189 passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION OLM_TIMER1 OLM_TIMER2
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
200 passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
202 deps = -rdocs/requirements.txt
204 sphinx-build -q -W -b html -n -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/html
206 [testenv:docs-linkcheck]
207 passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
209 deps = -rdocs/requirements.txt
210 commands = sphinx-build -q -b linkcheck -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/linkcheck
212 [testenv:checkbashisms]
214 whitelist_externals = sh
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 \{\} +
225 -rdocs/requirements.txt
226 sphinxcontrib-spelling
228 commands = sphinx-build -b spelling -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/spelling
234 autopep8 --max-line-length 120 --in-place --recursive transportpce_tests/
236 [testenv:pylint_full]
239 whitelist_externals = find
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 \{\} +
246 whitelist_externals = find
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}$" \{\} +
253 whitelist_externals = find
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/ \{\} +
259 [testenv:pyangformat]
262 whitelist_externals = sh
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'
267 [testenv:pre-commit-install]
272 pre-commit install --hook-type commit-msg
274 [testenv:pre-commit-uninstall]
279 pre-commit uninstall --hook-type commit-msg
281 [testenv:pre-commit-autoupdate]
285 pre-commit autoupdate
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.