1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/mysql_user/tasks/issue-29511.yaml
Tim Rupp cdc5ab7737
Adds functional tests for new mysql_user privs (#48403)
Adds tests for FUNCTION and PROCEDURE privs
2018-11-09 08:59:19 -08:00

70 lines
1.7 KiB
YAML

---
- 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