-
Notifications
You must be signed in to change notification settings - Fork 7
/
tox.ini
94 lines (84 loc) · 2.77 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs.
# This configuration file will run the test suite on all supported
# python versions.
# To use it, "pip install tox" and then run "tox" from this directory.
[tox]
# func is not mentioned in the default set because it needs extra config
envlist = setup,infrared,yamllint,flake8,ansible-lint,ansible-check,ansible-syntax-check
skipsdist = True
[testenv]
sitepackages = False
# TODO: make sitepackages = True as soon we have RHOSINFRA-1562 fixed
# which can cause failures to infrared messing shade dependencies even when
# the system has a correctly working shade version.
changedir = {toxinidir}
envdir = {toxworkdir}/venv
deps =
-chttps://raw.githubusercontent.com/redhat-openstack/infrared/master/requirements.txt
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals =
bash
passenv =
ANSIBLE_*
BUILD_*
COMPONENT_*
DEBUG
DISABLE_CLEANUP
DNS
JENKINS_*
JOB_NAME
OS_*
PIP_DISABLE_PIP_VERSION_CHECK
PPID
SSH_AUTH_SOCK
USER
WORKSPACE
[testenv:setup]
commands =
pip install -q -e {toxinidir}
[testenv:infrared]
setenv =
IR_HOME=/tmp/.infrared-octario-tox/
commands =
# remove old IR_HOME if exists
bash -c 'if [ -d "$\{IR_HOME\}" ]; then rm -rf "$\{IR_HOME\}"; fi'
# create clean IR_HOME
# NOTE(sdatko): there is bug in infrared that causes first launch to fail
bash -c 'infrared workspace list || true'
# install octario as infrared plugin and verify it worked
infrared plugin add {toxinidir}
infrared octario --help
[testenv:yamllint]
commands =
bash -c 'git ls-tree --full-tree --name-only -r HEAD \
| grep -E '\.ya?ml$' \
| xargs python -m yamllint -f parsable'
[testenv:flake8]
commands =
flake8 {posargs}
[testenv:ansible-lint]
# Skipped checks (-x):
# - 403: Package installs should not use latest
commands =
bash -c 'ansible-lint --force-color -p -x 403 {toxinidir}/playbooks/*.yml'
[testenv:ansible-check]
setenv =
ANSIBLE_FORCE_COLOR=false
commands =
bash -c 'ansible-playbook -i tests/hosts \
--check -v playbooks/*.yml \
>ansible-check.log 2>&1 \
|| echo "WARN: Failure ignored because CI currently does not allow sudo on slaves."'
[testenv:ansible-syntax-check]
commands =
bash -c 'find ./playbooks -name "*.yml" \
| xargs -n 1 ansible-playbook \
-i tests/hosts \
--syntax-check \
--list-tasks -v'
[testenv:func]
commands =
# TODO: add here code to run octario playbooks via docker or infrared
bash -c 'find {toxinidir} -iname runtests.sh -exec \{\} \;'