mirror of
https://github.com/geerlingguy/ansible-role-apache
synced 2025-01-03 00:30:18 +01:00
Added idempotence test and integration test via Travis.
This commit is contained in:
parent
70e6ecff60
commit
0e3a6bb463
2 changed files with 20 additions and 1 deletions
|
@ -5,8 +5,11 @@ env:
|
|||
- SITE=test.yml
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y curl
|
||||
install:
|
||||
- pip install ansible==1.5.0
|
||||
script:
|
||||
- ansible-playbook -i tests/inventory tests/$SITE --syntax-check
|
||||
- ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo
|
||||
- ./tests/idempotence.sh
|
||||
- curl http://localhost/
|
||||
|
|
16
tests/idempotence.sh
Normal file
16
tests/idempotence.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Idempotency test for Ansible
|
||||
#
|
||||
# Runs an Ansible role/playbook, and makes sure no changes were made.
|
||||
#
|
||||
# @author Jeff Geerling, 2014
|
||||
|
||||
# Change directory up one level (into project root).
|
||||
cd ../
|
||||
|
||||
# Run playbook, and exit with 0 status if 'changed=0' found (good).
|
||||
ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo | grep -q 'changed=0' && exit 0
|
||||
|
||||
# Exit with a non-zero status if 'changed=0' was not found.
|
||||
exit 1
|
Loading…
Reference in a new issue