Adds functional tests for new mysql_user privs (#48403)
Adds tests for FUNCTION and PROCEDURE privs
This commit is contained in:
parent
9757d9d4c3
commit
cdc5ab7737
4 changed files with 87 additions and 0 deletions
|
@ -0,0 +1,8 @@
|
|||
USE foo;
|
||||
DELIMITER ;;
|
||||
CREATE FUNCTION `function` () RETURNS tinyint(4)
|
||||
BEGIN
|
||||
DECLARE NAME_FOUND tinyint DEFAULT 0;
|
||||
RETURN NAME_FOUND;
|
||||
END;;
|
||||
DELIMITER ;
|
|
@ -0,0 +1,5 @@
|
|||
USE bar;
|
||||
DELIMITER ;;
|
||||
CREATE PROCEDURE `procedure` ()
|
||||
SELECT * FROM bar;;
|
||||
DELIMITER ;
|
70
test/integration/targets/mysql_user/tasks/issue-29511.yaml
Normal file
70
test/integration/targets/mysql_user/tasks/issue-29511.yaml
Normal file
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
|
||||
- name: Issue test setup - drop database
|
||||
mysql_db:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
login_unix_socket: '{{ mysql_socket }}'
|
||||
loop:
|
||||
- foo
|
||||
- bar
|
||||
|
||||
- name: Issue test setup - create database
|
||||
mysql_db:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
login_unix_socket: '{{ mysql_socket }}'
|
||||
loop:
|
||||
- foo
|
||||
- bar
|
||||
|
||||
- name: Create function for test
|
||||
shell: "mysql < {{ role_path }}/files/create-function.sql"
|
||||
|
||||
- name: Create procedure for test
|
||||
shell: "mysql < {{ role_path }}/files/create-procedure.sql"
|
||||
|
||||
- name: Create user with FUNCTION and PROCEDURE privileges
|
||||
mysql_user:
|
||||
name: '{{ user_name_2 }}'
|
||||
password: '{{ user_password_2 }}'
|
||||
state: present
|
||||
priv: 'FUNCTION foo.function:EXECUTE/foo.*:SELECT/PROCEDURE bar.procedure:EXECUTE'
|
||||
login_unix_socket: '{{ mysql_socket }}'
|
||||
register: result
|
||||
|
||||
- name: Assert Create user with FUNCTION and PROCEDURE privileges
|
||||
assert:
|
||||
that:
|
||||
- result is success
|
||||
- result is changed
|
||||
|
||||
- name: Create user with FUNCTION and PROCEDURE privileges - Idempotent check
|
||||
mysql_user:
|
||||
name: '{{ user_name_2 }}'
|
||||
password: '{{ user_password_2 }}'
|
||||
state: present
|
||||
priv: 'FUNCTION foo.function:EXECUTE/foo.*:SELECT/PROCEDURE bar.procedure:EXECUTE'
|
||||
login_unix_socket: '{{ mysql_socket }}'
|
||||
register: result
|
||||
|
||||
- name: Assert Create user with FUNCTION and PROCEDURE privileges
|
||||
assert:
|
||||
that:
|
||||
- result is success
|
||||
- result is not changed
|
||||
|
||||
- name: Remove user
|
||||
mysql_user:
|
||||
name: '{{ user_name_2 }}'
|
||||
state: absent
|
||||
login_unix_socket: '{{ mysql_socket }}'
|
||||
|
||||
- name: Issue test teardown - cleanup databases
|
||||
mysql_db:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
login_unix_socket: '{{ mysql_socket }}'
|
||||
loop:
|
||||
- foo
|
||||
- bar
|
|
@ -207,3 +207,7 @@
|
|||
# Assert creating user with SELECT privileges, attempt to create database and append privileges to create database
|
||||
#
|
||||
- include: test_privs.yml current_privilege='INSERT,DELETE' current_append_privs=yes
|
||||
|
||||
- import_tasks: issue-29511.yaml
|
||||
tags:
|
||||
- issue-29511
|
||||
|
|
Loading…
Reference in a new issue