diff options
Diffstat (limited to 'test/integration/targets/async_extra_data')
4 files changed, 34 insertions, 0 deletions
diff --git a/test/integration/targets/async_extra_data/aliases b/test/integration/targets/async_extra_data/aliases new file mode 100644 index 0000000..6452e6d --- /dev/null +++ b/test/integration/targets/async_extra_data/aliases @@ -0,0 +1,2 @@ +shippable/posix/group2 +context/target diff --git a/test/integration/targets/async_extra_data/library/junkping.py b/test/integration/targets/async_extra_data/library/junkping.py new file mode 100644 index 0000000..b61d965 --- /dev/null +++ b/test/integration/targets/async_extra_data/library/junkping.py @@ -0,0 +1,15 @@ +#!/usr/bin/python +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +import json + + +def main(): + print("junk_before_module_output") + print(json.dumps(dict(changed=False, source='user'))) + print("junk_after_module_output") + + +if __name__ == '__main__': + main() diff --git a/test/integration/targets/async_extra_data/runme.sh b/test/integration/targets/async_extra_data/runme.sh new file mode 100755 index 0000000..4613273 --- /dev/null +++ b/test/integration/targets/async_extra_data/runme.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -eux + +# Verify that extra data before module JSON output during async call is ignored, and that the warning exists. +ANSIBLE_DEBUG=0 ansible-playbook -i ../../inventory test_async.yml -v "$@" \ + | grep 'junk after the JSON data: junk_after_module_output' diff --git a/test/integration/targets/async_extra_data/test_async.yml b/test/integration/targets/async_extra_data/test_async.yml new file mode 100644 index 0000000..480a2a6 --- /dev/null +++ b/test/integration/targets/async_extra_data/test_async.yml @@ -0,0 +1,10 @@ +- hosts: testhost + gather_facts: false + tasks: + # make sure non-JSON data before module output is ignored + - name: async ping wrapped in extra junk + junkping: + async: 10 + poll: 1 + register: result + - debug: var=result |