diff --git a/test/integration/targets/async/library/async_test.py b/test/integration/targets/async/library/async_test.py index 723058ab871..f89bd10e74c 100644 --- a/test/integration/targets/async/library/async_test.py +++ b/test/integration/targets/async/library/async_test.py @@ -36,6 +36,9 @@ def main(): if 'exception' in fail_mode: raise Exception('failing via exception') + if 'stderr' in fail_mode: + print('printed to stderr', file=sys.stderr) + module.exit_json(**result) finally: diff --git a/test/integration/targets/async/tasks/main.yml b/test/integration/targets/async/tasks/main.yml index f84ad9b3f31..b1925d25599 100644 --- a/test/integration/targets/async/tasks/main.yml +++ b/test/integration/targets/async/tasks/main.yml @@ -165,6 +165,18 @@ - async_result is successful - async_result.warnings[0] is search('trailing junk after module output') +- name: test stderr handling + async_test: + fail_mode: stderr + async: 30 + poll: 1 + register: async_result + ignore_errors: true + +- assert: + that: + - async_result.stderr == "printed to stderr\n" + # NOTE: This should report a warning that cannot be tested - name: test async properties on non-async task command: sleep 1