Skip to content
Permalink
Browse files

Merge "Add molecule infrastructure"

  • Loading branch information
Zuul authored and openstack-gerrit committed Feb 14, 2020
2 parents 22be797 + 7313847 commit ed9e7e75cdb3a417bf10ee0cadd3b0dc14b5cb04
Showing with 63 additions and 3 deletions.
  1. +8 −0 .gitignore
  2. +3 −1 .zuul.yaml
  3. +17 −0 ansible/README.testing.rst
  4. +27 −0 ci-scripts/molecule/test-molecule.sh
  5. +4 −1 test-requirements.txt
  6. +4 −1 tox.ini
@@ -46,3 +46,11 @@ log/*
# Containers
browbeat-containers/collectd-openstack/config/*
ansible-errors.json

# Molecule
.molecule/

# Pytest
.cache/
.pytest_cache/
.pytestdebug.log
@@ -3,17 +3,19 @@
templates:
- docs-on-readthedocs
- openstack-python37-jobs
- openstack-python36-jobs
- openstack-tox-molecule
vars:
rtd_webhook_id: '51626'
check:
jobs:
- openstack-tox-linters
- openstack-tox-py27
- openstack-tox-molecule
gate:
jobs:
- openstack-tox-linters
- openstack-tox-py27
- openstack-tox-molecule
post:
jobs:
- browbeat-upload-git-mirror
@@ -0,0 +1,17 @@
Running browebat ansible unit tests
===================================

Running ansible molecule unit tests
-----------------------------------

- Ensure that you have docker installed:

https://docs.docker.com/install/

- Run tox -e molecule

Adding ansible molecue unit test
--------------------------------

- cd ansible/install/roles/<example role>
molecule init scenario --role-name <example role> --driver-name docker
@@ -0,0 +1,27 @@
#!/bin/bash


# Run molecule tests. Any arguments passed to this script will be passed onto
# molecule.

set -e

molecules="$(find ansible/install/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"
@@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.

hacking<0.11,>=0.10.0
hacking>=1.1.0,<1.2.0 # Apache-2.0

pykwalify
coverage>=3.6
@@ -21,3 +21,6 @@ testscenarios>=0.4
testtools>=1.4.0
twine
wheel
docker<3 # Apache-2.0
molecule<3 # MIT
selinux>=0.1.5rc1
@@ -1,6 +1,6 @@
[tox]
minversion = 3.1.1
envlist = py27,py37,linters,dist,insights
envlist = py27,py37,linters,dist,insights,molecule
skipsdist = True

[testenv]
@@ -78,6 +78,9 @@ commands =
python setup.py sdist bdist_wheel
twine upload dist/*

[testenv:molecule]
commands = {toxinidir}/ci-scripts/molecule/test-molecule.sh

[flake8]
# E123, E125 skipped as they are invalid PEP-8.
show-source = True

0 comments on commit ed9e7e7

Please sign in to comment.
You can’t perform that action at this time.