tests: change deprecated "include" to "include_tasks"

This commit is contained in:
Felix Hamme 2023-05-30 17:50:57 +02:00
commit 78a0edfd26
15 changed files with 312 additions and 88 deletions

View file

@ -35,13 +35,13 @@
block:
- include: issue-121.yml
- include_tasks: issue-121.yml
- include: issue-28.yml
- include_tasks: issue-28.yml
- include: test_resource_limits.yml
- include_tasks: test_resource_limits.yml
- include: test_idempotency.yml
- include_tasks: test_idempotency.yml
# ============================================================
# Create user with no privileges and verify default privileges are assign
@ -54,11 +54,19 @@
state: present
register: result
- include: utils/assert_user.yml user_name={{ user_name_1 }} user_host=localhost priv=USAGE
- include_tasks: utils/assert_user.yml
vars:
user_name: "{{ user_name_1 }}"
user_host: localhost
priv: USAGE
- include: utils/remove_user.yml user_name={{ user_name_1 }}
- include_tasks: utils/remove_user.yml
vars:
user_name: "{{ user_name_1 }}"
- include: utils/assert_no_user.yml user_name={{ user_name_1 }}
- include_tasks: utils/assert_no_user.yml
vars:
user_name: "{{ user_name_1 }}"
# ============================================================
# Create user with select privileges and verify select privileges are assign
@ -72,11 +80,19 @@
priv: '*.*:SELECT'
register: result
- include: utils/assert_user.yml user_name={{ user_name_2 }} user_host=localhost priv=SELECT
- include_tasks: utils/assert_user.yml
vars:
user_name: "{{ user_name_2 }}"
user_host: localhost
priv: SELECT
- include: utils/remove_user.yml user_name={{ user_name_2 }}
- include_tasks: utils/remove_user.yml
vars:
user_name: "{{ user_name_2 }}"
- include: utils/assert_no_user.yml user_name={{ user_name_2 }}
- include_tasks: utils/assert_no_user.yml
vars:
user_name: "{{ user_name_2 }}"
# ============================================================
# Assert user has access to multiple databases
@ -112,9 +128,12 @@
- "'{{ item }}' in result.stdout"
with_items: "{{db_names}}"
- include: utils/remove_user.yml user_name={{ user_name_1 }}
- include: utils/remove_user.yml user_name={{ user_name_2 }}
- include_tasks: utils/remove_user.yml
vars:
user_name: "{{ user_name_1 }}"
- include_tasks: utils/remove_user.yml
vars:
user_name: "{{ user_name_2 }}"
- name: Give user SELECT access to database via wildcard
mysql_user:
@ -172,50 +191,68 @@
- "'%db' in result.stdout"
- "'INSERT' in result.stdout"
- include: utils/remove_user.yml user_name={{user_name_1}}
- include_tasks: utils/remove_user.yml
vars:
user_name: "{{user_name_1}}"
# ============================================================
# Test plaintext and encrypted password scenarios.
#
- include: test_user_password.yml
- include_tasks: test_user_password.yml
# ============================================================
# Test plugin authentication scenarios.
#
# FIXME: mariadb sql syntax for create/update user is not compatible
- include: test_user_plugin_auth.yml
- include_tasks: test_user_plugin_auth.yml
when: db_engine == 'mysql'
# ============================================================
# Assert create user with SELECT privileges, attempt to create database and update privileges to create database
#
- include: test_privs.yml current_privilege=SELECT current_append_privs=no
- include_tasks: test_privs.yml
vars:
current_privilege: SELECT
current_append_privs: no
# ============================================================
# Assert creating user with SELECT privileges, attempt to create database and append privileges to create database
#
- include: test_privs.yml current_privilege=DROP current_append_privs=yes
- include_tasks: test_privs.yml
vars:
current_privilege: DROP
current_append_privs: yes
# ============================================================
# Assert create user with SELECT privileges, attempt to create database and update privileges to create database
#
- include: test_privs.yml current_privilege='UPDATE,ALTER' current_append_privs=no
- include_tasks: test_privs.yml
vars:
current_privilege: 'UPDATE,ALTER'
current_append_privs: no
# ============================================================
# 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
- include_tasks: test_privs.yml
vars:
current_privilege: 'INSERT,DELETE'
current_append_privs: yes
# Tests for the priv parameter with dict value (https://github.com/ansible/ansible/issues/57533)
- include: test_priv_dict.yml
- include_tasks: test_priv_dict.yml
# Test that append_privs will not attempt to make a change where current privileges are a superset of new privileges
# (https://github.com/ansible-collections/community.mysql/issues/69)
- include: test_priv_append.yml enable_check_mode=no
- include: test_priv_append.yml enable_check_mode=yes
- include_tasks: test_priv_append.yml
vars:
enable_check_mode: no
- include_tasks: test_priv_append.yml
vars:
enable_check_mode: yes
# Tests for the TLS requires dictionary
- include: test_tls_requirements.yml
- include_tasks: test_tls_requirements.yml
- import_tasks: issue-29511.yaml
tags:
@ -226,4 +263,4 @@
- issue-64560
# https://github.com/ansible-collections/community.mysql/issues/231
- include: test_user_grants_with_roles_applied.yml
- include_tasks: test_user_grants_with_roles_applied.yml