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
18
.travis.yml
18
.travis.yml
|
@ -18,8 +18,17 @@ 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
|
||||
|
@ -28,8 +37,17 @@ script:
|
|||
# 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
|
||||
# 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})"
|
||||
|
||||
|
|
Loading…
Reference in a new issue