Skip to content

Commit

Permalink
Add ability for playbooks to skip checking the results
Browse files Browse the repository at this point in the history
If "SKIPPED" file found in the testing dir after running first
ansible-playbook, run.sh skips checking that test.
  • Loading branch information
yaegashi committed Apr 29, 2015
1 parent 405c100 commit 45c9484
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/run.sh
Expand Up @@ -13,10 +13,17 @@ run() {
testing_dir="$PWD/testing/$base"
expected_dir="$PWD/expected/$base"
idlog="$PWD/testing/$base-id.log"
skipped="$testing_dir/SKIPPED"
echo "$p: Running ansible-playbook"
if ! ansible-playbook -v -i hosts -e testing_dir=$testing_dir $p; then
echo "$p: ansible-playbook failed"
exit 1
echo -n "$p: "
if test -e $skipped; then
cat $skipped
exit 2
else
echo "ansible-playbook failed"
exit 1
fi
fi
echo "$p: Running ansible-playbook again"
ansible-playbook -v -i hosts -e testing_dir=$testing_dir $p | tee $idlog
Expand All @@ -40,6 +47,8 @@ for i in $tests; do
echo "$i: Starting..."
if ( run $i ); then
echo "$i: Passed"
elif test $? = 2; then
echo "$i: Skipped"
else
echo "$i: Failed"
code=1
Expand Down
3 changes: 3 additions & 0 deletions tests/test-follow.yml
Expand Up @@ -4,6 +4,9 @@
roles:
- ../..
tasks:
- shell: echo "Detected Ansible prior to 1.8" > {{testing_dir}}/SKIPPED
&& false
when: ansible_version is not defined
- name: update symlink file without follow
blockinfile: |
dest={{testing_dir}}/link0.txt backup=yes follow=no
Expand Down

0 comments on commit 45c9484

Please sign in to comment.