Browse Source

Update tox.ini for openstack gate

Also add missing .gitreview file.

Change-Id: I25a115b8c03dc154905ab92262c736f6edbe6e72
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
changes/67/418067/5
Paul Belanger 5 years ago
parent
commit
e2b2669fdc
  1. 4
      .gitreview
  2. 9
      bindep.txt
  3. 2
      tests/ansible.cfg
  4. 2
      tests/test.yaml
  5. 48
      tox.ini

4
.gitreview

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

9
bindep.txt

@ -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]

2
tests/ansible.cfg

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

2
tests/test.yaml

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

48
tox.ini

@ -1,27 +1,19 @@
[tox]
minversion = 1.4.2
envlist = ansible-lint,docs,pep8
envlist = docs,linters
skipsdist = True
[testenv]
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:ansible-lint]
setenv =
ANSIBLE_CONFIG = tests/ansible.cfg
whitelist_externals = bash
commands =
bash -c "find . -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \
ansible-lint"
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"
[testenv:ansible-functional]
[testenv:functional]
commands =
ansible-playbook -i tests/inventory tests/test.yaml
passenv = HOME
# NOTE(pabelanger): Because ansible default ansible_user to null now, we need to pass it via CLI.
ansible-playbook -i tests/inventory tests/test.yaml -e ansible_user={env:USER}
passenv =
HOME
USER
setenv =
ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg
PYTHONUNBUFFERED = 1
@ -29,8 +21,28 @@ setenv =
[testenv:docs]
commands = python setup.py build_sphinx
[testenv:pep8]
commands = flake8
[testenv:venv]
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"

Loading…
Cancel
Save