
This patch implements test scripts intended for use by all OpenStack-Ansible role tests. The intent is to simplify the role tox.ini configuration and ensure that as many changes to role testing configuration can be managed from the centralised tests repo instead of individually in each repository. This patch implements the scripts to centralise the ansible-lint, ansible-syntax, and functional Ansible tests. Functionality included: - For a simple functional test, the defaults will be allow the execution of the test without any parameters set. - For a scenario test the scripts allow the inventory, extra vars and any other CLI parameters for Ansible to be set via environment variables. - Both check mode and an idempotence test. In addition to this functionality, the bash scripts are all set to fail on error to ensure that tox shows a failure. Change-Id: I23c24146485da340d4f046f80e4814652e6e3876
OpenStack-Ansible testing
This is the openstack-ansible-tests
repository,
providing a framework and consolidation of testing configuration and
playbooks. This can be used to integrate new projects, and ensure that
code duplication is minimized whilst allowing the addition of new
testing scenarios with greater ease.
Role Integration
To enable the openstack-ansible-tests
repository, ensure
that the tox.ini
configuration in the role repository
matches the galera_client
repository tox.ini with the exception of the value for
ROLE_NAME
. A more advanced configuration which implements
multiple functional test scenarios is available in the neutron
role tox.ini.
To override variables you can create a
${rolename}-overrides.yml
file inside the role's tests
folder. This variable file can be includes in the functional tox target
configuration in tox.ini
as demonstrated in the following
extract:
ansible-playbook -i {toxinidir}/tests/inventory \
-e @{toxinidir}/tests/${rolename}-overrides.yml \
{toxinidir}/tests/test.yml -vvvv
In your repositories tests/test.yml
file, you can call
any of the included playbooks, for example:
Network Settings
The networking can be configured and setup using the
bridges
variable.
The base option, when only 1 interface is required is to specify just
a single base - this is only for backwards compatibility with existing
test setup and will default to br-mgmt
with an IP of
10.1.0.1
.
To allow a more complicated network setup we can specify
ip_addr
: The IP address on the interface.
netmask
: Netmask of the interface (defaults to
255.255.255.0) name
: Name of the interface
veth_peer
: Set up a veth peer for the interface
alias
: Add an alias IP address
For example, a Nova setup may look like this: