Skip to content

Commit

Permalink
Add test to append invalid privs
Browse files Browse the repository at this point in the history
  • Loading branch information
rsicart committed Oct 30, 2021
1 parent ac18eea commit 04942d1
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@
- "'GRANT SELECT, DELETE ON `data2`.*' in result.stdout"
when: enable_check_mode == 'yes'

- name: Try to append invalid privileges
mysql_user:
<<: *mysql_params
name: '{{ user_name_4 }}'
password: '{{ user_password_4 }}'
priv: 'data1.*:INVALID/data2.*:SELECT'
append_privs: yes
state: present
check_mode: '{{ enable_check_mode }}'
register: result
ignore_errors: true

- name: Assert that there wasn't a change in privileges if check_mode is set to 'no'
assert:
that:
- "'Illegal privilege' in result.msg"
when: enable_check_mode == 'no'

##########
# Clean up
- name: Drop test databases
Expand Down

0 comments on commit 04942d1

Please sign in to comment.