mirror of
https://github.com/zebrajr/ansible.git
synced 2025-12-06 00:19:48 +01:00
Miscellaneous integration test fixes (#84871)
This commit is contained in:
parent
091994a477
commit
35665db4ed
|
|
@ -1,12 +1,12 @@
|
|||
- name: Verify variables are set
|
||||
assert:
|
||||
that:
|
||||
- aws_access_key
|
||||
- aws_region
|
||||
- aws_secret_key
|
||||
- resource_prefix
|
||||
- security_token
|
||||
- tiny_prefix
|
||||
- aws_access_key is defined
|
||||
- aws_region is defined
|
||||
- aws_secret_key is defined
|
||||
- resource_prefix is defined
|
||||
- security_token is defined
|
||||
- tiny_prefix is defined
|
||||
- name: Show variables
|
||||
debug:
|
||||
msg: "{{ lookup('vars', item) }}"
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
- name: Verify variables are set
|
||||
assert:
|
||||
that:
|
||||
- azure_client_id
|
||||
- azure_secret
|
||||
- azure_subscription_id
|
||||
- azure_tenant
|
||||
- resource_group
|
||||
- resource_group_secondary
|
||||
- azure_client_id is defined
|
||||
- azure_secret is defined
|
||||
- azure_subscription_id is defined
|
||||
- azure_tenant is defined
|
||||
- resource_group is defined
|
||||
- resource_group_secondary is defined
|
||||
- name: Show variables
|
||||
debug:
|
||||
msg: "{{ lookup('vars', item) }}"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
- name: Verify endpoints exist
|
||||
assert:
|
||||
that: clusters
|
||||
that: clusters is defined
|
||||
|
||||
- name: Verify endpoints respond
|
||||
uri:
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ ANSIBLE_COLLECTIONS_PATH=/tmp/collections ansible-config dump| grep 'COLLECTIONS
|
|||
ansible-config list | grep 'COLLECTIONS_PATHS'
|
||||
|
||||
# 'view' command must fail when config file is missing or has an invalid file extension
|
||||
ansible-config view -c ./ansible-non-existent.cfg 2> err1.txt || grep -Eq 'ERROR! The provided configuration file is missing or not accessible:' err1.txt || (cat err*.txt; rm -f err1.txt; exit 1)
|
||||
ansible-config view -c ./ansible-non-existent.cfg 2> err1.txt || grep -Eq 'The provided configuration file is missing or not accessible:' err1.txt || (cat err*.txt; rm -f err1.txt; exit 1)
|
||||
ansible-config view -c ./no-extension 2> err2.txt || grep -q 'Unsupported configuration file extension' err2.txt || (cat err2.txt; rm -f err*.txt; exit 1)
|
||||
rm -f err*.txt
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
- name: check that warning is not given when force_apt_get set
|
||||
assert:
|
||||
that:
|
||||
- "'warnings' not in upgrade_result"
|
||||
- upgrade_result.warnings | default([]) | length == 0
|
||||
when:
|
||||
- force_apt_get
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
- name: run ping with loop to exceed quota
|
||||
win_ping:
|
||||
loop: '{{ range(0, 4) }}'
|
||||
loop: '{{ range(0, 4) | list }}'
|
||||
|
||||
always:
|
||||
- name: reset WinRM quota value
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ with io.BytesIO() as logfile:
|
|||
debugger_test_test.logfile = logfile
|
||||
|
||||
debugger_test_test.expect_exact('TASK: Task 1 (debug)> ')
|
||||
debugger_test_test.send('task.args["that"] = "true"\r')
|
||||
debugger_test_test.send('task.args["that"] = []\r')
|
||||
debugger_test_test.expect_exact('TASK: Task 1 (debug)> ')
|
||||
debugger_test_test.send('r\r')
|
||||
debugger_test_test.expect(pexpect.EOF)
|
||||
|
|
|
|||
|
|
@ -78,3 +78,9 @@
|
|||
- invalid_conditional is failed
|
||||
- invalid_conditional.stdout is defined
|
||||
- invalid_conditional.failed_when_result is contains('boomboomboom')
|
||||
|
||||
- name: add_host failed_when (coverage exercise for strategy)
|
||||
add_host:
|
||||
name: some_host
|
||||
groups: blah
|
||||
failed_when: false
|
||||
|
|
|
|||
|
|
@ -10,4 +10,4 @@
|
|||
assert:
|
||||
that:
|
||||
- bad_sub is failed
|
||||
- "'MODULE FAILURE' not in bad_sub['msg']"
|
||||
- bad_sub.msg is match "Bad subset 'nonsense' given to Ansible"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
- name: debug hash behaviour result
|
||||
debug:
|
||||
var: "{{ lookup('env', 'ANSIBLE_HASH_BEHAVIOUR') }}"
|
||||
var: lookup('env', 'ANSIBLE_HASH_BEHAVIOUR')
|
||||
verbosity: 2
|
||||
|
||||
- name: assert hash behaviour is merge or replace
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
- hn1 is changed
|
||||
- original.stdout == after_hn.stdout
|
||||
|
||||
- when: _hostname_file is defined and _hostname_file
|
||||
- when: _hostname_file is defined and _hostname_file is not none
|
||||
block:
|
||||
- name: See if current hostname file exists
|
||||
stat:
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@
|
|||
|
||||
- block:
|
||||
- name: EXPECTED FAILURE - test invalid var
|
||||
debug:
|
||||
var: '{{ lookup("vars", "doesnotexist") }}'
|
||||
raw: '{{ lookup("vars", "doesnotexist") }}'
|
||||
|
||||
- fail:
|
||||
msg: "should not get here"
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
copy:
|
||||
src: openssl_legacy.cnf
|
||||
dest: '{{ krb5_openssl_conf }}'
|
||||
when: krb5_openssl_conf | default(False, True)
|
||||
when: krb5_openssl_conf is defined and krb5_openssl_conf is truthy
|
||||
|
||||
- name: Include distribution specific variables
|
||||
include_vars: '{{ lookup("first_found", params) }}'
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
- "unarchive06_stat.stat.mode == '0600'"
|
||||
# Verify that file list is generated
|
||||
- "'files' in unarchive06"
|
||||
- "{{unarchive06['files']| length}} == 1"
|
||||
- unarchive06['files']| length == 1
|
||||
- "'foo-unarchive.txt' in unarchive06['files']"
|
||||
|
||||
- name: remove our tar.gz unarchive destination
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
- "unarchive07.changed == false"
|
||||
# Verify that file list is generated
|
||||
- "'files' in unarchive07"
|
||||
- "{{unarchive07['files']| length}} == 1"
|
||||
- unarchive07['files']| length == 1
|
||||
- "'foo-unarchive.txt' in unarchive07['files']"
|
||||
|
||||
- name: remove our tar.gz unarchive destination
|
||||
|
|
|
|||
|
|
@ -11,6 +11,5 @@
|
|||
|
||||
- assert:
|
||||
that:
|
||||
- '("%r"|format(undefined_variable)).startswith("AnsibleUndefined")'
|
||||
- undefined_set_fact is failed
|
||||
- undefined_set_fact.msg is contains 'undefined variable'
|
||||
- undefined_set_fact.msg is contains "has no attribute 'name'"
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ def main():
|
|||
'ini_host_vars_file',
|
||||
'ini_host',
|
||||
'pb_group_vars_file_child',
|
||||
# 'ini_group_vars_file_child', #FIXME: this contradicts documented precedence pb group vars files should override inventory ones
|
||||
# 'ini_group_vars_file_child', # FIXME: this contradicts documented precedence pb group vars files should override inventory ones
|
||||
'pb_group_vars_file_parent',
|
||||
'ini_group_vars_file_parent',
|
||||
'pb_group_vars_file_all',
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "fetch_missing_nofail is not failed"
|
||||
- "fetch_missing_nofail.msg"
|
||||
- "fetch_missing_nofail.msg | length > 0"
|
||||
- "fetch_missing_nofail is not changed"
|
||||
|
||||
- name: attempt to fetch a non-existent file - fail on missing
|
||||
|
|
@ -161,7 +161,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "fetch_missing is failed"
|
||||
- "fetch_missing.msg"
|
||||
- "fetch_missing.msg | length > 0"
|
||||
- "fetch_missing is not changed"
|
||||
|
||||
- name: attempt to fetch a non-existent file - fail on missing implicit
|
||||
|
|
@ -173,7 +173,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "fetch_missing_implicit is failed"
|
||||
- "fetch_missing_implicit.msg"
|
||||
- "fetch_missing_implicit.msg | length > 0"
|
||||
- "fetch_missing_implicit is not changed"
|
||||
|
||||
- name: create empty temp directory
|
||||
|
|
@ -191,7 +191,7 @@
|
|||
that:
|
||||
# Doesn't fail anymore, only returns a message.
|
||||
- "fetch_dir is not changed"
|
||||
- "fetch_dir.msg"
|
||||
- "fetch_dir.msg | length > 0"
|
||||
|
||||
- name: create file with special characters
|
||||
raw: Set-Content -LiteralPath '{{ remote_tmp_dir }}\abc$not var''quote‘‘' -Value 'abc'
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "getmac_result.rc == 0"
|
||||
- "getmac_result.stdout"
|
||||
- "getmac_result.stdout | length > 0"
|
||||
- (ansible_connection == 'ssh') | ternary(getmac_result.stderr is defined, not getmac_result.stderr)
|
||||
- "getmac_result is not failed"
|
||||
- "getmac_result is changed"
|
||||
|
|
@ -37,7 +37,6 @@
|
|||
assert:
|
||||
that:
|
||||
- "ipconfig_result.rc == 0"
|
||||
- "ipconfig_result.stdout"
|
||||
- "'Physical Address' in ipconfig_result.stdout"
|
||||
- (ansible_connection == 'ssh') | ternary(ipconfig_result.stderr is defined, not ipconfig_result.stderr)
|
||||
- "ipconfig_result is not failed"
|
||||
|
|
@ -52,7 +51,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "ipconfig_invalid_result.rc != 0"
|
||||
- "ipconfig_invalid_result.stdout" # ipconfig displays errors on stdout.
|
||||
- "ipconfig_invalid_result.stdout | length > 0" # ipconfig displays errors on stdout.
|
||||
# - "not ipconfig_invalid_result.stderr"
|
||||
- "ipconfig_invalid_result is failed"
|
||||
- "ipconfig_invalid_result is changed"
|
||||
|
|
@ -67,7 +66,7 @@
|
|||
that:
|
||||
- "unknown_result.rc != 0"
|
||||
- "not unknown_result.stdout"
|
||||
- "unknown_result.stderr" # An unknown command displays error on stderr.
|
||||
- "unknown_result.stderr | length > 0" # An unknown command displays error on stderr.
|
||||
- "unknown_result is failed"
|
||||
- "unknown_result is changed"
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
assert:
|
||||
that:
|
||||
- "test_script_result.rc == 0"
|
||||
- "test_script_result.stdout"
|
||||
- "'Woohoo' in test_script_result.stdout"
|
||||
- (ansible_connection == 'ssh') | ternary(test_script_result.stderr is defined, not test_script_result.stderr)
|
||||
- "test_script_result is not failed"
|
||||
|
|
@ -50,7 +49,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "test_script_with_args_result.rc == 0"
|
||||
- "test_script_with_args_result.stdout"
|
||||
- "test_script_with_args_result.stdout | length > 0"
|
||||
- "test_script_with_args_result.stdout_lines[0] == '/this'"
|
||||
- "test_script_with_args_result.stdout_lines[1] == '/that'"
|
||||
- "test_script_with_args_result.stdout_lines[2] == '/Ӧther'"
|
||||
|
|
@ -95,7 +94,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "test_script_with_splatting_result.rc == 0"
|
||||
- "test_script_with_splatting_result.stdout"
|
||||
- "test_script_with_splatting_result.stdout | length > 0"
|
||||
- "test_script_with_splatting_result.stdout_lines[0] == 'this'"
|
||||
- "test_script_with_splatting_result.stdout_lines[1] == test_win_script_value"
|
||||
- "test_script_with_splatting_result.stdout_lines[2] == 'other'"
|
||||
|
|
@ -111,7 +110,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "test_script_with_splatting2_result.rc == 0"
|
||||
- "test_script_with_splatting2_result.stdout"
|
||||
- "test_script_with_splatting2_result.stdout | length > 0"
|
||||
- "test_script_with_splatting2_result.stdout_lines[0] == 'THIS'"
|
||||
- "test_script_with_splatting2_result.stdout_lines[1] == 'THAT'"
|
||||
- "test_script_with_splatting2_result.stdout_lines[2] == 'OTHER'"
|
||||
|
|
@ -129,7 +128,7 @@
|
|||
that:
|
||||
- "test_script_with_errors_result.rc != 0"
|
||||
- "not test_script_with_errors_result.stdout"
|
||||
- "test_script_with_errors_result.stderr"
|
||||
- "test_script_with_errors_result.stderr | length > 0"
|
||||
- "test_script_with_errors_result is failed"
|
||||
- "test_script_with_errors_result is changed"
|
||||
|
||||
|
|
@ -203,7 +202,6 @@
|
|||
assert:
|
||||
that:
|
||||
- "test_batch_result.rc == 0"
|
||||
- "test_batch_result.stdout"
|
||||
- "'batch' in test_batch_result.stdout"
|
||||
- (ansible_connection == 'ssh') | ternary(test_batch_result.stderr is defined, not test_batch_result.stderr)
|
||||
- "test_batch_result is not failed"
|
||||
|
|
@ -217,7 +215,6 @@
|
|||
assert:
|
||||
that:
|
||||
- "test_cmd_result.rc == 0"
|
||||
- "test_cmd_result.stdout"
|
||||
- "'cmd extension' in test_cmd_result.stdout"
|
||||
- (ansible_connection == 'ssh') | ternary(test_cmd_result.stderr is defined, not test_cmd_result.stderr)
|
||||
- "test_cmd_result is not failed"
|
||||
|
|
@ -232,8 +229,8 @@
|
|||
assert:
|
||||
that:
|
||||
- test_batch_result.rc == 1
|
||||
- test_batch_result.stdout
|
||||
- test_batch_result.stderr
|
||||
- test_batch_result.stdout | length > 0
|
||||
- test_batch_result.stderr | length > 0
|
||||
- test_batch_result is failed
|
||||
- test_batch_result is changed
|
||||
when: not ansible_distribution_version.startswith('6.0')
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user