mirror of
https://github.com/geerlingguy/ansible-role-apache
synced 2024-12-22 02:50:19 +01:00
Add idempotence test
This commit is contained in:
parent
5d73dbbb94
commit
0060d6d1c8
1 changed files with 20 additions and 2 deletions
22
.travis.yml
22
.travis.yml
|
@ -18,19 +18,37 @@ script:
|
|||
#
|
||||
# Run test playbook on Ubuntu container
|
||||
#
|
||||
|
||||
# Syntax check
|
||||
- sudo docker run ubuntu:ansible ansible-playbook /etc/ansible/test.yml --syntax-check
|
||||
# Test role
|
||||
- sudo docker run ubuntu:ansible ansible-playbook /etc/ansible/test.yml
|
||||
# Idempotence test
|
||||
- >
|
||||
sudo docker run ubuntu:ansible ansible-playbook /etc/ansible/test.yml
|
||||
| grep -q 'changed=0.*failed=0'
|
||||
&& (echo 'Idempotence test: pass' && exit 0)
|
||||
|| (echo 'Idempotence test: fail' && exit 1)
|
||||
|
||||
#
|
||||
# Run test playbook on CentOS container
|
||||
#
|
||||
|
||||
# Run container in detached state
|
||||
# Run container in detached state
|
||||
- sudo docker run --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro centos:ansible /usr/lib/systemd/systemd > "${CONTAINER_ID}"
|
||||
|
||||
# Syntax check
|
||||
- sudo docker exec "$(cat ${CONTAINER_ID})" ansible-playbook /etc/ansible/test.yml --syntax-check
|
||||
# Test role
|
||||
- sudo docker exec "$(cat ${CONTAINER_ID})" ansible-playbook /etc/ansible/test.yml
|
||||
# Clean up
|
||||
# Idempotence test
|
||||
- >
|
||||
sudo docker exec "$(cat ${CONTAINER_ID})" ansible-playbook /etc/ansible/test.yml
|
||||
| grep -q 'changed=0.*failed=0'
|
||||
&& (echo 'Idempotence test: pass' && exit 0)
|
||||
|| (echo 'Idempotence test: fail' && exit 1)
|
||||
|
||||
# Clean up
|
||||
- sudo docker stop "$(cat ${CONTAINER_ID})"
|
||||
|
||||
notifications:
|
||||
|
|
Loading…
Reference in a new issue