From ccfb1fbcb74bb7985cdba16f6105f56f1d555ca0 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sun, 28 Aug 2016 22:10:47 -0500 Subject: [PATCH] Better Travis idempotence test. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3792fd2..c88d3e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,8 +51,10 @@ script: - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml' # Test role idempotence. + - idempotence=$(mktemp) + - sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml | tee -a ${idempotence} - > - sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml + tail ${idempotence} | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)