From cfa588854770fba5f4e8563c2857a7aab0cd88ae Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Tue, 7 Sep 2021 22:10:25 +0100 Subject: [PATCH] tests: Print variables on failure of assert tasks Fixes #852 --- tests/ansible/integration/action/copy.yml | 1 + .../ansible/integration/action/fixup_perms2__copy.yml | 5 +++++ .../integration/action/low_level_execute_command.yml | 2 ++ tests/ansible/integration/action/make_tmp_path.yml | 7 +++++++ .../ansible/integration/action/remote_expand_user.yml | 6 ++++++ .../ansible/integration/action/remote_file_exists.yml | 2 ++ tests/ansible/integration/action/remove_tmp_path.yml | 2 ++ tests/ansible/integration/action/synchronize.yml | 1 + tests/ansible/integration/action/transfer_data.yml | 2 ++ .../ansible/integration/async/multiple_items_loop.yml | 1 + .../integration/async/result_binary_producing_json.yml | 2 ++ .../integration/async/result_binary_producing_junk.yml | 1 + .../ansible/integration/async/result_shell_echo_hi.yml | 2 ++ tests/ansible/integration/async/runner_new_process.yml | 3 +++ tests/ansible/integration/async/runner_one_job.yml | 4 ++++ .../integration/async/runner_timeout_then_polling.yml | 1 + .../integration/async/runner_two_simultaneous_jobs.yml | 2 ++ .../async/runner_with_polling_and_timeout.yml | 1 + tests/ansible/integration/become/su_password.yml | 3 +++ .../ansible/integration/become/sudo_flags_failure.yml | 1 + tests/ansible/integration/become/sudo_nonexistent.yml | 1 + tests/ansible/integration/become/sudo_nopassword.yml | 2 ++ tests/ansible/integration/become/sudo_password.yml | 2 ++ tests/ansible/integration/connection/_put_file.yml | 1 + .../integration/connection/become_same_user.yml | 2 ++ .../connection/disconnect_during_module.yml | 1 + tests/ansible/integration/connection/exec_command.yml | 1 + tests/ansible/integration/connection/reset.yml | 1 + tests/ansible/integration/connection/reset_become.yml | 3 +++ .../integration/connection_loader/local_blemished.yml | 1 + .../connection_loader/paramiko_unblemished.yml | 1 + .../integration/connection_loader/ssh_blemished.yml | 1 + .../integration/context_service/reconnection.yml | 1 + .../integration/context_service/remote_name.yml | 2 ++ tests/ansible/integration/glibc_caches/resolv_conf.yml | 1 + .../interpreter_discovery/ansible_2_8_tests.yml | 8 ++++++++ tests/ansible/integration/local/cwd_preserved.yml | 1 + .../integration/module_utils/adjacent_to_playbook.yml | 1 + .../integration/module_utils/from_config_path.yml | 1 + .../integration/module_utils/from_config_path_pkg.yml | 1 + .../module_utils/roles/modrole/tasks/main.yml | 1 + .../roles/overrides_modrole/tasks/main.yml | 1 + .../integration/playbook_semantics/become_flags.yml | 2 ++ .../integration/playbook_semantics/environment.yml | 1 + .../integration/runner/_etc_environment_global.yml | 3 +++ .../integration/runner/_etc_environment_user.yml | 3 +++ tests/ansible/integration/runner/atexit.yml | 1 + .../integration/runner/builtin_command_module.yml | 1 + .../integration/runner/crashy_new_style_module.yml | 1 + .../runner/custom_bash_hashbang_argument.yml | 1 + .../runner/custom_bash_old_style_module.yml | 1 + .../runner/custom_bash_want_json_module.yml | 1 + .../runner/custom_binary_producing_json.yml | 1 + .../runner/custom_binary_producing_junk.yml | 1 + .../integration/runner/custom_binary_single_null.yml | 1 + .../runner/custom_perl_json_args_module.yml | 2 ++ .../runner/custom_perl_want_json_module.yml | 2 ++ .../runner/custom_python_json_args_module.yml | 1 + .../custom_python_new_style_missing_interpreter.yml | 1 + .../runner/custom_python_new_style_module.yml | 2 ++ .../runner/custom_python_prehistoric_module.yml | 4 +++- .../runner/custom_python_want_json_module.yml | 1 + .../integration/runner/custom_script_interpreter.yml | 1 + .../integration/runner/environment_isolation.yml | 4 ++++ tests/ansible/integration/runner/forking_active.yml | 1 + .../integration/runner/forking_correct_parent.yml | 3 +++ tests/ansible/integration/runner/forking_inactive.yml | 1 + tests/ansible/integration/runner/missing_module.yml | 1 + tests/ansible/integration/ssh/config.yml | 1 + tests/ansible/integration/ssh/timeouts.yml | 1 + tests/ansible/integration/ssh/variables.yml | 4 ++++ .../integration/strategy/_mixed_mitogen_vanilla.yml | 6 ++++++ .../integration/strategy/_mixed_vanilla_mitogen.yml | 6 ++++++ tests/ansible/integration/stub_connections/kubectl.yml | 1 + tests/ansible/integration/stub_connections/lxc.yml | 1 + tests/ansible/integration/stub_connections/lxd.yml | 1 + .../integration/stub_connections/mitogen_doas.yml | 1 + .../integration/stub_connections/mitogen_sudo.yml | 2 ++ .../ansible/integration/stub_connections/setns_lxc.yml | 1 + .../ansible/integration/stub_connections/setns_lxd.yml | 1 + tests/ansible/integration/transport/kubectl.yml | 10 ++++++++-- tests/ansible/integration/transport_config/become.yml | 4 ++++ .../integration/transport_config/become_method.yml | 5 +++++ .../integration/transport_config/become_pass.yml | 9 +++++++++ .../integration/transport_config/become_user.yml | 6 ++++++ tests/ansible/integration/transport_config/port.yml | 8 ++++++++ .../issue_109__target_has_old_ansible_installed.yml | 1 + .../regression/issue_113__duplicate_module_imports.yml | 1 + .../issue_152__local_action_wrong_interpreter.yml | 1 + .../regression/issue_152__virtualenv_python_fails.yml | 1 + .../regression/issue_154__module_state_leaks.yml | 1 + .../issue_332_ansiblemoduleerror_first_occurrence.yml | 1 + .../ansible/regression/issue_590__sys_modules_crap.yml | 1 + 93 files changed, 198 insertions(+), 3 deletions(-) diff --git a/tests/ansible/integration/action/copy.yml b/tests/ansible/integration/action/copy.yml index b34b9831..1cab2b34 100644 --- a/tests/ansible/integration/action/copy.yml +++ b/tests/ansible/integration/action/copy.yml @@ -63,6 +63,7 @@ - stat.results[1].stat.checksum == "62951f943c41cdd326e5ce2b53a779e7916a820d" - stat.results[2].stat.checksum == "b26dd6444595e2bdb342aa0a91721b57478b5029" - stat.results[3].stat.checksum == "d675f47e467eae19e49032a2cc39118e12a6ee72" + fail_msg: stat={{stat}} - file: state: absent diff --git a/tests/ansible/integration/action/fixup_perms2__copy.yml b/tests/ansible/integration/action/fixup_perms2__copy.yml index 1331f9bb..e5b10005 100644 --- a/tests/ansible/integration/action/fixup_perms2__copy.yml +++ b/tests/ansible/integration/action/fixup_perms2__copy.yml @@ -21,6 +21,7 @@ - assert: that: - out.stat.mode in ("0644", "0664") + fail_msg: out={{out}} # # copy module (explicit mode). @@ -37,6 +38,7 @@ - assert: that: - out.stat.mode == "0400" + fail_msg: out={{out}} # # copy module (existing disk files, no mode). @@ -63,6 +65,7 @@ - assert: that: - out.stat.mode in ("0644", "0664") + fail_msg: out={{out}} # # copy module (existing disk files, preserve mode). @@ -79,6 +82,7 @@ - assert: that: - out.stat.mode == "1462" + fail_msg: out={{out}} # # copy module (existing disk files, explicit mode). @@ -96,6 +100,7 @@ - assert: that: - out.stat.mode == "1461" + fail_msg: out={{out}} - file: state: absent diff --git a/tests/ansible/integration/action/low_level_execute_command.yml b/tests/ansible/integration/action/low_level_execute_command.yml index 7c14cb22..7dc74473 100644 --- a/tests/ansible/integration/action/low_level_execute_command.yml +++ b/tests/ansible/integration/action/low_level_execute_command.yml @@ -16,6 +16,7 @@ - 'raw.rc == 0' - 'raw.stdout_lines[-1]|to_text == "2"' - 'raw.stdout[-1]|to_text == "2"' + fail_msg: raw={{raw}} - name: Run raw module with sudo become: true @@ -39,3 +40,4 @@ ["root\r\n"], ["root"], ) + fail_msg: raw={{raw}} diff --git a/tests/ansible/integration/action/make_tmp_path.yml b/tests/ansible/integration/action/make_tmp_path.yml index 0a018d4c..ab2db0fb 100644 --- a/tests/ansible/integration/action/make_tmp_path.yml +++ b/tests/ansible/integration/action/make_tmp_path.yml @@ -44,11 +44,13 @@ assert: that: - good_temp_path == good_temp_path2 + fail_msg: good_temp_path={{good_temp_path}} good_temp_path2={{good_temp_path2}} - name: "Verify different subdir for both tasks" assert: that: - tmp_path.path != tmp_path2.path + fail_msg: tmp_path={{tmp_path}} tmp_path2={{tmp_path2}} # # Verify subdirectory removal. @@ -69,6 +71,7 @@ that: - not stat1.stat.exists - not stat2.stat.exists + fail_msg: stat1={{stat1}} stat2={{stat2}} # # Verify good directory persistence. @@ -83,6 +86,7 @@ assert: that: - stat.stat.exists + fail_msg: stat={{stat}} # # Write some junk into the temp path. @@ -105,6 +109,7 @@ - assert: that: - not out.stat.exists + fail_msg: out={{out}} # # root @@ -123,6 +128,7 @@ that: - tmp_path2.path != tmp_path_root.path - tmp_path2.path|dirname != tmp_path_root.path|dirname + fail_msg: tmp_path_root={{tmp_path_root}} tmp_path2={{tmp_path2}} # # readonly homedir @@ -153,3 +159,4 @@ that: - out.module_path.startswith(good_temp_path2) - out.module_tmpdir.startswith(good_temp_path2) + fail_msg: out={{out}} diff --git a/tests/ansible/integration/action/remote_expand_user.yml b/tests/ansible/integration/action/remote_expand_user.yml index 37fc5ebe..851da502 100644 --- a/tests/ansible/integration/action/remote_expand_user.yml +++ b/tests/ansible/integration/action/remote_expand_user.yml @@ -27,6 +27,7 @@ register: out - assert: that: out.result == '{{user_facts.ansible_facts.ansible_user_dir}}/foo' + fail_msg: out={{out}} - name: "Expand ~/foo with become active. ~ is become_user's home." action_passthrough: @@ -49,6 +50,7 @@ register: out - assert: that: out.result == '{{user_facts.ansible_facts.ansible_user_dir}}/foo' + fail_msg: out={{out}} - name: "Expanding $HOME/foo has no effect." action_passthrough: @@ -59,6 +61,7 @@ register: out - assert: that: out.result == '$HOME/foo' + fail_msg: out={{out}} # ------------------------ @@ -71,6 +74,7 @@ register: out - assert: that: out.result == '{{user_facts.ansible_facts.ansible_user_dir}}/foo' + fail_msg: out={{out}} - name: "sudoable; Expand ~/foo with become active. ~ is become_user's home." action_passthrough: @@ -94,6 +98,7 @@ register: out - assert: that: out.result == '{{user_facts.ansible_facts.ansible_user_dir}}/foo' + fail_msg: out={{out}} - name: "sudoable; Expanding $HOME/foo has no effect." action_passthrough: @@ -104,3 +109,4 @@ register: out - assert: that: out.result == '$HOME/foo' + fail_msg: out={{out}} diff --git a/tests/ansible/integration/action/remote_file_exists.yml b/tests/ansible/integration/action/remote_file_exists.yml index 20a825c8..209f7830 100644 --- a/tests/ansible/integration/action/remote_file_exists.yml +++ b/tests/ansible/integration/action/remote_file_exists.yml @@ -15,6 +15,7 @@ - assert: that: out.result == False + fail_msg: out={{out}} # --- @@ -29,6 +30,7 @@ - assert: that: out.result == True + fail_msg: out={{out}} - file: path: /tmp/does-exist diff --git a/tests/ansible/integration/action/remove_tmp_path.yml b/tests/ansible/integration/action/remove_tmp_path.yml index 7a0c6c25..19d18e34 100644 --- a/tests/ansible/integration/action/remove_tmp_path.yml +++ b/tests/ansible/integration/action/remove_tmp_path.yml @@ -23,6 +23,7 @@ - assert: that: - not out2.stat.exists + fail_msg: out={{out}} - stat: path: "{{out.src|dirname}}" @@ -31,6 +32,7 @@ - assert: that: - not out2.stat.exists + fail_msg: out={{out}} - file: path: /tmp/remove_tmp_path_test diff --git a/tests/ansible/integration/action/synchronize.yml b/tests/ansible/integration/action/synchronize.yml index 31cfe553..64ff9735 100644 --- a/tests/ansible/integration/action/synchronize.yml +++ b/tests/ansible/integration/action/synchronize.yml @@ -60,6 +60,7 @@ - assert: that: outout == "item!" + fail_msg: outout={{outout}} when: False # TODO: https://github.com/dw/mitogen/issues/692 diff --git a/tests/ansible/integration/action/transfer_data.yml b/tests/ansible/integration/action/transfer_data.yml index bbd39309..0f56672c 100644 --- a/tests/ansible/integration/action/transfer_data.yml +++ b/tests/ansible/integration/action/transfer_data.yml @@ -24,6 +24,7 @@ - assert: that: | out.content|b64decode == '{"I am JSON": true}' + fail_msg: out={{out}} # Ensure it handles strings. @@ -40,6 +41,7 @@ - assert: that: out.content|b64decode == 'I am text.' + fail_msg: out={{out}} - file: path: /tmp/transfer-data diff --git a/tests/ansible/integration/async/multiple_items_loop.yml b/tests/ansible/integration/async/multiple_items_loop.yml index 9a9b1192..05db9652 100644 --- a/tests/ansible/integration/async/multiple_items_loop.yml +++ b/tests/ansible/integration/async/multiple_items_loop.yml @@ -34,3 +34,4 @@ - out.results[1].stdout == 'hi-from-job-2' - out.results[1].rc == 0 - out.results[1].delta > '0:00:05' + fail_msg: out={{out}} diff --git a/tests/ansible/integration/async/result_binary_producing_json.yml b/tests/ansible/integration/async/result_binary_producing_json.yml index f81d0bb2..427fa58b 100644 --- a/tests/ansible/integration/async/result_binary_producing_json.yml +++ b/tests/ansible/integration/async/result_binary_producing_json.yml @@ -28,6 +28,7 @@ (job.started == 1) and (job.changed == True) and (job.finished == 0) + fail_msg: job={{job}} - name: busy-poll up to 100000 times async_status: @@ -51,5 +52,6 @@ - async_out.failed == False - async_out.msg == "Hello, world." - 'async_out.stderr == "binary_producing_json: oh noes\n"' + fail_msg: async_out={{async_out}} vars: async_out: "{{result.content|b64decode|from_json}}" diff --git a/tests/ansible/integration/async/result_binary_producing_junk.yml b/tests/ansible/integration/async/result_binary_producing_junk.yml index 87877db7..25ad65cf 100644 --- a/tests/ansible/integration/async/result_binary_producing_junk.yml +++ b/tests/ansible/integration/async/result_binary_producing_junk.yml @@ -39,5 +39,6 @@ - async_out.msg.startswith("Traceback") - '"ValueError: No start of json char found\n" in async_out.msg' - 'async_out.stderr == "binary_producing_junk: oh noes\n"' + fail_msg: async_out={{async_out}} vars: async_out: "{{result.content|b64decode|from_json}}" diff --git a/tests/ansible/integration/async/result_shell_echo_hi.yml b/tests/ansible/integration/async/result_shell_echo_hi.yml index e1068587..047913e5 100644 --- a/tests/ansible/integration/async/result_shell_echo_hi.yml +++ b/tests/ansible/integration/async/result_shell_echo_hi.yml @@ -35,12 +35,14 @@ - async_out.start.startswith("20") - async_out.stderr == "there" - async_out.stdout == "hi" + fail_msg: async_out={{async_out}} vars: async_out: "{{result.content|b64decode|from_json}}" - assert: that: - async_out.invocation.module_args.stdin == None + fail_msg: async_out={{async_out}} when: ansible_version.full > '2.4' vars: async_out: "{{result.content|b64decode|from_json}}" diff --git a/tests/ansible/integration/async/runner_new_process.yml b/tests/ansible/integration/async/runner_new_process.yml index 7b0bf628..1644364f 100644 --- a/tests/ansible/integration/async/runner_new_process.yml +++ b/tests/ansible/integration/async/runner_new_process.yml @@ -16,6 +16,7 @@ - assert: that: - sync_proc1.pid == sync_proc2.pid + fail_msg: sync_proc1={{sync_proc1}} sync_proc2={{sync_proc2}} when: is_mitogen - name: get async process ID. @@ -48,7 +49,9 @@ - assert: that: + # FIXME should this be async_proc1, and async_proc2? - sync_proc1.pid == sync_proc2.pid - async_result1.pid != sync_proc1.pid - async_result1.pid != async_result2.pid + fail_msg: async_result1={{async_result1}} async_result2={{async_result2}} when: is_mitogen diff --git a/tests/ansible/integration/async/runner_one_job.yml b/tests/ansible/integration/async/runner_one_job.yml index bea6ed9c..b8a7a564 100644 --- a/tests/ansible/integration/async/runner_one_job.yml +++ b/tests/ansible/integration/async/runner_one_job.yml @@ -24,6 +24,7 @@ (job1.started == 1) and (job1.changed == True) and (job1.finished == 0) + fail_msg: job1={{job1}} - name: busy-poll up to 100000 times async_status: @@ -48,6 +49,7 @@ - result1.start|length == 26 - result1.finished == 1 - result1.rc == 0 + fail_msg: result1={{result1}} - assert: that: @@ -55,9 +57,11 @@ - result1.stderr_lines == [] - result1.stdout == "alldone" - result1.stdout_lines == ["alldone"] + fail_msg: result1={{result1}} when: ansible_version.full is version('2.8', '>') # ansible#51393 - assert: that: - result1.failed == False + fail_msg: result1={{result1}} when: ansible_version.full is version('2.4', '>') diff --git a/tests/ansible/integration/async/runner_timeout_then_polling.yml b/tests/ansible/integration/async/runner_timeout_then_polling.yml index 5490e711..0847a95f 100644 --- a/tests/ansible/integration/async/runner_timeout_then_polling.yml +++ b/tests/ansible/integration/async/runner_timeout_then_polling.yml @@ -31,4 +31,5 @@ - result.failed == 1 - result.finished == 1 - result.msg == "Job reached maximum time limit of 1 seconds." + fail_msg: result={{result}} when: is_mitogen diff --git a/tests/ansible/integration/async/runner_two_simultaneous_jobs.yml b/tests/ansible/integration/async/runner_two_simultaneous_jobs.yml index fdde0463..fd5292d1 100644 --- a/tests/ansible/integration/async/runner_two_simultaneous_jobs.yml +++ b/tests/ansible/integration/async/runner_two_simultaneous_jobs.yml @@ -56,8 +56,10 @@ that: - result1.rc == 0 - result2.rc == 0 + fail_msg: result1={{result1}} result2={{result2}} - assert: that: - result2.stdout == 'im_alive' + fail_msg: result2={{result2}} when: ansible_version.full > '2.8' # ansible#51393 diff --git a/tests/ansible/integration/async/runner_with_polling_and_timeout.yml b/tests/ansible/integration/async/runner_with_polling_and_timeout.yml index dcfa186f..c7d9338e 100644 --- a/tests/ansible/integration/async/runner_with_polling_and_timeout.yml +++ b/tests/ansible/integration/async/runner_with_polling_and_timeout.yml @@ -22,4 +22,5 @@ job1.msg == "async task did not complete within the requested time" or job1.msg == "async task did not complete within the requested time - 1s" or job1.msg == "Job reached maximum time limit of 1 seconds." + fail_msg: job1={{job1}} diff --git a/tests/ansible/integration/become/su_password.yml b/tests/ansible/integration/become/su_password.yml index f6eb0b47..9e1d0cf4 100644 --- a/tests/ansible/integration/become/su_password.yml +++ b/tests/ansible/integration/become/su_password.yml @@ -22,6 +22,7 @@ ('password is required' in out.msg) or ('password is required' in out.module_stderr) ) + fail_msg: out={{out}} when: is_mitogen @@ -41,6 +42,7 @@ ('Incorrect su password' in out.msg) or ('su password is incorrect' in out.msg) ) + fail_msg: out={{out}} when: is_mitogen - name: Ensure password su succeeds. @@ -55,4 +57,5 @@ - assert: that: - out.stdout == 'mitogen__user1' + fail_msg: out={{out}} when: is_mitogen diff --git a/tests/ansible/integration/become/sudo_flags_failure.yml b/tests/ansible/integration/become/sudo_flags_failure.yml index 39fbb4b8..290f1356 100644 --- a/tests/ansible/integration/become/sudo_flags_failure.yml +++ b/tests/ansible/integration/become/sudo_flags_failure.yml @@ -20,3 +20,4 @@ ("sudo: invalid option -- '-'" in out.module_stderr) or ("sudo: unrecognized option `--derps'" in out.module_stderr) or ("sudo: unrecognized option '--derps'" in out.module_stderr) + fail_msg: out={{out}} diff --git a/tests/ansible/integration/become/sudo_nonexistent.yml b/tests/ansible/integration/become/sudo_nonexistent.yml index 09ab91bb..3f6a2dc6 100644 --- a/tests/ansible/integration/become/sudo_nonexistent.yml +++ b/tests/ansible/integration/become/sudo_nonexistent.yml @@ -19,3 +19,4 @@ - >- ('sudo: unknown user: slartibartfast' in out.module_stderr | default(out.msg)) or (ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_version == '6.10') + fail_msg: out={{out}} diff --git a/tests/ansible/integration/become/sudo_nopassword.yml b/tests/ansible/integration/become/sudo_nopassword.yml index 03644423..6b074667 100644 --- a/tests/ansible/integration/become/sudo_nopassword.yml +++ b/tests/ansible/integration/become/sudo_nopassword.yml @@ -12,6 +12,7 @@ - assert: that: - out.stdout != 'root' + fail_msg: out={{out}} - name: Ensure passwordless sudo to root succeeds. shell: whoami @@ -22,3 +23,4 @@ - assert: that: - out.stdout == 'root' + fail_msg: out={{out}} diff --git a/tests/ansible/integration/become/sudo_password.yml b/tests/ansible/integration/become/sudo_password.yml index 145c8d69..6653c3e9 100644 --- a/tests/ansible/integration/become/sudo_password.yml +++ b/tests/ansible/integration/become/sudo_password.yml @@ -19,6 +19,7 @@ ('Missing sudo password' in out.msg) or ('password is required' in out.module_stderr) ) + fail_msg: out={{out}} - name: Ensure password sudo incorrect. shell: whoami @@ -35,6 +36,7 @@ ('Incorrect sudo password' in out.msg) or ('sudo password is incorrect' in out.msg) ) + fail_msg: out={{out}} # TODO: https://github.com/dw/mitogen/issues/692 # - name: Ensure password sudo succeeds. diff --git a/tests/ansible/integration/connection/_put_file.yml b/tests/ansible/integration/connection/_put_file.yml index 5b661d9f..3092e199 100644 --- a/tests/ansible/integration/connection/_put_file.yml +++ b/tests/ansible/integration/connection/_put_file.yml @@ -21,3 +21,4 @@ - original.stat.checksum == copied.stat.checksum # Upstream does not preserve timestamps at al. #- (not is_mitogen) or (original.stat.mtime|int == copied.stat.mtime|int) + fail_msg: original={{original}} copied={{copied}} diff --git a/tests/ansible/integration/connection/become_same_user.yml b/tests/ansible/integration/connection/become_same_user.yml index d73eca86..7e5e5244 100644 --- a/tests/ansible/integration/connection/become_same_user.yml +++ b/tests/ansible/integration/connection/become_same_user.yml @@ -19,6 +19,7 @@ - out.result[0].method == "ssh" - out.result[0].kwargs.username == "joe" - out.result|length == 1 # no sudo + fail_msg: out={{out}} when: is_mitogen @@ -36,4 +37,5 @@ - out.result[1].method == "sudo" - out.result[1].kwargs.username == "james" - out.result|length == 2 # no sudo + fail_msg: out={{out}} when: is_mitogen diff --git a/tests/ansible/integration/connection/disconnect_during_module.yml b/tests/ansible/integration/connection/disconnect_during_module.yml index e628e68e..723f61fc 100644 --- a/tests/ansible/integration/connection/disconnect_during_module.yml +++ b/tests/ansible/integration/connection/disconnect_during_module.yml @@ -25,3 +25,4 @@ that: - out.rc == 4 - "'Mitogen was disconnected from the remote environment while a call was in-progress.' in out.stdout" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/connection/exec_command.yml b/tests/ansible/integration/connection/exec_command.yml index 105505d1..a0dd71f7 100644 --- a/tests/ansible/integration/connection/exec_command.yml +++ b/tests/ansible/integration/connection/exec_command.yml @@ -17,3 +17,4 @@ - out.result[0] == 0 - out.result[1].decode() == "hello, world\r\n" - out.result[2].decode().startswith("Shared connection to ") + fail_msg: out={{out}} diff --git a/tests/ansible/integration/connection/reset.yml b/tests/ansible/integration/connection/reset.yml index 768cd2d5..431f795b 100644 --- a/tests/ansible/integration/connection/reset.yml +++ b/tests/ansible/integration/connection/reset.yml @@ -43,3 +43,4 @@ # sudo PID has changed. - out_become.ppid != out_become2.ppid + fail_msg: out={{out}} out2={{out2}} out_become={{out_become}} out_become2={{out_become2}} diff --git a/tests/ansible/integration/connection/reset_become.yml b/tests/ansible/integration/connection/reset_become.yml index 5a411e82..2b4161f2 100644 --- a/tests/ansible/integration/connection/reset_become.yml +++ b/tests/ansible/integration/connection/reset_become.yml @@ -24,6 +24,7 @@ assert: that: - become_acct.pid != login_acct.pid + fail_msg: become_acct={{become_acct}} login_acct={{login_acct}} - name: reset the connection meta: reset_connection @@ -36,6 +37,7 @@ assert: that: - become_acct.pid != new_become_acct.pid + fail_msg: become_acct={{become_acct}} new_become_acct={{new_become_acct}} - name: save new pid of login acct become: false @@ -46,3 +48,4 @@ assert: that: - login_acct.pid != new_login_acct.pid + fail_msg: login_acct={{login_acct}} new_login_acct={{new_login_acct}} diff --git a/tests/ansible/integration/connection_loader/local_blemished.yml b/tests/ansible/integration/connection_loader/local_blemished.yml index d0fcabba..1592f973 100644 --- a/tests/ansible/integration/connection_loader/local_blemished.yml +++ b/tests/ansible/integration/connection_loader/local_blemished.yml @@ -12,3 +12,4 @@ - assert: that: (not not out.mitogen_loaded) == (not not is_mitogen) + fail_msg: out={{out}} diff --git a/tests/ansible/integration/connection_loader/paramiko_unblemished.yml b/tests/ansible/integration/connection_loader/paramiko_unblemished.yml index a48bd3ca..db1c8bd7 100644 --- a/tests/ansible/integration/connection_loader/paramiko_unblemished.yml +++ b/tests/ansible/integration/connection_loader/paramiko_unblemished.yml @@ -15,4 +15,5 @@ - assert: that: not out.mitogen_loaded + fail_msg: out={{out}} when: False diff --git a/tests/ansible/integration/connection_loader/ssh_blemished.yml b/tests/ansible/integration/connection_loader/ssh_blemished.yml index 04ada1e3..b97fe1ed 100644 --- a/tests/ansible/integration/connection_loader/ssh_blemished.yml +++ b/tests/ansible/integration/connection_loader/ssh_blemished.yml @@ -12,3 +12,4 @@ - assert: that: (not not out.mitogen_loaded) == (not not is_mitogen) + fail_msg: out={{out}} diff --git a/tests/ansible/integration/context_service/reconnection.yml b/tests/ansible/integration/context_service/reconnection.yml index eed1dfdb..c5cec967 100644 --- a/tests/ansible/integration/context_service/reconnection.yml +++ b/tests/ansible/integration/context_service/reconnection.yml @@ -31,3 +31,4 @@ - assert: that: - old_become_env.pid != new_become_env.pid + fail_msg: old_become_env={{old_become_env}} new_become_env={{new_become_env}} diff --git a/tests/ansible/integration/context_service/remote_name.yml b/tests/ansible/integration/context_service/remote_name.yml index d7116ec1..e2d9acac 100644 --- a/tests/ansible/integration/context_service/remote_name.yml +++ b/tests/ansible/integration/context_service/remote_name.yml @@ -18,6 +18,7 @@ - assert: that: - out.stdout is match('.*python([0-9.]+)?\(mitogen:[a-z]+@[^:]+:[0-9]+\)') + fail_msg: out={{out}} - shell: 'cat /proc/$PPID/cmdline | tr \\0 \\n' register: out @@ -28,4 +29,5 @@ - assert: that: - out.stdout is match('.*python([0-9.]+)?\(mitogen:ansible\)') + fail_msg: out={{out}} diff --git a/tests/ansible/integration/glibc_caches/resolv_conf.yml b/tests/ansible/integration/glibc_caches/resolv_conf.yml index da78c308..0f1ddf35 100644 --- a/tests/ansible/integration/glibc_caches/resolv_conf.yml +++ b/tests/ansible/integration/glibc_caches/resolv_conf.yml @@ -44,6 +44,7 @@ - out.failed - '"Name or service not known" in out.msg or "Temporary failure in name resolution" in out.msg' + fail_msg: out={{out}} when: | ansible_virtualization_type == "docker" and ansible_python_version > "2.5" diff --git a/tests/ansible/integration/interpreter_discovery/ansible_2_8_tests.yml b/tests/ansible/integration/interpreter_discovery/ansible_2_8_tests.yml index a4aec22f..d5e515b4 100644 --- a/tests/ansible/integration/interpreter_discovery/ansible_2_8_tests.yml +++ b/tests/ansible/integration/interpreter_discovery/ansible_2_8_tests.yml @@ -49,6 +49,7 @@ that: - auto_out.ansible_facts.discovered_interpreter_python is defined - echoout.running_python_interpreter == auto_out.ansible_facts.discovered_interpreter_python + fail_msg: auto_out={{auto_out}} echoout={{echoout}} - name: test that auto_legacy gives a dep warning when /usr/bin/python present but != auto result @@ -66,6 +67,7 @@ assert: that: - legacy.deprecations | default([]) | length > 0 + fail_msg: legacy={{legacy}} # only check for a dep warning if legacy returned /usr/bin/python and auto didn't when: legacy.ansible_facts.discovered_interpreter_python == '/usr/bin/python' and auto_out.ansible_facts.discovered_interpreter_python != '/usr/bin/python' @@ -86,6 +88,7 @@ that: - auto_silent_out.warnings is not defined - auto_silent_out.ansible_facts.discovered_interpreter_python == auto_out.ansible_facts.discovered_interpreter_python + fail_msg: auto_silent_out={{auto_silent_out}} - name: test that auto_legacy_silent never warns and got the same answer as auto_legacy @@ -103,6 +106,7 @@ that: - legacy_silent.warnings is not defined - legacy_silent.ansible_facts.discovered_interpreter_python == legacy.ansible_facts.discovered_interpreter_python + fail_msg: legacy_silent={{legacy_silent}} - name: ensure modules can't set discovered_interpreter_X or ansible_X_interpreter block: @@ -127,6 +131,7 @@ assert: that: - auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python3' + fail_msg: auto_out={{auto_out}} when: distro == 'fedora' and distro_version is version('23', '>=') - name: rhel assertions @@ -136,6 +141,7 @@ - (auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python' and distro_version is version('8','<')) or distro_version is version('8','>=') # rhel 8+ - (auto_out.ansible_facts.discovered_interpreter_python == '/usr/libexec/platform-python' and distro_version is version('8','>=')) or distro_version is version('8','<') + fail_msg: auto_out={{auto_out}} when: distro in ('redhat', 'centos') - name: ubuntu assertions @@ -145,12 +151,14 @@ - (auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python' and distro_version is version('16.04','<')) or distro_version is version('16.04','>=') # ubuntu >= 16 - (auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python3' and distro_version is version('16.04','>=')) or distro_version is version('16.04','<') + fail_msg: auto_out={{auto_out}} when: distro == 'ubuntu' - name: mac assertions assert: that: - auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python' + fail_msg: auto_out={{auto_out}} when: os_family == 'Darwin' always: diff --git a/tests/ansible/integration/local/cwd_preserved.yml b/tests/ansible/integration/local/cwd_preserved.yml index e5c0f7a4..5549f156 100644 --- a/tests/ansible/integration/local/cwd_preserved.yml +++ b/tests/ansible/integration/local/cwd_preserved.yml @@ -19,4 +19,5 @@ - assert: that: stat.stat.exists + fail_msg: stat={{stat}} diff --git a/tests/ansible/integration/module_utils/adjacent_to_playbook.yml b/tests/ansible/integration/module_utils/adjacent_to_playbook.yml index 63bd90b2..f47e147f 100644 --- a/tests/ansible/integration/module_utils/adjacent_to_playbook.yml +++ b/tests/ansible/integration/module_utils/adjacent_to_playbook.yml @@ -13,4 +13,5 @@ that: - out.external1_path == "ansible/integration/module_utils/module_utils/external1.py" - out.external2_path == "ansible/lib/module_utils/external2.py" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/module_utils/from_config_path.yml b/tests/ansible/integration/module_utils/from_config_path.yml index e469fe32..df3acd9b 100644 --- a/tests/ansible/integration/module_utils/from_config_path.yml +++ b/tests/ansible/integration/module_utils/from_config_path.yml @@ -12,4 +12,5 @@ that: - out.external1_path == "ansible/lib/module_utils/external1.py" - out.external2_path == "ansible/lib/module_utils/external2.py" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/module_utils/from_config_path_pkg.yml b/tests/ansible/integration/module_utils/from_config_path_pkg.yml index 5db3d124..81881aa1 100644 --- a/tests/ansible/integration/module_utils/from_config_path_pkg.yml +++ b/tests/ansible/integration/module_utils/from_config_path_pkg.yml @@ -11,4 +11,5 @@ - assert: that: - out.extmod_path == "ansible/lib/module_utils/externalpkg/extmod.py" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/module_utils/roles/modrole/tasks/main.yml b/tests/ansible/integration/module_utils/roles/modrole/tasks/main.yml index 2c7c3372..7686cae7 100644 --- a/tests/ansible/integration/module_utils/roles/modrole/tasks/main.yml +++ b/tests/ansible/integration/module_utils/roles/modrole/tasks/main.yml @@ -7,3 +7,4 @@ that: - out.external3_path == "integration/module_utils/roles/modrole/module_utils/external3.py" - out.external2_path == "integration/module_utils/roles/modrole/module_utils/external2.py" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/module_utils/roles/overrides_modrole/tasks/main.yml b/tests/ansible/integration/module_utils/roles/overrides_modrole/tasks/main.yml index 6ef4703a..11b1d8b9 100644 --- a/tests/ansible/integration/module_utils/roles/overrides_modrole/tasks/main.yml +++ b/tests/ansible/integration/module_utils/roles/overrides_modrole/tasks/main.yml @@ -6,3 +6,4 @@ - assert: that: - out.path == "ansible/integration/module_utils/roles/override_modrole/module_utils/known_hosts.py" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/playbook_semantics/become_flags.yml b/tests/ansible/integration/playbook_semantics/become_flags.yml index f2ab0b5d..96a283da 100644 --- a/tests/ansible/integration/playbook_semantics/become_flags.yml +++ b/tests/ansible/integration/playbook_semantics/become_flags.yml @@ -14,6 +14,7 @@ - assert: that: "out.stdout == ''" + fail_msg: out={{out}} - hosts: test-targets any_errors_fatal: true @@ -28,3 +29,4 @@ - assert: that: "out2.stdout == '2'" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/playbook_semantics/environment.yml b/tests/ansible/integration/playbook_semantics/environment.yml index 1ac7f71d..7d6b5184 100644 --- a/tests/ansible/integration/playbook_semantics/environment.yml +++ b/tests/ansible/integration/playbook_semantics/environment.yml @@ -11,3 +11,4 @@ - assert: that: "result.stdout == '123'" + fail_msg: result={{result}} diff --git a/tests/ansible/integration/runner/_etc_environment_global.yml b/tests/ansible/integration/runner/_etc_environment_global.yml index 2d22b952..7b769ef4 100644 --- a/tests/ansible/integration/runner/_etc_environment_global.yml +++ b/tests/ansible/integration/runner/_etc_environment_global.yml @@ -10,6 +10,7 @@ - assert: that: echo.stdout == "" + fail_msg: echo={{echo}} - copy: dest: /etc/environment @@ -27,6 +28,7 @@ - assert: that: echo.stdout == "555" + fail_msg: echo={{echo}} - file: path: /etc/environment @@ -43,3 +45,4 @@ - assert: that: echo.stdout == "" + fail_msg: echo={{echo}} diff --git a/tests/ansible/integration/runner/_etc_environment_user.yml b/tests/ansible/integration/runner/_etc_environment_user.yml index ca1dc5cc..9d9b831a 100644 --- a/tests/ansible/integration/runner/_etc_environment_user.yml +++ b/tests/ansible/integration/runner/_etc_environment_user.yml @@ -9,6 +9,7 @@ - assert: that: echo.stdout == "" + fail_msg: echo={{echo}} - copy: dest: ~/.pam_environment @@ -20,6 +21,7 @@ - assert: that: echo.stdout == "321" + fail_msg: echo={{echo}} - file: path: ~/.pam_environment @@ -30,3 +32,4 @@ - assert: that: echo.stdout == "" + fail_msg: echo={{echo}} diff --git a/tests/ansible/integration/runner/atexit.yml b/tests/ansible/integration/runner/atexit.yml index 65d27d59..25babf0d 100644 --- a/tests/ansible/integration/runner/atexit.yml +++ b/tests/ansible/integration/runner/atexit.yml @@ -29,3 +29,4 @@ - assert: that: - not out.stat.exists + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/builtin_command_module.yml b/tests/ansible/integration/runner/builtin_command_module.yml index 0bc5bd34..b0ca7e1c 100644 --- a/tests/ansible/integration/runner/builtin_command_module.yml +++ b/tests/ansible/integration/runner/builtin_command_module.yml @@ -16,3 +16,4 @@ out.results[0].item == '1' and out.results[0].rc == 0 and (out.results[0].stdout == ansible_nodename) + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/crashy_new_style_module.yml b/tests/ansible/integration/runner/crashy_new_style_module.yml index 73bac1f9..3e41fdde 100644 --- a/tests/ansible/integration/runner/crashy_new_style_module.yml +++ b/tests/ansible/integration/runner/crashy_new_style_module.yml @@ -23,3 +23,4 @@ - out.module_stdout == "" - "'Traceback (most recent call last)' in out.module_stderr" - "\"NameError: name 'kaboom' is not defined\" in out.module_stderr" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_bash_hashbang_argument.yml b/tests/ansible/integration/runner/custom_bash_hashbang_argument.yml index f02b8419..1eb79f20 100644 --- a/tests/ansible/integration/runner/custom_bash_hashbang_argument.yml +++ b/tests/ansible/integration/runner/custom_bash_hashbang_argument.yml @@ -17,3 +17,4 @@ (not out.results[0].changed) and out.results[0].msg == 'Here is my input' and out.results[0].run_via_env == "yes" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_bash_old_style_module.yml b/tests/ansible/integration/runner/custom_bash_old_style_module.yml index ff963665..4a14f86e 100644 --- a/tests/ansible/integration/runner/custom_bash_old_style_module.yml +++ b/tests/ansible/integration/runner/custom_bash_old_style_module.yml @@ -13,3 +13,4 @@ (not out.changed) and (not out.results[0].changed) and out.results[0].msg == 'Here is my input' + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_bash_want_json_module.yml b/tests/ansible/integration/runner/custom_bash_want_json_module.yml index 075c95b2..5ae74a4d 100644 --- a/tests/ansible/integration/runner/custom_bash_want_json_module.yml +++ b/tests/ansible/integration/runner/custom_bash_want_json_module.yml @@ -12,3 +12,4 @@ (not out.changed) and (not out.results[0].changed) and out.results[0].msg == 'Here is my input' + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_binary_producing_json.yml b/tests/ansible/integration/runner/custom_binary_producing_json.yml index a3b8a224..016efac9 100644 --- a/tests/ansible/integration/runner/custom_binary_producing_json.yml +++ b/tests/ansible/integration/runner/custom_binary_producing_json.yml @@ -24,3 +24,4 @@ out.changed and out.results[0].changed and out.results[0].msg == 'Hello, world.' + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_binary_producing_junk.yml b/tests/ansible/integration/runner/custom_binary_producing_junk.yml index b9cfb6b4..d302d43c 100644 --- a/tests/ansible/integration/runner/custom_binary_producing_junk.yml +++ b/tests/ansible/integration/runner/custom_binary_producing_junk.yml @@ -30,3 +30,4 @@ - out.results[0].failed - out.results[0].msg.startswith('MODULE FAILURE') - out.results[0].rc == 0 + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_binary_single_null.yml b/tests/ansible/integration/runner/custom_binary_single_null.yml index ce96bf13..8e2331a2 100644 --- a/tests/ansible/integration/runner/custom_binary_single_null.yml +++ b/tests/ansible/integration/runner/custom_binary_single_null.yml @@ -27,6 +27,7 @@ 'custom_binary_single_null: cannot execute binary file: Exec format error\r\n', )) or (ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_version == '16.04') + fail_msg: out={{out}} # Can't test this: Mitogen returns 126, 2.5.x returns 126, 2.4.x discarded the diff --git a/tests/ansible/integration/runner/custom_perl_json_args_module.yml b/tests/ansible/integration/runner/custom_perl_json_args_module.yml index f705cfe4..9d51e71f 100644 --- a/tests/ansible/integration/runner/custom_perl_json_args_module.yml +++ b/tests/ansible/integration/runner/custom_perl_json_args_module.yml @@ -11,9 +11,11 @@ that: - out.results[0].input.foo - out.results[0].message == 'I am a perl script! Here is my input.' + fail_msg: out={{out}} - when: ansible_version.full > '2.4' assert: that: - (not out.changed) - (not out.results[0].changed) + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_perl_want_json_module.yml b/tests/ansible/integration/runner/custom_perl_want_json_module.yml index 24527164..57d92fd0 100644 --- a/tests/ansible/integration/runner/custom_perl_want_json_module.yml +++ b/tests/ansible/integration/runner/custom_perl_want_json_module.yml @@ -11,9 +11,11 @@ that: - out.results[0].input.foo - out.results[0].message == 'I am a want JSON perl script! Here is my input.' + fail_msg: out={{out}} - when: ansible_version.full > '2.4' assert: that: - (not out.changed) - (not out.results[0].changed) + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_python_json_args_module.yml b/tests/ansible/integration/runner/custom_python_json_args_module.yml index 338f9180..5c77097e 100644 --- a/tests/ansible/integration/runner/custom_python_json_args_module.yml +++ b/tests/ansible/integration/runner/custom_python_json_args_module.yml @@ -13,3 +13,4 @@ (not out.results[0].changed) and out.results[0].input[0].foo and out.results[0].msg == 'Here is my input' + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_python_new_style_missing_interpreter.yml b/tests/ansible/integration/runner/custom_python_new_style_missing_interpreter.yml index 77f2cb5c..4a375ff0 100644 --- a/tests/ansible/integration/runner/custom_python_new_style_missing_interpreter.yml +++ b/tests/ansible/integration/runner/custom_python_new_style_missing_interpreter.yml @@ -15,3 +15,4 @@ # Random breaking interface change since 2.7.x #- "out.results[0].input[0].ANSIBLE_MODULE_ARGS.foo" - "out.results[0].msg == 'Here is my input'" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_python_new_style_module.yml b/tests/ansible/integration/runner/custom_python_new_style_module.yml index 2ec896b7..3992f4b1 100644 --- a/tests/ansible/integration/runner/custom_python_new_style_module.yml +++ b/tests/ansible/integration/runner/custom_python_new_style_module.yml @@ -18,6 +18,7 @@ # Random breaking interface change since 2.7.x #- "out.results[0].input[0].ANSIBLE_MODULE_ARGS.foo" - "out.results[0].msg == 'Here is my input'" + fail_msg: out={{out}} # Verify sys.argv is not Unicode. - custom_python_detect_environment: @@ -26,3 +27,4 @@ - assert: that: - out.argv_types_correct + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_python_prehistoric_module.yml b/tests/ansible/integration/runner/custom_python_prehistoric_module.yml index 458f3d2b..19a8a9de 100644 --- a/tests/ansible/integration/runner/custom_python_prehistoric_module.yml +++ b/tests/ansible/integration/runner/custom_python_prehistoric_module.yml @@ -7,4 +7,6 @@ - custom_python_prehistoric_module: register: out - - assert: that=out.ok + - assert: + that: out.ok + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_python_want_json_module.yml b/tests/ansible/integration/runner/custom_python_want_json_module.yml index f6d8c355..dd5a5c1c 100644 --- a/tests/ansible/integration/runner/custom_python_want_json_module.yml +++ b/tests/ansible/integration/runner/custom_python_want_json_module.yml @@ -13,3 +13,4 @@ (not out.results[0].changed) and out.results[0].input[0].foo and out.results[0].msg == 'Here is my input' + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/custom_script_interpreter.yml b/tests/ansible/integration/runner/custom_script_interpreter.yml index 4c6b3ef5..f496cff0 100644 --- a/tests/ansible/integration/runner/custom_script_interpreter.yml +++ b/tests/ansible/integration/runner/custom_script_interpreter.yml @@ -15,4 +15,5 @@ (not out.changed) and (not out.results[0].changed) and out.results[0].msg == 'Here is my input' + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/environment_isolation.yml b/tests/ansible/integration/runner/environment_isolation.yml index 08f0924f..eee31d6e 100644 --- a/tests/ansible/integration/runner/environment_isolation.yml +++ b/tests/ansible/integration/runner/environment_isolation.yml @@ -16,6 +16,7 @@ register: out - assert: that: not out.env.evil_key is defined + fail_msg: out={{out}} - shell: echo 'hi' environment: @@ -26,6 +27,7 @@ register: out - assert: that: not out.env.evil_key is defined + fail_msg: out={{out}} # --- @@ -37,6 +39,7 @@ register: out - assert: that: not out.env.evil_key is defined + fail_msg: out={{out}} - custom_python_modify_environ: key: evil_key @@ -47,4 +50,5 @@ register: out - assert: that: not out.env.evil_key is defined + fail_msg: out={{out}} diff --git a/tests/ansible/integration/runner/forking_active.yml b/tests/ansible/integration/runner/forking_active.yml index e3e63b71..ebae849b 100644 --- a/tests/ansible/integration/runner/forking_active.yml +++ b/tests/ansible/integration/runner/forking_active.yml @@ -27,5 +27,6 @@ that: - fork_proc1.pid != sync_proc1.pid - fork_proc1.pid != fork_proc2.pid + fail_msg: fork_proc1={{fork_proc1}} sync_proc1={{sync_proc1}} fork_proc2={{fork_proc2}} when: is_mitogen diff --git a/tests/ansible/integration/runner/forking_correct_parent.yml b/tests/ansible/integration/runner/forking_correct_parent.yml index c70db4e3..59cf48e7 100644 --- a/tests/ansible/integration/runner/forking_correct_parent.yml +++ b/tests/ansible/integration/runner/forking_correct_parent.yml @@ -32,12 +32,15 @@ - assert: that: - fork_proc.pid != regular_proc.pid + fail_msg: fork_proc={{fork_proc}} regular_proc={{regular_proc}} when: is_mitogen - assert: that: fork_proc.ppid != regular_proc.pid + fail_msg: fork_proc={{fork_proc}} regular_proc={{regular_proc}} when: is_mitogen and forkmode.uses_fork - assert: that: fork_proc.ppid == regular_proc.pid + fail_msg: fork_proc={{fork_proc}} regular_proc={{regular_proc}} when: is_mitogen and not forkmode.uses_fork diff --git a/tests/ansible/integration/runner/forking_inactive.yml b/tests/ansible/integration/runner/forking_inactive.yml index b84cec7e..05ec30ef 100644 --- a/tests/ansible/integration/runner/forking_inactive.yml +++ b/tests/ansible/integration/runner/forking_inactive.yml @@ -18,6 +18,7 @@ - assert: that: - sync_proc1.pid == sync_proc2.pid + fail_msg: sync_proc1={{sync_proc1}} sync_proc2={{sync_proc2}} when: is_mitogen diff --git a/tests/ansible/integration/runner/missing_module.yml b/tests/ansible/integration/runner/missing_module.yml index 107f5c20..f515b574 100644 --- a/tests/ansible/integration/runner/missing_module.yml +++ b/tests/ansible/integration/runner/missing_module.yml @@ -17,3 +17,4 @@ - assert: that: | 'The module missing_module was not found in configured module paths' in out.stdout + fail_msg: out={{out}} diff --git a/tests/ansible/integration/ssh/config.yml b/tests/ansible/integration/ssh/config.yml index 07ad1c21..9cd024e7 100644 --- a/tests/ansible/integration/ssh/config.yml +++ b/tests/ansible/integration/ssh/config.yml @@ -17,3 +17,4 @@ out.result[0].kwargs.identity_file == ( lookup('env', 'HOME') + '/fakekey' ) + fail_msg: out={{out}} diff --git a/tests/ansible/integration/ssh/timeouts.yml b/tests/ansible/integration/ssh/timeouts.yml index 92fd9307..90be6c94 100644 --- a/tests/ansible/integration/ssh/timeouts.yml +++ b/tests/ansible/integration/ssh/timeouts.yml @@ -24,4 +24,5 @@ '"unreachable": true' in out.stdout - | '"msg": "Connection timed out."' in out.stdout + fail_msg: out={{out}} when: is_mitogen diff --git a/tests/ansible/integration/ssh/variables.yml b/tests/ansible/integration/ssh/variables.yml index 71536391..d05ac288 100644 --- a/tests/ansible/integration/ssh/variables.yml +++ b/tests/ansible/integration/ssh/variables.yml @@ -40,6 +40,7 @@ - assert: that: out.rc == 4 # unreachable + fail_msg: out={{out}} when: is_mitogen @@ -69,6 +70,7 @@ - assert: that: out.rc == 4 # unreachable + fail_msg: out={{out}} when: is_mitogen @@ -98,6 +100,7 @@ - assert: that: out.rc == 4 # unreachable + fail_msg: out={{out}} when: is_mitogen @@ -132,4 +135,5 @@ - assert: that: out.rc == 4 # unreachable + fail_msg: out={{out}} when: is_mitogen diff --git a/tests/ansible/integration/strategy/_mixed_mitogen_vanilla.yml b/tests/ansible/integration/strategy/_mixed_mitogen_vanilla.yml index 1ec76fd1..3dfec756 100644 --- a/tests/ansible/integration/strategy/_mixed_mitogen_vanilla.yml +++ b/tests/ansible/integration/strategy/_mixed_mitogen_vanilla.yml @@ -11,10 +11,12 @@ register: out - assert: that: out.mitogen_loaded + fail_msg: out={{out}} - determine_strategy: - assert: that: strategy == 'ansible.plugins.strategy.mitogen_linear.StrategyModule' + fail_msg: strategy={{strategy}} - name: integration/strategy/_mixed_mitogen_vanilla.yml (linear) @@ -26,10 +28,12 @@ register: out - assert: that: not out.mitogen_loaded + fail_msg: out={{out}} - determine_strategy: - assert: that: strategy == 'ansible.plugins.strategy.linear.StrategyModule' + fail_msg: strategy={{strategy}} - name: integration/strategy/_mixed_mitogen_vanilla.yml (mitogen_linear) @@ -41,7 +45,9 @@ register: out - assert: that: out.mitogen_loaded + fail_msg: out={{out}} - determine_strategy: - assert: that: strategy == 'ansible.plugins.strategy.mitogen_linear.StrategyModule' + fail_msg: strategy={{strategy}} diff --git a/tests/ansible/integration/strategy/_mixed_vanilla_mitogen.yml b/tests/ansible/integration/strategy/_mixed_vanilla_mitogen.yml index babcab3f..6381f114 100644 --- a/tests/ansible/integration/strategy/_mixed_vanilla_mitogen.yml +++ b/tests/ansible/integration/strategy/_mixed_vanilla_mitogen.yml @@ -10,10 +10,12 @@ register: out - assert: that: not out.mitogen_loaded + fail_msg: out={{out}} - determine_strategy: - assert: that: strategy == 'ansible.plugins.strategy.linear.StrategyModule' + fail_msg: strategy={{strategy}} - name: integration/strategy/_mixed_vanilla_mitogen.yml (mitogen_linear) hosts: test-targets[0] @@ -24,10 +26,12 @@ register: out - assert: that: out.mitogen_loaded + fail_msg: out={{out}} - determine_strategy: - assert: that: strategy == 'ansible.plugins.strategy.mitogen_linear.StrategyModule' + fail_msg: strategy={{strategy}} - name: integration/strategy/_mixed_vanilla_mitogen.yml (linear) @@ -39,7 +43,9 @@ register: out - assert: that: not out.mitogen_loaded + fail_msg: out={{out}} - determine_strategy: - assert: that: strategy == 'ansible.plugins.strategy.linear.StrategyModule' + fail_msg: strategy={{strategy}} diff --git a/tests/ansible/integration/stub_connections/kubectl.yml b/tests/ansible/integration/stub_connections/kubectl.yml index 867a8c17..92ed1a89 100644 --- a/tests/ansible/integration/stub_connections/kubectl.yml +++ b/tests/ansible/integration/stub_connections/kubectl.yml @@ -20,3 +20,4 @@ - assert: that: - out.env.THIS_IS_STUB_KUBECTL == '1' + fail_msg: out={{out}} diff --git a/tests/ansible/integration/stub_connections/lxc.yml b/tests/ansible/integration/stub_connections/lxc.yml index 1dbe2a48..c09f2df2 100644 --- a/tests/ansible/integration/stub_connections/lxc.yml +++ b/tests/ansible/integration/stub_connections/lxc.yml @@ -17,3 +17,4 @@ - assert: that: - out.env.THIS_IS_STUB_LXC_ATTACH == '1' + fail_msg: out={{out}} diff --git a/tests/ansible/integration/stub_connections/lxd.yml b/tests/ansible/integration/stub_connections/lxd.yml index 7839a35f..de7d8766 100644 --- a/tests/ansible/integration/stub_connections/lxd.yml +++ b/tests/ansible/integration/stub_connections/lxd.yml @@ -17,3 +17,4 @@ - assert: that: - out.env.THIS_IS_STUB_LXC == '1' + fail_msg: out={{out}} diff --git a/tests/ansible/integration/stub_connections/mitogen_doas.yml b/tests/ansible/integration/stub_connections/mitogen_doas.yml index 5387744e..4ced049d 100644 --- a/tests/ansible/integration/stub_connections/mitogen_doas.yml +++ b/tests/ansible/integration/stub_connections/mitogen_doas.yml @@ -20,3 +20,4 @@ that: - out.env.THIS_IS_STUB_DOAS == '1' - (out.env.ORIGINAL_ARGV|from_json)[1:3] == ['-u', 'someuser'] + fail_msg: out={{out}} diff --git a/tests/ansible/integration/stub_connections/mitogen_sudo.yml b/tests/ansible/integration/stub_connections/mitogen_sudo.yml index e78afebc..2e1b0103 100644 --- a/tests/ansible/integration/stub_connections/mitogen_sudo.yml +++ b/tests/ansible/integration/stub_connections/mitogen_sudo.yml @@ -18,6 +18,8 @@ - assert: that: out.env.THIS_IS_STUB_SUDO == '1' + fail_msg: out={{out}} + - assert_equal: left: (out.env.ORIGINAL_ARGV|from_json)[1:9] right: ['-u', 'root', '-H', '-r', 'somerole', '-t', 'sometype', '--'] diff --git a/tests/ansible/integration/stub_connections/setns_lxc.yml b/tests/ansible/integration/stub_connections/setns_lxc.yml index efef3761..fcea3de2 100644 --- a/tests/ansible/integration/stub_connections/setns_lxc.yml +++ b/tests/ansible/integration/stub_connections/setns_lxc.yml @@ -31,3 +31,4 @@ - assert: that: result.rc == 0 + fail_msg: result={{result}} diff --git a/tests/ansible/integration/stub_connections/setns_lxd.yml b/tests/ansible/integration/stub_connections/setns_lxd.yml index adee0b14..61018382 100644 --- a/tests/ansible/integration/stub_connections/setns_lxd.yml +++ b/tests/ansible/integration/stub_connections/setns_lxd.yml @@ -31,3 +31,4 @@ - assert: that: result.rc == 0 + fail_msg: result={{result}} diff --git a/tests/ansible/integration/transport/kubectl.yml b/tests/ansible/integration/transport/kubectl.yml index d2be9ba5..4dac2d02 100644 --- a/tests/ansible/integration/transport/kubectl.yml +++ b/tests/ansible/integration/transport/kubectl.yml @@ -74,6 +74,7 @@ register: _ - assert: { that: "'Python 3' in _.stdout" } + fail_msg: _={{_}} - debug: var=_.stdout,_.stderr run_once: yes @@ -83,6 +84,7 @@ register: _ - assert: { that: "'Python 2' in _.stderr" } + fail_msg: _={{_}} - debug: var=_.stdout,_.stderr run_once: yes @@ -113,7 +115,9 @@ ansible_kubectl_container: python3 register: _ - - assert: { that: "'Python 3' in _.stdout" } + - assert: + that: "'Python 3' in _.stdout" + fail_msg: _={{_}} - debug: var=_.stdout,_.stderr run_once: yes @@ -122,7 +126,9 @@ command: python --version register: _ - - assert: { that: "'Python 2' in _.stderr" } + - assert: + that: "'Python 2' in _.stderr" + fail_msg: _={{_}} - debug: var=_.stdout,_.stderr run_once: yes diff --git a/tests/ansible/integration/transport_config/become.yml b/tests/ansible/integration/transport_config/become.yml index baa2085e..51b698eb 100644 --- a/tests/ansible/integration/transport_config/become.yml +++ b/tests/ansible/integration/transport_config/become.yml @@ -12,6 +12,7 @@ - out.result|length == 1 - out.result[0].method == "ssh" - out.result[0].kwargs.username == "ansible-cfg-remote-user" + fail_msg: out={{out}} - hosts: tc-become-unset vars: {mitogen_via: becomeuser@tc-become-set} @@ -29,6 +30,7 @@ - out.result[2].method == "ssh" - out.result[2].kwargs.hostname == "tc-become-unset" + fail_msg: out={{out}} # Become set. @@ -46,6 +48,7 @@ - out.result[0].kwargs.username == "ansible-cfg-remote-user" - out.result[1].method == "sudo" - out.result[1].kwargs.username == "becomeuser" + fail_msg: out={{out}} - hosts: tc-become-set vars: {mitogen_via: tc-become-unset} @@ -66,3 +69,4 @@ - out.result[2].method == "sudo" - out.result[2].kwargs.username == "becomeuser" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/transport_config/become_method.yml b/tests/ansible/integration/transport_config/become_method.yml index 5129e5b8..a6eac9ef 100644 --- a/tests/ansible/integration/transport_config/become_method.yml +++ b/tests/ansible/integration/transport_config/become_method.yml @@ -13,6 +13,7 @@ - out.result|length == 2 - out.result[0].method == "ssh" - out.result[1].method == "sudo" + fail_msg: out={{out}} - hosts: tc-become-method-unset vars: {mitogen_via: becomeuser@tc-become-method-su} @@ -27,6 +28,7 @@ - out.result[1].kwargs.username == "becomeuser" - out.result[2].method == "ssh" - out.result[2].kwargs.hostname == "tc-become-method-unset" + fail_msg: out={{out}} # ansible_become_method=su @@ -42,6 +44,7 @@ - out.result[0].method == "ssh" - out.result[1].method == "su" - out.result[1].kwargs.username == "becomeuser" + fail_msg: out={{out}} - hosts: tc-become-method-su vars: {mitogen_via: tc-become-method-unset} @@ -61,6 +64,7 @@ - out.result[2].method == "su" - out.result[2].kwargs.username == "becomeuser" + fail_msg: out={{out}} @@ -81,3 +85,4 @@ - out.result[2].method == "ssh" - out.result[2].kwargs.hostname == "tc-become-method-unset" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/transport_config/become_pass.yml b/tests/ansible/integration/transport_config/become_pass.yml index 6a2188b1..6287e708 100644 --- a/tests/ansible/integration/transport_config/become_pass.yml +++ b/tests/ansible/integration/transport_config/become_pass.yml @@ -14,6 +14,7 @@ - out.result[0].method == "ssh" - out.result[1].method == "sudo" - out.result[1].kwargs.password == None + fail_msg: out={{out}} # Not set, unbecoming mitogen_via= - hosts: tc-become-pass-unset @@ -29,6 +30,7 @@ - out.result[1].method == "ssh" - out.result[2].method == "sudo" - out.result[2].kwargs.password == None + fail_msg: out={{out}} # Not set, becoming mitogen_via= - hosts: tc-become-pass-unset @@ -46,6 +48,7 @@ - out.result[2].method == "ssh" - out.result[3].method == "sudo" - out.result[3].kwargs.password == None + fail_msg: out={{out}} # ansible_become_password= set. @@ -60,6 +63,7 @@ - out.result[0].method == "ssh" - out.result[1].method == "sudo" - out.result[1].kwargs.password == "apassword" + fail_msg: out={{out}} # ansible_become_password=, via= @@ -78,6 +82,7 @@ - out.result[2].method == "ssh" - out.result[3].method == "sudo" - out.result[3].kwargs.password == "apassword" + fail_msg: out={{out}} # ansible_become_pass= @@ -92,6 +97,7 @@ - out.result[0].method == "ssh" - out.result[1].method == "sudo" - out.result[1].kwargs.password == "apass" + fail_msg: out={{out}} # ansible_become_pass=, via= @@ -110,6 +116,7 @@ - out.result[2].method == "ssh" - out.result[3].method == "sudo" - out.result[3].kwargs.password == "apass" + fail_msg: out={{out}} @@ -126,6 +133,7 @@ - out.result[0].method == "ssh" - out.result[1].method == "sudo" - out.result[1].kwargs.password == "c.b.a" + fail_msg: out={{out}} # both, mitogen_via @@ -141,3 +149,4 @@ - out.result[1].method == "sudo" - out.result[1].kwargs.password == "a.b.c" - out.result[2].method == "ssh" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/transport_config/become_user.yml b/tests/ansible/integration/transport_config/become_user.yml index 43cbca2a..3c8397ad 100644 --- a/tests/ansible/integration/transport_config/become_user.yml +++ b/tests/ansible/integration/transport_config/become_user.yml @@ -14,6 +14,7 @@ - out.result[0].method == "ssh" - out.result[1].method == "sudo" - out.result[1].kwargs.username == "root" + fail_msg: out={{out}} # Not set, unbecoming mitogen_via= - hosts: tc-become-user-unset @@ -29,6 +30,7 @@ - out.result[1].method == "ssh" - out.result[2].method == "sudo" - out.result[2].kwargs.username == "root" + fail_msg: out={{out}} # Not set, becoming mitogen_via= - hosts: tc-become-user-unset @@ -46,6 +48,7 @@ - out.result[2].method == "ssh" - out.result[3].method == "sudo" - out.result[3].kwargs.username == "root" + fail_msg: out={{out}} # ansible_become_user= set. @@ -60,6 +63,7 @@ - out.result[0].method == "ssh" - out.result[1].method == "sudo" - out.result[1].kwargs.username == "ansi-become-user" + fail_msg: out={{out}} # ansible_become_user=, unbecoming via= @@ -80,6 +84,7 @@ - out.result[2].method == "sudo" - out.result[2].kwargs.username == "ansi-become-user" + fail_msg: out={{out}} # ansible_become_user=, becoming via= @@ -103,4 +108,5 @@ - out.result[3].method == "sudo" - out.result[3].kwargs.username == "ansi-become-user" + fail_msg: out={{out}} diff --git a/tests/ansible/integration/transport_config/port.yml b/tests/ansible/integration/transport_config/port.yml index 2781081a..6014ffae 100644 --- a/tests/ansible/integration/transport_config/port.yml +++ b/tests/ansible/integration/transport_config/port.yml @@ -12,6 +12,7 @@ - out.result|length == 1 - out.result[0].method == "ssh" - out.result[0].kwargs.port == None + fail_msg: out={{out}} # Not set, mitogen_via= - hosts: tc-port-explicit-ssh @@ -26,6 +27,7 @@ - out.result[0].kwargs.port == None - out.result[1].method == "ssh" - out.result[1].kwargs.port == 4321 + fail_msg: out={{out}} # ansible_ssh_port= - hosts: tc-port-explicit-ssh @@ -37,6 +39,7 @@ - out.result|length == 1 - out.result[0].method == "ssh" - out.result[0].kwargs.port == 4321 + fail_msg: out={{out}} - hosts: tc-port-explicit-unset vars: {mitogen_via: tc-port-explicit-ssh} @@ -50,6 +53,7 @@ - out.result[1].kwargs.port == 4321 - out.result[1].method == "ssh" - out.result[0].kwargs.port == None + fail_msg: out={{out}} # ansible_port= - hosts: tc-port-explicit-port @@ -61,6 +65,7 @@ - out.result|length == 1 - out.result[0].method == "ssh" - out.result[0].kwargs.port == 1234 + fail_msg: out={{out}} - hosts: tc-port-unset vars: {mitogen_via: tc-port-explicit-port} @@ -74,6 +79,7 @@ - out.result[0].kwargs.port == 1234 - out.result[1].method == "ssh" - out.result[1].kwargs.port == None + fail_msg: out={{out}} # both, ssh takes precedence @@ -86,6 +92,7 @@ - out.result|length == 1 - out.result[0].method == "ssh" - out.result[0].kwargs.port == 1532 + fail_msg: out={{out}} - hosts: tc-port-unset vars: {mitogen_via: tc-port-both} @@ -99,3 +106,4 @@ - out.result[0].kwargs.port == 1532 - out.result[1].method == "ssh" - out.result[1].kwargs.port == None + fail_msg: out={{out}} diff --git a/tests/ansible/regression/issue_109__target_has_old_ansible_installed.yml b/tests/ansible/regression/issue_109__target_has_old_ansible_installed.yml index 75e2598a..5c00734f 100644 --- a/tests/ansible/regression/issue_109__target_has_old_ansible_installed.yml +++ b/tests/ansible/regression/issue_109__target_has_old_ansible_installed.yml @@ -25,6 +25,7 @@ that: - env.cwd == ansible_user_dir - (not env.mitogen_loaded) or (env.python_path.count("") == 1) + fail_msg: env={{env}} # Run some new-style modules that 'from ansible.module_utils...' - stat: diff --git a/tests/ansible/regression/issue_113__duplicate_module_imports.yml b/tests/ansible/regression/issue_113__duplicate_module_imports.yml index 2b9e3ea8..7c556588 100644 --- a/tests/ansible/regression/issue_113__duplicate_module_imports.yml +++ b/tests/ansible/regression/issue_113__duplicate_module_imports.yml @@ -21,4 +21,5 @@ that: - out.status == -1 - out.url == 'http://127.0.0.1:14321/post' + fail_msg: out={{out}} diff --git a/tests/ansible/regression/issue_152__local_action_wrong_interpreter.yml b/tests/ansible/regression/issue_152__local_action_wrong_interpreter.yml index 8a8f0068..104e27cc 100644 --- a/tests/ansible/regression/issue_152__local_action_wrong_interpreter.yml +++ b/tests/ansible/regression/issue_152__local_action_wrong_interpreter.yml @@ -25,6 +25,7 @@ - assert: that: - out.env.CUSTOM_INTERPRETER == "1" + fail_msg: out={{out}} - file: path: /tmp/issue_152_interpreter.sh diff --git a/tests/ansible/regression/issue_152__virtualenv_python_fails.yml b/tests/ansible/regression/issue_152__virtualenv_python_fails.yml index 6df3df12..c04f0b80 100644 --- a/tests/ansible/regression/issue_152__virtualenv_python_fails.yml +++ b/tests/ansible/regression/issue_152__virtualenv_python_fails.yml @@ -24,6 +24,7 @@ - assert: that: - out.sys_executable == "/tmp/issue_152_virtualenv/bin/python" + fail_msg: out={{out}} when: lout.python_version > '2.6' - file: diff --git a/tests/ansible/regression/issue_154__module_state_leaks.yml b/tests/ansible/regression/issue_154__module_state_leaks.yml index faef6e63..b25b9030 100644 --- a/tests/ansible/regression/issue_154__module_state_leaks.yml +++ b/tests/ansible/regression/issue_154__module_state_leaks.yml @@ -15,4 +15,5 @@ that: - out.results[item|int].leak1 == ["David"] - out.results[item|int].leak2 == ["David"] + fail_msg: out={{out}} with_sequence: start=0 end=3 diff --git a/tests/ansible/regression/issue_332_ansiblemoduleerror_first_occurrence.yml b/tests/ansible/regression/issue_332_ansiblemoduleerror_first_occurrence.yml index 6f32af19..4138b544 100644 --- a/tests/ansible/regression/issue_332_ansiblemoduleerror_first_occurrence.yml +++ b/tests/ansible/regression/issue_332_ansiblemoduleerror_first_occurrence.yml @@ -11,3 +11,4 @@ - assert: that: - out.msg == 'file (/usr/bin/does-not-exist) is absent, cannot continue' + fail_msg: out={{out}} diff --git a/tests/ansible/regression/issue_590__sys_modules_crap.yml b/tests/ansible/regression/issue_590__sys_modules_crap.yml index 41130b68..486b6d31 100644 --- a/tests/ansible/regression/issue_590__sys_modules_crap.yml +++ b/tests/ansible/regression/issue_590__sys_modules_crap.yml @@ -10,3 +10,4 @@ - assert: that: - "'id' in out.info" + fail_msg: out={{out}}