Validate all bash files inside devstack

Previously only plugin.sh was validated.
At the monent some parts of the plugin
were moved under devstack/lib to increase plugin.sh
readability. Those files were not validated.

Note:
    Tweaked a tox.ini by removing installing the monasca-api
    package in environments that do not actually need it.
    Also removed redundant references to main environment
    dependencies.

Change-Id: I43381647228fad99603b5717c37496e80f409d4f
This commit is contained in:
Tomasz Trębski
2017-07-12 08:19:56 +02:00
parent cf472a1f6d
commit 175577d35b
6 changed files with 24 additions and 29 deletions

View File

@@ -45,8 +45,8 @@ ERREXIT=$(set +o | grep errexit)
set -o errexit set -o errexit
# source lib/* # source lib/*
source ${MONASCA_API_DIR}/devstack/lib/zookeeper source ${MONASCA_API_DIR}/devstack/lib/zookeeper.sh
source ${MONASCA_API_DIR}/devstack/lib/ui source ${MONASCA_API_DIR}/devstack/lib/ui.sh
# source lib/* # source lib/*
# Set default implementations to python # Set default implementations to python

6
tools/bashate.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Ignore too long lines error E006 from bashate and treat
# E005, E042 as errors.
SH_FILES=$(find ./devstack -type d -name files -prune -o -type f -name '*.sh' -print)
bashate -v -iE006 -eE005,E042 ${SH_FILES:-''}

41
tox.ini
View File

@@ -1,6 +1,6 @@
[tox] [tox]
envlist = py27,pep8,cover envlist = py27,pep8,cover
minversion = 2.1 minversion = 2.7
skipsdist = True skipsdist = True
[testenv] [testenv]
@@ -8,17 +8,12 @@ setenv =
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
OS_TEST_PATH=monasca_api/tests OS_TEST_PATH=monasca_api/tests
CLIENT_NAME=monasca-api CLIENT_NAME=monasca-api
passenv = http_proxy passenv = *_proxy
HTTP_PROXY *_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
usedevelop = True usedevelop = True
install_command = install_command =
{toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/test-requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = bash whitelist_externals = bash
find find
rm rm
@@ -27,24 +22,18 @@ commands =
[testenv:py27] [testenv:py27]
basepython = python2.7 basepython = python2.7
deps =
{[testenv]deps}
commands = commands =
{[testenv]commands} {[testenv]commands}
ostestr {posargs} ostestr {posargs}
[testenv:py35] [testenv:py35]
basepython = python3.5 basepython = python3.5
deps =
{[testenv]deps}
commands = commands =
{[testenv]commands} {[testenv]commands}
ostestr {posargs} ostestr {posargs}
[testenv:cover] [testenv:cover]
basepython = python2.7 basepython = python2.7
deps =
{[testenv]deps}
commands = commands =
{[testenv]commands} {[testenv]commands}
coverage erase coverage erase
@@ -52,18 +41,20 @@ commands =
coverage report coverage report
[testenv:debug] [testenv:debug]
deps =
{[testenv]deps}
commands = commands =
{[testenv]commands} {[testenv]commands}
oslo_debug_helper -t ./monasca_api/tests {posargs} oslo_debug_helper -t ./monasca_api/tests {posargs}
[testenv:flake8] [testenv:flake8]
skip_install = True
usedevelop = False
commands = commands =
flake8 monasca_api {[testenv]commands}
flake8 monasca_tempest_tests flake8 monasca_api monasca_tempest_tests --statistics
[testenv:bandit] [testenv:bandit]
skip_install = True
usedevelop = False
commands = commands =
# B101(assert_ussed) - API uses asserts because of performance reasons # B101(assert_ussed) - API uses asserts because of performance reasons
bandit -r monasca_api -n5 -s B101 -x monasca_api/tests bandit -r monasca_api -n5 -s B101 -x monasca_api/tests
@@ -71,15 +62,13 @@ commands =
bandit -r monasca_tempest_tests -n5 -s B101 bandit -r monasca_tempest_tests -n5 -s B101
[testenv:bashate] [testenv:bashate]
whitelist_externals = bashate skip_install = True
commands = usedevelop = False
# Ignore too long lines error E006 from bashate and treat commands = bash {toxinidir}/tools/bashate.sh
# E005, E042 as errors.
bashate -v -iE006 -eE005,E042 devstack/plugin.sh
[testenv:pep8] [testenv:pep8]
deps = skip_install = True
{[testenv]deps} usedevelop = False
commands = commands =
{[testenv:flake8]commands} {[testenv:flake8]commands}
{[testenv:bandit]commands} {[testenv:bandit]commands}