Ansible 2.1.1 role testing
Change-Id: Ia82a196be0b469900dfdcfb9cd3a4e1887ba082f Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
d670672d99
commit
396d4f1335
|
@ -29,6 +29,7 @@ doc/build/
|
||||||
*.log
|
*.log
|
||||||
*.sql
|
*.sql
|
||||||
*.sqlite
|
*.sqlite
|
||||||
|
logs/*
|
||||||
|
|
||||||
# OS generated files #
|
# OS generated files #
|
||||||
######################
|
######################
|
||||||
|
@ -61,6 +62,10 @@ releasenotes/build
|
||||||
|
|
||||||
# Test temp files
|
# Test temp files
|
||||||
tests/plugins
|
tests/plugins
|
||||||
|
tests/playbooks
|
||||||
|
tests/test.retry
|
||||||
|
|
||||||
# Vagrant testing artifacts
|
# Vagrant artifacts
|
||||||
.vagrant
|
.vagrant
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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)\""
|
10
run_tests.sh
10
run_tests.sh
|
@ -24,23 +24,23 @@ if [ ! "$(which pip)" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install bindep and tox
|
# Install bindep and tox
|
||||||
pip install bindep tox
|
sudo pip install bindep tox
|
||||||
|
|
||||||
# CentOS 7 requires two additional packages:
|
# CentOS 7 requires two additional packages:
|
||||||
# redhat-lsb-core - for bindep profile support
|
# redhat-lsb-core - for bindep profile support
|
||||||
# epel-release - required to install python-ndg_httpsclient/python2-pyasn1
|
# epel-release - required to install python-ndg_httpsclient/python2-pyasn1
|
||||||
if [ "$(which yum)" ]; then
|
if [ "$(which yum)" ]; then
|
||||||
yum -y install redhat-lsb-core epel-release
|
sudo yum -y install redhat-lsb-core epel-release
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install OS packages using bindep
|
# Install OS packages using bindep
|
||||||
if apt-get -v >/dev/null 2>&1 ; then
|
if apt-get -v >/dev/null 2>&1 ; then
|
||||||
apt-get update
|
sudo apt-get update
|
||||||
DEBIAN_FRONTEND=noninteractive \
|
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`
|
--assume-yes install `bindep -b -f bindep.txt test`
|
||||||
else
|
else
|
||||||
yum install -y `bindep -b -f bindep.txt test`
|
sudo yum install -y `bindep -b -f bindep.txt test`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# run through each tox env and execute the test
|
# run through each tox env and execute the test
|
||||||
|
|
|
@ -41,8 +41,7 @@
|
||||||
dest: "/etc/init/storm-supervisor.conf"
|
dest: "/etc/init/storm-supervisor.conf"
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
register: storm_config
|
register: storm_config_templates
|
||||||
register: copy_templates
|
until: storm_config_templates | success
|
||||||
until: copy_templates | success
|
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 3
|
delay: 3
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
repo: "deb https://packagecloud.io/grafana/stable/debian/ wheezy main"
|
repo: "deb https://packagecloud.io/grafana/stable/debian/ wheezy main"
|
||||||
state: "present"
|
state: "present"
|
||||||
register: add_graphana_apt
|
register: add_graphana_apt
|
||||||
until: add_grapha_apt | success
|
until: add_graphana_apt | success
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 3
|
delay: 3
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
tags:
|
tags:
|
||||||
- os_monasca
|
- os_monasca
|
||||||
|
|
||||||
- incude: configure_kafka.yml
|
- include: configure_kafka.yml
|
||||||
tags:
|
tags:
|
||||||
- os_monasca
|
- os_monasca
|
||||||
|
|
||||||
|
|
33
tox.ini
33
tox.ini
|
@ -104,7 +104,7 @@ commands =
|
||||||
[testenv:ansible]
|
[testenv:ansible]
|
||||||
deps =
|
deps =
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
ansible==1.9.4
|
ansible==2.1.1
|
||||||
ansible-lint>=2.7.0,<3.0.0
|
ansible-lint>=2.7.0,<3.0.0
|
||||||
setenv =
|
setenv =
|
||||||
{[testenv]setenv}
|
{[testenv]setenv}
|
||||||
|
@ -123,6 +123,7 @@ setenv =
|
||||||
# This is required as the default is '/etc/ansible/roles' or a path
|
# This is required as the default is '/etc/ansible/roles' or a path
|
||||||
# specified in ansible.cfg
|
# specified in ansible.cfg
|
||||||
ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/..
|
ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/..
|
||||||
|
ANSIBLE_TRANSPORT = "ssh"
|
||||||
commands =
|
commands =
|
||||||
rm -rf {homedir}/.ansible/plugins
|
rm -rf {homedir}/.ansible/plugins
|
||||||
git clone https://git.openstack.org/openstack/openstack-ansible-plugins \
|
git clone https://git.openstack.org/openstack/openstack-ansible-plugins \
|
||||||
|
@ -131,6 +132,11 @@ commands =
|
||||||
ansible-galaxy install \
|
ansible-galaxy install \
|
||||||
--role-file={toxinidir}/tests/ansible-role-requirements.yml \
|
--role-file={toxinidir}/tests/ansible-role-requirements.yml \
|
||||||
--force
|
--force
|
||||||
|
rm -rf {homedir}/.ansible/roles/os_monasca
|
||||||
|
bash -c "ln -s {toxinidir} {homedir}/.ansible/roles/os_monasca"
|
||||||
|
rm -rf {toxinidir}/tests/playbooks
|
||||||
|
git clone https://git.openstack.org/openstack/openstack-ansible-tests \
|
||||||
|
{toxinidir}/tests/playbooks
|
||||||
|
|
||||||
|
|
||||||
[testenv:ansible-syntax]
|
[testenv:ansible-syntax]
|
||||||
|
@ -143,7 +149,6 @@ commands =
|
||||||
ansible-playbook -i {toxinidir}/tests/inventory \
|
ansible-playbook -i {toxinidir}/tests/inventory \
|
||||||
--syntax-check \
|
--syntax-check \
|
||||||
--list-tasks \
|
--list-tasks \
|
||||||
-e "rolename={toxinidir}" \
|
|
||||||
{toxinidir}/tests/test.yml
|
{toxinidir}/tests/test.yml
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,6 +160,22 @@ commands =
|
||||||
ansible-lint {toxinidir}
|
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]
|
[testenv:functional]
|
||||||
# Ignore_errors is set to true so that the logs are collected at the
|
# 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
|
# end of the run. This will not produce a false positive. Any
|
||||||
|
@ -165,7 +186,7 @@ ignore_errors = True
|
||||||
# it doesn't work in OpenStack-CI yet. Once that's fixed, we can
|
# it doesn't work in OpenStack-CI yet. Once that's fixed, we can
|
||||||
# drop the install_command.
|
# drop the install_command.
|
||||||
install_command =
|
install_command =
|
||||||
pip install -U --force-reinstall {opts} {packages}
|
{[testenv:func_base]install_command}
|
||||||
deps =
|
deps =
|
||||||
{[testenv:ansible]deps}
|
{[testenv:ansible]deps}
|
||||||
setenv =
|
setenv =
|
||||||
|
@ -173,13 +194,9 @@ setenv =
|
||||||
commands =
|
commands =
|
||||||
{[testenv:ansible]commands}
|
{[testenv:ansible]commands}
|
||||||
ansible-playbook -i {toxinidir}/tests/inventory \
|
ansible-playbook -i {toxinidir}/tests/inventory \
|
||||||
-e "rolename={toxinidir}" \
|
|
||||||
-e "install_test_packages=True" \
|
-e "install_test_packages=True" \
|
||||||
{toxinidir}/tests/test.yml -vvvv
|
{toxinidir}/tests/test.yml -vvvv
|
||||||
bash -c 'mkdir -p {toxinidir}/logs'
|
{[testenv:func_logs]commands}
|
||||||
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:linters]
|
[testenv:linters]
|
||||||
|
|
Loading…
Reference in New Issue