ansible/test/integration/targets/pause/test-pause.yml
Sam Doran 4b8cb6582b
pause - do not hang if run in the background ()
* Consolidate logic for determining whether or not session is interactive
  into a single function, is_interactive()
* Increase test coverage

I wasn't able to find a good way of simulating running a backgrounded test with CI since the
whole test is essentially run not in a TTY, which is similar enough to cause the new is_interactive()
function to always return false.
2020-11-12 12:22:57 -05:00

51 lines
1 KiB
YAML

- name: Test pause
hosts: localhost
gather_facts: no
become: no
tasks:
- name: non-integer for duraction (EXPECTED FAILURE)
pause:
seconds: hello
register: result
ignore_errors: yes
- assert:
that:
- result is failed
- "'non-integer' in result.msg"
- name: non-boolean for echo (EXPECTED FAILURE)
pause:
echo: hello
register: result
ignore_errors: yes
- assert:
that:
- result is failed
- "'not a valid boolean' in result.msg"
- pause:
seconds: 0.1
register: results
- assert:
that:
- results.stdout is search('Paused for \d+\.\d+ seconds')
- pause:
seconds: 1
register: results
- assert:
that:
- results.stdout is search('Paused for \d+\.\d+ seconds')
- pause:
minutes: 1
register: results
- assert:
that:
- results.stdout is search('Paused for \d+\.\d+ minutes')