Add integration tests

tox -e integration will run ansible with the callback and run a
series of ara commands to ensure each command works.
It's basic but good coverage for low cost.
This commit is contained in:
David Moreau-Simard
2016-05-14 00:47:47 -04:00
parent 610c4e18d6
commit bcb1b52482
4 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1 @@
localhost ansible_connection=local

View File

@@ -0,0 +1,7 @@
- name: Test playbook
hosts: all
gather_facts: no
tasks:
- name: Integration test
debug:
msg: "Integration test"

4
run_tests.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
# Runs ARA tests
tox -e pep8
tox -e integration

18
tox.ini
View File

@@ -16,6 +16,24 @@ commands = python setup.py build_sphinx
[testenv:pep8]
commands = flake8 ara
[testenv:integration]
whitelist_externals = bash
rm
commands =
rm -f "{toxinidir}/ara/tests/integration/ansible.sqlite"
ansible-playbook -vv {toxinidir}/ara/tests/integration/playbook.yml
bash -c "ara host show $(ara host list -c ID -f value |head -n1)"
bash -c "ara play show $(ara play list -c ID -f value |head -n1)"
bash -c "ara playbook show $(ara playbook list -c ID -f value |head -n1)"
bash -c "ara result show $(ara result list -c ID -f value |head -n1)"
bash -c "ara stats show $(ara stats list -c ID -f value |head -n1)"
bash -c "ara task show $(ara task list -c ID -f value |head -n1)"
setenv =
ANSIBLE_CALLBACK_PLUGINS = {toxinidir}/ara/callback
ANSIBLE_HOSTS = {toxinidir}/ara/tests/integration/hosts
ARA_DATABASE = sqlite:////{toxinidir}/ara/tests/integration/ansible.sqlite
PYTHONUNBUFFERED = 1
[flake8]
ignore = E402,F401
show-source = True