Update testing bits for consistency

Change-Id: I9d1951c5b594fb20a543d90a22fac510973d8a0d
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2016-09-16 21:17:16 -05:00 committed by Jesse Pretorius (odyssey4me)
parent 4cdf533565
commit e5a346f4f5
4 changed files with 72 additions and 18 deletions

15
.gitignore vendored
View File

@ -1,7 +1,3 @@
# Override Files #
rpc_deployment/playbooks/lab_plays
rpc_deployment/vars/overrides/*.yml
# Compiled source #
###################
*.com
@ -33,6 +29,7 @@ doc/build/
*.log
*.sql
*.sqlite
logs/*
# OS generated files #
######################
@ -63,8 +60,12 @@ ChangeLog
# Files created by releasenotes build
releasenotes/build
# Vagrant testing artifacts
# Test temp files
tests/plugins
tests/playbooks
tests/test.retry
# Vagrant artifacts
.vagrant
# Automatically generated documentation
doc/source/auto_*

33
manual-test.rc Normal file
View File

@ -0,0 +1,33 @@
export VIRTUAL_ENV=$(pwd)
export ANSIBLE_HOST_KEY_CHECKING=False
export ANSIBLE_SSH_CONTROL_PATH=/tmp/%%h-%%r
# TODO (odyssey4me) These are only here as they are non-standard folder
# names for Ansible 1.9.x. We are using the standard folder names for
# Ansible v2.x. We can remove this when we move to Ansible 2.x.
export ANSIBLE_ACTION_PLUGINS=${HOME}/.ansible/plugins/action
export ANSIBLE_CALLBACK_PLUGINS=${HOME}/.ansible/plugins/callback
export ANSIBLE_FILTER_PLUGINS=${HOME}/.ansible/plugins/filter
export ANSIBLE_LOOKUP_PLUGINS=${HOME}/.ansible/plugins/lookup
# This is required as the default is the current path or a path specified
# in ansible.cfg
export ANSIBLE_LIBRARY=${HOME}/.ansible/plugins/library
# This is required as the default is '/etc/ansible/roles' or a path
# specified in ansible.cfg
export ANSIBLE_ROLES_PATH=${HOME}/.ansible/roles:$(pwd)/..
export ANSIBLE_SSH_ARGS="-o ControlMaster=no \
-o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no \
-o ServerAliveInterval=64 \
-o ServerAliveCountMax=1024 \
-o Compression=no \
-o TCPKeepAlive=yes \
-o VerifyHostKeyDNS=no \
-o ForwardX11=no \
-o ForwardAgent=yes"
echo "Run manual functional tests by executing the following:"
echo "# ./.tox/functional/bin/ansible-playbook -i tests/inventory tests/test.yml -e \"rolename=$(pwd)\""

View File

@ -24,23 +24,23 @@ if [ ! "$(which pip)" ]; then
fi
# Install bindep and tox
pip install bindep tox
sudo pip install bindep tox
# CentOS 7 requires two additional packages:
# redhat-lsb-core - for bindep profile support
# epel-release - required to install python-ndg_httpsclient/python2-pyasn1
if [ "$(which yum)" ]; then
yum -y install redhat-lsb-core epel-release
sudo yum -y install redhat-lsb-core epel-release
fi
# Install OS packages using bindep
if apt-get -v >/dev/null 2>&1 ; then
apt-get update
sudo apt-get update
DEBIAN_FRONTEND=noninteractive \
apt-get -q --option "Dpkg::Options::=--force-confold" \
sudo apt-get -q --option "Dpkg::Options::=--force-confold" \
--assume-yes install `bindep -b -f bindep.txt test`
else
yum install -y `bindep -b -f bindep.txt test`
sudo yum install -y `bindep -b -f bindep.txt test`
fi
# run through each tox env and execute the test

32
tox.ini
View File

@ -115,10 +115,18 @@ setenv =
# This is required as the default is '/etc/ansible/roles' or a path
# specified in ansible.cfg
ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/..
ANSIBLE_TRANSPORT = "ssh"
commands =
# NOTE(cloudnull): Galaxy INIT it running here because there are no role deps to create the skel
ansible-galaxy init {homedir}/.ansible/roles/security --force --offline
rm -rf {homedir}/.ansible/plugins
git clone https://git.openstack.org/openstack/openstack-ansible-plugins \
{homedir}/.ansible/plugins
rm -rf {homedir}/.ansible/roles/security
bash -c "ln -s {toxinidir} {homedir}/.ansible/roles/security"
rm -rf {toxinidir}/tests/playbooks
git clone https://git.openstack.org/openstack/openstack-ansible-tests \
{toxinidir}/tests/playbooks
[testenv:ansible-syntax]
@ -144,6 +152,22 @@ commands =
ansible-lint {toxinidir}
[testenv:func_base]
# NOTE(odyssey4me): this target does not use constraints because
# it doesn't work in OpenStack-CI yet. Once that's fixed, we can
# drop the install_command.
install_command =
pip install -U --force-reinstall {opts} {packages}
[testenv:func_logs]
commands =
bash -c 'mkdir -p {toxinidir}/logs'
bash -c 'rsync --archive --verbose --ignore-errors /var/log/ /openstack/log/ {toxinidir}/logs/ || true'
bash -c 'find "{toxinidir}/logs/" -type f | sed "p;s|$|.txt|" | xargs -n2 mv'
bash -c 'command gzip --best --recursive "{toxinidir}/logs/"'
[testenv:functional]
# Ignore_errors is set to true so that the logs are collected at the
# end of the run. This will not produce a false positive. Any
@ -154,14 +178,13 @@ ignore_errors = True
# it doesn't work in OpenStack-CI yet. Once that's fixed, we can
# drop the install_command.
install_command =
pip install -U --force-reinstall {opts} {packages}
{[testenv:func_base]install_command}
deps =
{[testenv:ansible]deps}
setenv =
{[testenv:ansible]setenv}
commands =
{[testenv:ansible]commands}
# NOTE(odyssey4me): We have to skip V-38462 as openstack-infra are now
# building images with apt config
# Apt::Get::AllowUnauthenticated set to true.
@ -188,10 +211,7 @@ commands =
bash -c 'grep -q "changed=0.*failed=0" /tmp/idempotence_test_output.txt \
&& (echo "Idempotence test: pass" && exit 0) \
|| (echo "Idempotence test: fail" && exit 1)'
bash -c 'mkdir -p {toxinidir}/logs'
bash -c 'rsync --archive --verbose --ignore-errors /var/log/ /openstack/log/ {toxinidir}/logs/ || true'
bash -c 'find "{toxinidir}/logs/" -type f | sed "p;s|$|.txt|" | xargs -n2 mv'
bash -c 'command gzip --best --recursive "{toxinidir}/logs/"'
{[testenv:func_logs]commands}
[testenv:linters]