mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-03 12:44:25 -07:00
Add tests to verify role grants for roles
This commit is contained in:
parent
3bdeef9d32
commit
1782d55143
1 changed files with 27 additions and 2 deletions
|
@ -660,7 +660,6 @@
|
|||
- result.query_result.0.0['user_roles'] == 0
|
||||
when: install_type == 'mariadb'
|
||||
|
||||
# FIXME: do this check with mariadb too
|
||||
- name: Check in DB, if not granted, the query will fail
|
||||
<<: *task_params
|
||||
mysql_query:
|
||||
|
@ -675,6 +674,19 @@
|
|||
- result is failed
|
||||
when: install_type == 'mysql'
|
||||
|
||||
- name: Check in DB (mariadb)
|
||||
<<: *task_params
|
||||
mysql_query:
|
||||
<<: *mysql_params
|
||||
query: "SELECT count(User) as user_roles FROM mysql.roles_mapping WHERE User = '{{ role1 }}' AND Role = '{{ role0 }}'"
|
||||
when: install_type == 'mariadb'
|
||||
|
||||
- name: Check (mariadb)
|
||||
assert:
|
||||
that:
|
||||
- result.query_result.0.0['user_roles'] == 0
|
||||
when: install_type == 'mariadb'
|
||||
|
||||
#========================
|
||||
|
||||
- name: Rewrite members
|
||||
|
@ -774,7 +786,6 @@
|
|||
- result.query_result.0.0['user_roles'] == 1
|
||||
when: install_type == 'mariadb'
|
||||
|
||||
# FIXME: do this check on mariadb too
|
||||
- name: Check in DB, if not granted, the query will fail
|
||||
<<: *task_params
|
||||
mysql_query:
|
||||
|
@ -789,6 +800,20 @@
|
|||
- result is succeeded
|
||||
when: install_type == 'mysql'
|
||||
|
||||
- name: Check in DB (mariadb)
|
||||
<<: *task_params
|
||||
mysql_query:
|
||||
<<: *mysql_params
|
||||
query: "SELECT count(User) as user_roles FROM mysql.roles_mapping WHERE User = '{{ role1 }}' AND Role = '{{ role0 }}'"
|
||||
when: install_type == 'mariadb'
|
||||
|
||||
- name: Check (mariadb)
|
||||
assert:
|
||||
that:
|
||||
- result.query_result.0.0['user_roles'] == 1
|
||||
when: install_type == 'mariadb'
|
||||
|
||||
|
||||
#==========================
|
||||
|
||||
- name: Rewrite members again in check_mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue