Add intentional coverage for an async_wrapper case (#70593)

Change:
- Test async_wrapper when the module it runs has stderr output

Test Plan:
- CI
- Looked at coverage report and saw green for a few lines that weren't
  previously green.

Signed-off-by: Rick Elrod <rick@elrod.me>
This commit is contained in:
Rick Elrod 2020-07-13 11:58:14 -05:00 committed by GitHub
parent e5649ca3e8
commit d16018fe72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -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:

View file

@ -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