Update tox.ini for openstack gate

Also add missing .gitreview file.

Change-Id: I25a115b8c03dc154905ab92262c736f6edbe6e72
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-01-09 14:27:46 -05:00
parent 808a94fc75
commit e2b2669fdc
5 changed files with 45 additions and 20 deletions

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/ansible-role-sudoers.git

9
bindep.txt Normal file
View File

@ -0,0 +1,9 @@
# This is a cross-platform list tracking distribution packages needed by tests;
# see http://docs.openstack.org/infra/bindep/ for additional information.
libffi-devel [platform:rpm]
libffi-dev [platform:dpkg]
libselinux-python [platform:rpm]
libssl-dev [platform:dpkg]
openssl-devel [platform:rpm]
python2-dnf [platform:fedora]

View File

@ -1,2 +1,2 @@
[defaults] [defaults]
roles_path = .. roles_path = ../..

View File

@ -13,12 +13,12 @@
# under the License. # under the License.
--- ---
- hosts: localhost - hosts: localhost
sudo: yes
vars: vars:
rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}" rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}"
pre_tasks: pre_tasks:
# Make sure OS does not have a stale package cache. # Make sure OS does not have a stale package cache.
- name: Update apt cache. - name: Update apt cache.
become: yes
apt: apt:
update_cache: yes update_cache: yes
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'

48
tox.ini
View File

@ -1,27 +1,19 @@
[tox] [tox]
minversion = 1.4.2 minversion = 1.4.2
envlist = ansible-lint,docs,pep8 envlist = docs,linters
skipsdist = True skipsdist = True
[testenv] [testenv]
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
[testenv:ansible-lint] [testenv:functional]
setenv =
ANSIBLE_CONFIG = tests/ansible.cfg
whitelist_externals = bash
commands = commands =
bash -c "find . -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \ # NOTE(pabelanger): Because ansible default ansible_user to null now, we need to pass it via CLI.
ansible-lint" ansible-playbook -i tests/inventory tests/test.yaml -e ansible_user={env:USER}
bash -c "find tests -type f -regex '.*.y[a]?ml' -print | xargs -t -n1 \ passenv =
ansible-playbook --syntax-check -i tests/inventory \ HOME
-e rolename=$(basename $(pwd)) > /dev/null" USER
[testenv:ansible-functional]
commands =
ansible-playbook -i tests/inventory tests/test.yaml
passenv = HOME
setenv = setenv =
ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg
PYTHONUNBUFFERED = 1 PYTHONUNBUFFERED = 1
@ -29,8 +21,28 @@ setenv =
[testenv:docs] [testenv:docs]
commands = python setup.py build_sphinx commands = python setup.py build_sphinx
[testenv:pep8]
commands = flake8
[testenv:venv] [testenv:venv]
commands = {posargs} commands = {posargs}
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E123,E125
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
[testenv:linters]
setenv =
ANSIBLE_CONFIG = tests/ansible.cfg
whitelist_externals = bash
commands =
# PEP8 Lint Check
flake8
# Ansible Lint Check
bash -c "find . -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \
ansible-lint"
# Ansible Syntax Check
bash -c "find tests -type f -regex '.*.y[a]?ml' -print | xargs -t -n1 \
ansible-playbook --syntax-check -i tests/inventory \
-e rolename=$(basename $(pwd)) > /dev/null"