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
# source lib/*
source ${MONASCA_API_DIR}/devstack/lib/zookeeper
source ${MONASCA_API_DIR}/devstack/lib/ui
source ${MONASCA_API_DIR}/devstack/lib/zookeeper.sh
source ${MONASCA_API_DIR}/devstack/lib/ui.sh
# source lib/*
# Set default implementations to python

View File

@ -66,7 +66,7 @@ function set_tempest_conf {
}
function function_exists {
function function_exists {
declare -f -F $1 > /dev/null
}

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