Test the current code, not the last release on Galaxy; colored output

This commit is contained in:
Bert Van Vreckem 2015-12-13 10:14:50 +01:00
parent b9d629ae98
commit 840423b1b9
3 changed files with 5 additions and 8 deletions

View file

@ -29,15 +29,15 @@ script:
#
# Run container in detached state
- sudo docker run --detach ${run_opts} ${distribution}:ansible "${init}" > "${container_id}"
- sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${distribution}:ansible "${init}" > "${container_id}"
# Syntax check
- sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/test.yml --syntax-check
- sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check
# Test role
- sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/test.yml
- sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml
# Idempotence test
- >
sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/test.yml
sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)

View file

@ -18,9 +18,6 @@ RUN yum clean all
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers
# Install Ansible inventory file
RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts
COPY requirements.yml /etc/ansible/requirements.yml
RUN ansible-galaxy install -r /etc/ansible/requirements.yml
COPY test.yml /etc/ansible/test.yml
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]

View file

@ -8,4 +8,4 @@
- servername: "example.com"
documentroot: "/var/www/vhosts/example_com"
roles:
- geerlingguy.apache
- role_under_test