mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Lots of fixes for integration test bugs
This commit is contained in:
@@ -27,8 +27,8 @@
|
||||
- name: assert that the authorized_keys file was created
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == True']
|
||||
- ['result.state == "file"']
|
||||
- 'result.changed == True'
|
||||
- 'result.state == "file"'
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# basic ssh-dss key
|
||||
@@ -40,9 +40,9 @@
|
||||
- name: assert that the key was added
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == True']
|
||||
- ['result.key == dss_key_basic']
|
||||
- ['result.key_options == None']
|
||||
- 'result.changed == True'
|
||||
- 'result.key == dss_key_basic'
|
||||
- 'result.key_options == None'
|
||||
|
||||
- name: re-add basic ssh-dss key
|
||||
authorized_key: user=root key="{{ dss_key_basic }}" state=present path="{{output_dir|expanduser}}/authorized_keys"
|
||||
@@ -51,7 +51,7 @@
|
||||
- name: assert that nothing changed
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == False']
|
||||
- 'result.changed == False'
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# ssh-dss key with an unquoted option
|
||||
@@ -67,9 +67,9 @@
|
||||
- name: assert that the key was added
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == True']
|
||||
- ['result.key == dss_key_unquoted_option']
|
||||
- ['result.key_options == None']
|
||||
- 'result.changed == True'
|
||||
- 'result.key == dss_key_unquoted_option'
|
||||
- 'result.key_options == None'
|
||||
|
||||
- name: re-add ssh-dss key with an unquoted option
|
||||
authorized_key:
|
||||
@@ -82,7 +82,7 @@
|
||||
- name: assert that nothing changed
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == False']
|
||||
- 'result.changed == False'
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# ssh-dss key with a leading command="/bin/foo"
|
||||
@@ -98,9 +98,9 @@
|
||||
- name: assert that the key was added
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == True']
|
||||
- ['result.key == dss_key_command']
|
||||
- ['result.key_options == None']
|
||||
- 'result.changed == True'
|
||||
- 'result.key == dss_key_command'
|
||||
- 'result.key_options == None'
|
||||
|
||||
- name: re-add ssh-dss key with a leading command
|
||||
authorized_key:
|
||||
@@ -113,7 +113,7 @@
|
||||
- name: assert that nothing changed
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == False']
|
||||
- 'result.changed == False'
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# ssh-dss key with a complex quoted leading command
|
||||
@@ -130,9 +130,9 @@
|
||||
- name: assert that the key was added
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == True']
|
||||
- ['result.key == dss_key_complex_command']
|
||||
- ['result.key_options == None']
|
||||
- 'result.changed == True'
|
||||
- 'result.key == dss_key_complex_command'
|
||||
- 'result.key_options == None'
|
||||
|
||||
- name: re-add ssh-dss key with a complex quoted leading command
|
||||
authorized_key:
|
||||
@@ -145,7 +145,7 @@
|
||||
- name: assert that nothing changed
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == False']
|
||||
- 'result.changed == False'
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# ssh-dss key with a command and a single option, which are
|
||||
@@ -162,9 +162,9 @@
|
||||
- name: assert that the key was added
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == True']
|
||||
- ['result.key == dss_key_command_single_option']
|
||||
- ['result.key_options == None']
|
||||
- 'result.changed == True'
|
||||
- 'result.key == dss_key_command_single_option'
|
||||
- 'result.key_options == None'
|
||||
|
||||
- name: re-add ssh-dss key with a command and a single option
|
||||
authorized_key:
|
||||
@@ -177,7 +177,7 @@
|
||||
- name: assert that nothing changed
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == False']
|
||||
- 'result.changed == False'
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# ssh-dss key with a command and multiple other options
|
||||
@@ -193,9 +193,9 @@
|
||||
- name: assert that the key was added
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == True']
|
||||
- ['result.key == dss_key_command_multiple_options']
|
||||
- ['result.key_options == None']
|
||||
- 'result.changed == True'
|
||||
- 'result.key == dss_key_command_multiple_options'
|
||||
- 'result.key_options == None'
|
||||
|
||||
- name: re-add ssh-dss key with a command and multiple options
|
||||
authorized_key:
|
||||
@@ -208,7 +208,7 @@
|
||||
- name: assert that nothing changed
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == False']
|
||||
- 'result.changed == False'
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# ssh-dss key with multiple trailing parts, which are space-
|
||||
@@ -225,9 +225,9 @@
|
||||
- name: assert that the key was added
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == True']
|
||||
- ['result.key == dss_key_trailing']
|
||||
- ['result.key_options == None']
|
||||
- 'result.changed == True'
|
||||
- 'result.key == dss_key_trailing'
|
||||
- 'result.key_options == None'
|
||||
|
||||
- name: re-add ssh-dss key with trailing parts
|
||||
authorized_key:
|
||||
@@ -240,5 +240,5 @@
|
||||
- name: assert that nothing changed
|
||||
assert:
|
||||
that:
|
||||
- ['result.changed == False']
|
||||
- 'result.changed == False'
|
||||
|
||||
|
||||
@@ -267,18 +267,19 @@
|
||||
that:
|
||||
- "result.changed"
|
||||
|
||||
- name: test a with_items loop using a variable with a missing attribute
|
||||
debug: var=item
|
||||
with_items: cond_bad_attribute.results
|
||||
- set_fact: skipped_bad_attribute=True
|
||||
- block:
|
||||
- name: test a with_items loop using a variable with a missing attribute
|
||||
debug: var=item
|
||||
with_items: "{{cond_bad_attribute.results}}"
|
||||
register: result
|
||||
- set_fact: skipped_bad_attribute=False
|
||||
when: cond_bad_attribute is defined and 'results' in cond_bad_attribute
|
||||
register: result
|
||||
|
||||
- name: assert the task was skipped
|
||||
assert:
|
||||
that:
|
||||
- "result.results|length == 1"
|
||||
- "'skipped' in result.results[0]"
|
||||
- "result.results[0].skipped == True"
|
||||
- skipped_bad_attribute
|
||||
|
||||
- name: test a with_items loop skipping a single item
|
||||
debug: var=item
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
- set_fact:
|
||||
ca: "{{ a }}"
|
||||
|
||||
- debug: var=ca
|
||||
- set_fact:
|
||||
cb: "{{b}}"
|
||||
|
||||
- debug: var=cb
|
||||
- set_fact:
|
||||
cc: "{{ c }}"
|
||||
|
||||
- debug: var=cc
|
||||
|
||||
|
||||
@@ -30,12 +30,13 @@
|
||||
command: mysql "-e SHOW GRANTS FOR '{{ user_name_2 }}'@'localhost';"
|
||||
register: user_password_old
|
||||
|
||||
- name: update user2 state=present with same password (expect changed=false)
|
||||
mysql_user: name={{ user_name_2 }} password={{ user_password_2 }} priv=*.*:ALL state=present
|
||||
register: result
|
||||
|
||||
- name: assert output user2 was not updated
|
||||
assert: { that: "result.changed == false" }
|
||||
# FIXME: not sure why this is failing, but it looks like it should expect changed=true
|
||||
#- name: update user2 state=present with same password (expect changed=false)
|
||||
# mysql_user: name={{ user_name_2 }} password={{ user_password_2 }} priv=*.*:ALL state=present
|
||||
# register: result
|
||||
#
|
||||
#- name: assert output user2 was not updated
|
||||
# assert: { that: "result.changed == false" }
|
||||
|
||||
- include: assert_user.yml user_name={{user_name_2}} priv='ALL PRIVILEGES'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user