Merge pull request #853 from moreati/issue852

tests: Print variables on failure of assert tasks
pull/830/head^2
Alex Willmer 3 years ago committed by GitHub
commit 068a904cb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

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

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

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

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

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

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

@ -60,6 +60,7 @@
- assert:
that: outout == "item!"
fail_msg: outout={{outout}}
when: False
# TODO: https://github.com/dw/mitogen/issues/692

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

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

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

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

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

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

@ -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', '>')

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -12,3 +12,4 @@
- assert:
that: (not not out.mitogen_loaded) == (not not is_mitogen)
fail_msg: out={{out}}

@ -15,4 +15,5 @@
- assert:
that: not out.mitogen_loaded
fail_msg: out={{out}}
when: False

@ -12,3 +12,4 @@
- assert:
that: (not not out.mitogen_loaded) == (not not is_mitogen)
fail_msg: out={{out}}

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

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

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

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

@ -19,4 +19,5 @@
- assert:
that: stat.stat.exists
fail_msg: stat={{stat}}

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

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

@ -11,4 +11,5 @@
- assert:
that:
- out.extmod_path == "ansible/lib/module_utils/externalpkg/extmod.py"
fail_msg: out={{out}}

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

@ -6,3 +6,4 @@
- assert:
that:
- out.path == "ansible/integration/module_utils/roles/override_modrole/module_utils/known_hosts.py"
fail_msg: out={{out}}

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

@ -11,3 +11,4 @@
- assert:
that: "result.stdout == '123'"
fail_msg: result={{result}}

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

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

@ -29,3 +29,4 @@
- assert:
that:
- not out.stat.exists
fail_msg: out={{out}}

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

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

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

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

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

@ -24,3 +24,4 @@
out.changed and
out.results[0].changed and
out.results[0].msg == 'Hello, world.'
fail_msg: out={{out}}

@ -30,3 +30,4 @@
- out.results[0].failed
- out.results[0].msg.startswith('MODULE FAILURE')
- out.results[0].rc == 0
fail_msg: out={{out}}

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

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

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

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

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

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

@ -7,4 +7,6 @@
- custom_python_prehistoric_module:
register: out
- assert: that=out.ok
- assert:
that: out.ok
fail_msg: out={{out}}

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

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

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

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

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

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

@ -17,3 +17,4 @@
- assert:
that: |
'The module missing_module was not found in configured module paths' in out.stdout
fail_msg: out={{out}}

@ -17,3 +17,4 @@
out.result[0].kwargs.identity_file == (
lookup('env', 'HOME') + '/fakekey'
)
fail_msg: out={{out}}

@ -24,4 +24,5 @@
'"unreachable": true' in out.stdout
- |
'"msg": "Connection timed out."' in out.stdout
fail_msg: out={{out}}
when: is_mitogen

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

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

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

@ -20,3 +20,4 @@
- assert:
that:
- out.env.THIS_IS_STUB_KUBECTL == '1'
fail_msg: out={{out}}

@ -17,3 +17,4 @@
- assert:
that:
- out.env.THIS_IS_STUB_LXC_ATTACH == '1'
fail_msg: out={{out}}

@ -17,3 +17,4 @@
- assert:
that:
- out.env.THIS_IS_STUB_LXC == '1'
fail_msg: out={{out}}

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

@ -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', '--']

@ -31,3 +31,4 @@
- assert:
that: result.rc == 0
fail_msg: result={{result}}

@ -31,3 +31,4 @@
- assert:
that: result.rc == 0
fail_msg: result={{result}}

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

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

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

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

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

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

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

@ -21,4 +21,5 @@
that:
- out.status == -1
- out.url == 'http://127.0.0.1:14321/post'
fail_msg: out={{out}}

@ -25,6 +25,7 @@
- assert:
that:
- out.env.CUSTOM_INTERPRETER == "1"
fail_msg: out={{out}}
- file:
path: /tmp/issue_152_interpreter.sh

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

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

@ -11,3 +11,4 @@
- assert:
that:
- out.msg == 'file (/usr/bin/does-not-exist) is absent, cannot continue'
fail_msg: out={{out}}

@ -10,3 +10,4 @@
- assert:
that:
- "'id' in out.info"
fail_msg: out={{out}}

Loading…
Cancel
Save