Add a tox environment & dependencies for running molecule tests
This commit is contained in:
parent
0f5832e865
commit
318f73cc52
8
.gitignore
vendored
8
.gitignore
vendored
@ -57,3 +57,11 @@ ansible/kolla-venv/
|
|||||||
|
|
||||||
# Vagrant
|
# Vagrant
|
||||||
.vagrant
|
.vagrant
|
||||||
|
|
||||||
|
# Molecule
|
||||||
|
.molecule/
|
||||||
|
|
||||||
|
# Pytest
|
||||||
|
.cache/
|
||||||
|
.pytest_cache/
|
||||||
|
pytestdebug.log
|
||||||
|
@ -27,6 +27,8 @@ env:
|
|||||||
- TOX_ENV=ansible-syntax
|
- TOX_ENV=ansible-syntax
|
||||||
# Run ansible tests.
|
# Run ansible tests.
|
||||||
- TOX_ENV=ansible
|
- TOX_ENV=ansible
|
||||||
|
# Run molecule tests.
|
||||||
|
- TOX_ENV=molecule
|
||||||
|
|
||||||
install:
|
install:
|
||||||
# Install tox in a virtualenv to ensure we have an up to date version.
|
# Install tox in a virtualenv to ensure we have an up to date version.
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
# of appearance. Changing the order has an impact on the overall integration
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
# process, which may cause wedges in the gate later.
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
hacking>=0.12.0,<0.13 # Apache-2.0
|
ansible-lint>=3.0.0 # MIT
|
||||||
|
|
||||||
bashate>=0.2 # Apache-2.0
|
bashate>=0.2 # Apache-2.0
|
||||||
coverage>=4.0 # Apache-2.0
|
coverage>=4.0 # Apache-2.0
|
||||||
doc8 # Apache-2.0
|
doc8 # Apache-2.0
|
||||||
sphinx>=1.5.1 # BSD
|
docker<3 # Apache-2.0
|
||||||
|
hacking>=0.12.0,<0.13 # Apache-2.0
|
||||||
|
molecule<3 # MIT
|
||||||
oslotest>=1.10.0 # Apache-2.0
|
oslotest>=1.10.0 # Apache-2.0
|
||||||
ansible-lint>=3.0.0 # MIT
|
sphinx>=1.5.1 # BSD
|
||||||
|
25
tools/test-molecule.sh
Executable file
25
tools/test-molecule.sh
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Run molecule tests. Any arguments passed to this script will be passed onto
|
||||||
|
# molecule.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
molecules="$(find ansible/roles/ -name molecule -type d)"
|
||||||
|
|
||||||
|
failed=0
|
||||||
|
ran=0
|
||||||
|
for molecule in $molecules; do
|
||||||
|
pushd $(dirname $molecule)
|
||||||
|
if ! molecule test --all $*; then
|
||||||
|
failed=$((failed + 1))
|
||||||
|
fi
|
||||||
|
ran=$((ran + 1))
|
||||||
|
popd
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $failed -ne 0 ]]; then
|
||||||
|
echo "Failed $failed / $ran molecule tests"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Ran $ran molecule tests successfully"
|
9
tox.ini
9
tox.ini
@ -52,6 +52,15 @@ commands =
|
|||||||
{toxinidir}/ansible/roles/*/tests/main.yml \
|
{toxinidir}/ansible/roles/*/tests/main.yml \
|
||||||
{posargs}"
|
{posargs}"
|
||||||
|
|
||||||
|
[testenv:molecule]
|
||||||
|
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/pike} {opts} {packages}
|
||||||
|
commands =
|
||||||
|
# Install ansible role dependencies from Galaxy.
|
||||||
|
ansible-galaxy install \
|
||||||
|
-r {toxinidir}/requirements.yml \
|
||||||
|
-p {toxinidir}/ansible/roles
|
||||||
|
{toxinidir}/tools/test-molecule.sh {posargs}
|
||||||
|
|
||||||
[testenv:alint]
|
[testenv:alint]
|
||||||
commands = ansible-lint ansible/*.yaml
|
commands = ansible-lint ansible/*.yaml
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user