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:
1
ara/tests/integration/hosts
Normal file
1
ara/tests/integration/hosts
Normal file
@@ -0,0 +1 @@
|
||||
localhost ansible_connection=local
|
||||
7
ara/tests/integration/playbook.yml
Normal file
7
ara/tests/integration/playbook.yml
Normal 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
4
run_tests.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
# Runs ARA tests
|
||||
tox -e pep8
|
||||
tox -e integration
|
||||
18
tox.ini
18
tox.ini
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user