diff options
author | Sam Doran <sdoran@redhat.com> | 2021-01-14 09:35:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-14 09:35:39 -0500 |
commit | 0e6c334115976e1df5de7765131d0ccdf01624bf (patch) | |
tree | a25c6ff0011548c563cbf9c285fb2e495d151639 /test/integration/targets/pause/runme.sh | |
parent | 7f0eb7ad799e531a8fbe5cc4f46046a4b1aeb093 (diff) | |
download | ansible-0e6c334115976e1df5de7765131d0ccdf01624bf.tar.gz |
pause - adjust warning when run in background (#73182)
When the pause module is run in the background and seconds parameter is provided,
do not warn.
* Add tests
* Fix existing tests
The test wasn't failing when it should have.
Diffstat (limited to 'test/integration/targets/pause/runme.sh')
-rwxr-xr-x | test/integration/targets/pause/runme.sh | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/test/integration/targets/pause/runme.sh b/test/integration/targets/pause/runme.sh index 932f49ec2d..eb2c6f7c7e 100755 --- a/test/integration/targets/pause/runme.sh +++ b/test/integration/targets/pause/runme.sh @@ -4,8 +4,8 @@ set -eux ANSIBLE_ROLES_PATH=../ ansible-playbook setup.yml -# Test pause module when no tty and non-interactive. This is to prevent playbooks -# from hanging in cron and Tower jobs. +# Test pause module when no tty and non-interactive with no seconds parameter. +# This is to prevent playbooks from hanging in cron and Tower jobs. /usr/bin/env bash << EOF ansible-playbook test-pause-no-tty.yml 2>&1 | \ grep '\[WARNING\]: Not waiting for response to prompt as stdin is not interactive' && { @@ -17,11 +17,24 @@ ansible-playbook test-pause-no-tty.yml 2>&1 | \ } EOF +# Do not issue a warning when run in the background if a timeout is given +# https://github.com/ansible/ansible/issues/73042 +if sleep 0 | ansible localhost -m pause -a 'seconds=1' 2>&1 | grep '\[WARNING\]: Not waiting for response'; then + echo "Incorrectly issued warning when run in the background" + exit 1 +else + echo "Succesfully ran in the background with no warning" +fi + # Test redirecting stdout -# Issue #41717 -ansible-playbook pause-3.yml > /dev/null \ - && echo "Successfully redirected stdout" \ - || echo "Failure when attempting to redirect stdout" +# https://github.com/ansible/ansible/issues/41717 +if ansible-playbook pause-3.yml > /dev/null ; then + echo "Successfully redirected stdout" +else + echo "Failure when attempting to redirect stdout" + exit 1 +fi + # Test pause with seconds and minutes specified ansible-playbook test-pause.yml "$@" |