Update run_tests to be more complete
This patch updates the run_tests convenience script to make it execute all test environments using tox, but also ensures that all the correct pre-requisites are in place before doing so. Change-Id: If188d528944470cf99d2551c284e2c5cba4a4aac
This commit is contained in:
parent
c3405ef941
commit
37a1f4cd16
35
run_tests.sh
35
run_tests.sh
@ -15,24 +15,29 @@
|
||||
|
||||
set -euov
|
||||
|
||||
ROLE_NAME=$(basename $(pwd))
|
||||
FUNCTIONAL_TEST=${FUNCTIONAL_TEST:-true}
|
||||
|
||||
pushd tests
|
||||
ansible-galaxy install \
|
||||
--role-file=ansible-role-requirements.yml \
|
||||
--ignore-errors \
|
||||
--force
|
||||
# prep the host
|
||||
if [ "$(which apt-get)" ]; then
|
||||
apt-get install -y build-essential python2.7 python-dev git-core
|
||||
fi
|
||||
|
||||
ansible-playbook -i inventory \
|
||||
--syntax-check \
|
||||
--list-tasks \
|
||||
-e "rolename=${ROLE_NAME}" \
|
||||
test.yml
|
||||
# get pip, if necessary
|
||||
if [ ! "$(which pip)" ]; then
|
||||
curl --silent --show-error --retry 5 \
|
||||
https://bootstrap.pypa.io/get-pip.py | sudo python2.7
|
||||
fi
|
||||
|
||||
ansible-lint test.yml
|
||||
# install tox
|
||||
pip install tox
|
||||
|
||||
if ${FUNCTIONAL_TEST}; then
|
||||
ansible-playbook -i inventory -e "rolename=${ROLE_NAME}" test.yml
|
||||
# run through each tox env and execute the test
|
||||
for tox_env in $(awk -F= '/envlist/ {print $2}' tox.ini | sed 's/,/ /g'); do
|
||||
if [ "${tox_env}" != "ansible-functional" ]; then
|
||||
tox -e ${tox_env}
|
||||
elif [ "${tox_env}" == "ansible-functional" ]; then
|
||||
if ${FUNCTIONAL_TEST}; then
|
||||
tox -e ${tox_env}
|
||||
fi
|
||||
fi
|
||||
popd
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user