mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-22 05:51:45 -07:00
Embed pymysql
within the collection and use default test container
This change eliminates the need to install the connector on each controlled node, as `pymysql` version 1.1.1 is now included. As a result, we can safely assume its availability, thus simplifying the testing process. Also, I managed to remove the need for pre-built test containers. We now use the default test containers from ansible-test.
This commit is contained in:
parent
16d530348d
commit
04af62c400
49 changed files with 4392 additions and 979 deletions
|
@ -4,6 +4,14 @@
|
|||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
|
||||
- name: "{{ role_name }} | Mains | Install required packages for testing"
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- bzip2 # To test mysql_db dump compression
|
||||
- iproute2 # To gather network facts
|
||||
- mariadb-client # Can't install both mysql_client, had to make a choice
|
||||
state: present
|
||||
|
||||
- name: Prepare the fake root folder
|
||||
ansible.builtin.import_tasks:
|
||||
file: fake_root.yml
|
||||
|
|
|
@ -1,23 +1,11 @@
|
|||
---
|
||||
|
||||
- name: "{{ role_name }} | Setvars | Extract Podman/Docker Network Gateway"
|
||||
ansible.builtin.shell:
|
||||
cmd: ip route|grep default|awk '{print $3}'
|
||||
register: ip_route_output
|
||||
- name: "{{ role_name }} | Setvars | Gather facts"
|
||||
ansible.builtin.setup:
|
||||
|
||||
- name: "{{ role_name }} | Setvars | Set Fact"
|
||||
ansible.builtin.set_fact:
|
||||
gateway_addr: "{{ ip_route_output.stdout }}"
|
||||
connector_name_lookup: >-
|
||||
{{ lookup(
|
||||
'file',
|
||||
'/root/ansible_collections/community/mysql/tests/integration/connector_name'
|
||||
) }}
|
||||
connector_version_lookup: >-
|
||||
{{ lookup(
|
||||
'file',
|
||||
'/root/ansible_collections/community/mysql/tests/integration/connector_version'
|
||||
) }}
|
||||
gateway_addr: "{{ ansible_default_ipv4.gateway }}"
|
||||
db_engine_name_lookup: >-
|
||||
{{ lookup(
|
||||
'file',
|
||||
|
@ -41,8 +29,6 @@
|
|||
|
||||
- name: "{{ role_name }} | Setvars | Set Fact using above facts"
|
||||
ansible.builtin.set_fact:
|
||||
connector_name: "{{ connector_name_lookup.strip() }}"
|
||||
connector_version: "{{ connector_version_lookup.strip() }}"
|
||||
db_engine: "{{ db_engine_name_lookup.strip() }}"
|
||||
db_version: "{{ db_engine_version_lookup.strip() }}"
|
||||
python_version: "{{ python_version_lookup.strip() }}"
|
||||
|
@ -69,8 +55,6 @@
|
|||
- name: "{{ role_name }} | Setvars | Output test informations"
|
||||
vars:
|
||||
msg: |-
|
||||
connector_name: {{ connector_name }}
|
||||
connector_version: {{ connector_version }}
|
||||
db_engine: {{ db_engine }}
|
||||
db_version: {{ db_version }}
|
||||
python_version: {{ python_version }}
|
||||
|
|
|
@ -1,63 +1,35 @@
|
|||
---
|
||||
|
||||
- vars:
|
||||
mysql_parameters: &mysql_params
|
||||
login_user: root
|
||||
login_password: msandbox
|
||||
login_host: "{{ gateway_addr }}"
|
||||
login_port: 3307
|
||||
- name: Query Primary container over TCP for MySQL/MariaDB version
|
||||
community.mysql.mysql_info:
|
||||
login_user: root
|
||||
login_password: msandbox
|
||||
login_host: "{{ gateway_addr }}"
|
||||
login_port: 3307
|
||||
filter:
|
||||
- version
|
||||
register: primary_info
|
||||
failed_when:
|
||||
- registred_db_version != db_version
|
||||
vars:
|
||||
registred_db_version:
|
||||
"{{ primary_info.version.major }}.{{ primary_info.version.minor }}\
|
||||
.{{ primary_info.version.release }}"
|
||||
|
||||
block:
|
||||
- name: Assert that expected Python is installed
|
||||
ansible.builtin.command:
|
||||
cmd: python{{ python_version }} -V
|
||||
changed_when: false
|
||||
register: python_in_use
|
||||
failed_when:
|
||||
- python_in_use.stdout is not search(python_version)
|
||||
|
||||
- name: Query Primary container over TCP for MySQL/MariaDB version
|
||||
mysql_info:
|
||||
<<: *mysql_params
|
||||
filter:
|
||||
- version
|
||||
register: primary_info
|
||||
|
||||
- name: Assert that test container runs the expected MySQL/MariaDB version
|
||||
assert:
|
||||
that:
|
||||
- registred_db_version == db_version
|
||||
vars:
|
||||
registred_db_version:
|
||||
"{{ primary_info.version.major }}.{{ primary_info.version.minor }}\
|
||||
.{{ primary_info.version.release }}"
|
||||
|
||||
- name: Assert that mysql_info module used the expected version of pymysql
|
||||
assert:
|
||||
that:
|
||||
- primary_info.connector_name == connector_name
|
||||
- primary_info.connector_version == connector_version
|
||||
when:
|
||||
- connector_name == 'pymysql'
|
||||
|
||||
- name: Assert that mysql_info module used the expected version of mysqlclient
|
||||
assert:
|
||||
that:
|
||||
- primary_info.connector_name == 'MySQLdb'
|
||||
- primary_info.connector_version == connector_version
|
||||
when:
|
||||
- connector_name == 'mysqlclient'
|
||||
|
||||
- name: Display the python version in use
|
||||
command:
|
||||
cmd: python{{ python_version }} -V
|
||||
changed_when: false
|
||||
register: python_in_use
|
||||
|
||||
- name: Assert that expected Python is installed
|
||||
assert:
|
||||
that:
|
||||
- python_in_use.stdout is search(python_version)
|
||||
|
||||
- name: Assert that we run the expected ansible version
|
||||
assert:
|
||||
that:
|
||||
- ansible_running_version == test_ansible_version
|
||||
vars:
|
||||
ansible_running_version:
|
||||
"{{ ansible_version.major }}.{{ ansible_version.minor }}"
|
||||
when:
|
||||
- test_ansible_version != 'devel' # Devel will change overtime
|
||||
- name: Assert that we run the expected ansible version
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- ansible_running_version == test_ansible_version
|
||||
vars:
|
||||
ansible_running_version:
|
||||
"{{ ansible_version.major }}.{{ ansible_version.minor }}"
|
||||
when:
|
||||
- test_ansible_version != 'devel' # Devel will change overtime
|
||||
|
|
|
@ -15,39 +15,18 @@
|
|||
|
||||
- name: Config overrides | Add blank line
|
||||
shell: 'echo "" >> {{ config_file }}'
|
||||
when:
|
||||
- >
|
||||
connector_name != 'pymysql'
|
||||
or (
|
||||
connector_name == 'pymysql'
|
||||
and connector_version is version('0.9.3', '>=')
|
||||
)
|
||||
|
||||
- name: Config overrides | Create include_dir
|
||||
file:
|
||||
path: '{{ include_dir }}'
|
||||
state: directory
|
||||
mode: '0777'
|
||||
when:
|
||||
- >
|
||||
connector_name != 'pymysql'
|
||||
or (
|
||||
connector_name == 'pymysql'
|
||||
and connector_version is version('0.9.3', '>=')
|
||||
)
|
||||
|
||||
- name: Config overrides | Add include_dir
|
||||
lineinfile:
|
||||
path: '{{ config_file }}'
|
||||
line: '!includedir {{ include_dir }}'
|
||||
insertafter: EOF
|
||||
when:
|
||||
- >
|
||||
connector_name != 'pymysql'
|
||||
or (
|
||||
connector_name == 'pymysql'
|
||||
and connector_version is version('0.9.3', '>=')
|
||||
)
|
||||
|
||||
- name: Config overrides | Create database using fake port to connect to, must fail
|
||||
mysql_db:
|
||||
|
|
|
@ -49,19 +49,8 @@
|
|||
login_port: '{{ mysql_primary_port }}'
|
||||
ca_cert: /tmp/cert.pem
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is failed
|
||||
when:
|
||||
- connector_name == 'pymysql'
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is succeeded
|
||||
when:
|
||||
- connector_name != 'pymysql'
|
||||
failed_when:
|
||||
- result is success
|
||||
|
||||
- name: attempt connection with newly created user ignoring hostname
|
||||
mysql_db:
|
||||
|
@ -74,11 +63,6 @@
|
|||
ca_cert: /tmp/cert.pem
|
||||
check_hostname: no
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is succeeded or 'pymysql >= 0.7.11 is required' in result.msg
|
||||
|
||||
- name: Drop mysql user
|
||||
mysql_user:
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
---
|
||||
# Added in 3.6.0 in
|
||||
# https://github.com/ansible-collections/community.mysql/pull/497
|
||||
|
||||
- name: Connector info | Assert connector_name exists and has expected values
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result.connector_name is defined
|
||||
- result.connector_name is in ['pymysql', 'MySQLdb']
|
||||
success_msg: >-
|
||||
Assertions passed, result.connector_name is {{ result.connector_name }}
|
||||
fail_msg: >-
|
||||
Assertion failed, result.connector_name is
|
||||
{{ result.connector_name | d('Unknown')}} which is different than expected
|
||||
pymysql or MySQLdb
|
||||
|
||||
- name: Connector info | Assert connector_version exists and has expected values
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result.connector_version is defined
|
||||
- >
|
||||
result.connector_version == 'Unknown'
|
||||
or result.connector_version is version(connector_version, '==')
|
||||
success_msg: >-
|
||||
Assertions passed, result.connector_version is
|
||||
{{ result.connector_version }}
|
||||
fail_msg: >-
|
||||
Assertion failed, result.connector_version is
|
||||
{{ result.connector_version }} which is different than expected
|
||||
{{ connector_version }}
|
|
@ -48,19 +48,8 @@
|
|||
login_port: '{{ mysql_primary_port }}'
|
||||
ca_cert: /tmp/cert.pem
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is failed
|
||||
when:
|
||||
- connector_name == 'pymysql'
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is succeeded
|
||||
when:
|
||||
- connector_name != 'pymysql'
|
||||
failed_when:
|
||||
- result is success
|
||||
|
||||
- name: attempt connection with newly created user ignoring hostname
|
||||
mysql_info:
|
||||
|
|
|
@ -57,10 +57,6 @@
|
|||
- result.engines != {}
|
||||
- result.users != {}
|
||||
|
||||
- name: mysql_info - Test connector informations display
|
||||
ansible.builtin.import_tasks:
|
||||
file: connector_info.yml
|
||||
|
||||
# Access by non-default cred file
|
||||
- name: mysql_info - check non-default cred file
|
||||
mysql_info:
|
||||
|
|
|
@ -48,19 +48,9 @@
|
|||
login_port: '{{ mysql_primary_port }}'
|
||||
ca_cert: /tmp/cert.pem
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is failed
|
||||
when:
|
||||
- connector_name == 'pymysql'
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is succeeded
|
||||
when:
|
||||
- connector_name != 'pymysql'
|
||||
ignore_errors: true
|
||||
failed_when:
|
||||
- result is success
|
||||
|
||||
- name: attempt connection with newly created user ignoring hostname
|
||||
mysql_query:
|
||||
|
@ -70,13 +60,8 @@
|
|||
login_host: '{{ mysql_host }}'
|
||||
login_port: '{{ mysql_primary_port }}'
|
||||
ca_cert: /tmp/cert.pem
|
||||
check_hostname: no
|
||||
check_hostname: false
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is succeeded or 'pymysql >= 0.7.11 is required' in result.msg
|
||||
|
||||
- name: Drop mysql user
|
||||
mysql_user:
|
||||
|
|
|
@ -360,30 +360,14 @@
|
|||
register: result
|
||||
|
||||
# Issue https://github.com/ansible-collections/community.mysql/issues/268
|
||||
- name: Assert that create table IF NOT EXISTS is not changed with pymysql
|
||||
# Though, the best thing would be to debug this and invert the condition...
|
||||
- name: Assert that create table IF NOT EXISTS is changed
|
||||
assert:
|
||||
that:
|
||||
# PyMySQL driver throws a warning for version before 0.10.0
|
||||
- result is not changed
|
||||
when:
|
||||
- connector_name == 'pymysql'
|
||||
- connector_version is version('0.10.0', '<')
|
||||
|
||||
# Issue https://github.com/ansible-collections/community.mysql/issues/268
|
||||
- name: Assert that create table IF NOT EXISTS is changed with mysqlclient
|
||||
assert:
|
||||
that:
|
||||
# Mysqlclient 2.0.1 and pymysql 0.10.0+ drivers throws no warning,
|
||||
# pymysql 0.10.0+ drivers throws no warning,
|
||||
# so it's impossible to figure out if the state was changed or not.
|
||||
# We assume that it was for DDL queries by default in the code
|
||||
- result is changed
|
||||
when:
|
||||
- >
|
||||
connector_name == 'mysqlclient'
|
||||
or (
|
||||
connector_name == 'pymysql'
|
||||
and connector_version is version('0.10.0', '>')
|
||||
)
|
||||
|
||||
- name: Drop db {{ test_db }}
|
||||
mysql_query:
|
||||
|
|
|
@ -48,19 +48,8 @@
|
|||
login_port: '{{ mysql_primary_port }}'
|
||||
ca_cert: /tmp/cert.pem
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is failed
|
||||
when:
|
||||
- connector_name == 'pymysql'
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is succeeded
|
||||
when:
|
||||
- connector_name != 'pymysql'
|
||||
failed_when:
|
||||
- result is success
|
||||
|
||||
- name: attempt connection with newly created user ignoring hostname
|
||||
mysql_replication:
|
||||
|
@ -70,13 +59,7 @@
|
|||
login_host: '{{ mysql_host }}'
|
||||
login_port: '{{ mysql_primary_port }}'
|
||||
ca_cert: /tmp/cert.pem
|
||||
check_hostname: no
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is succeeded or 'pymysql >= 0.7.11 is required' in result.msg
|
||||
check_hostname: false
|
||||
|
||||
- name: Drop mysql user
|
||||
mysql_user:
|
||||
|
|
|
@ -259,14 +259,11 @@
|
|||
fail_on_error: true
|
||||
register: result
|
||||
|
||||
# mysqlclient 2.0.1 and pymysql 0.10.0+ always return "changed"
|
||||
- name: Assert that startreplica is not changed
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
when:
|
||||
- connector_name == 'pymysql'
|
||||
- connector_version is version('0.10.0', '<')
|
||||
# # pymysql 0.10.0+ always return "changed"
|
||||
# - name: Assert that startreplica is not changed
|
||||
# assert:
|
||||
# that:
|
||||
# - result is not changed
|
||||
|
||||
# Test stopreplica mode:
|
||||
- name: Stop replica
|
||||
|
@ -286,23 +283,20 @@
|
|||
ansible.builtin.wait_for:
|
||||
timeout: 2
|
||||
|
||||
# Test stopreplica mode:
|
||||
# mysqlclient 2.0.1 and pymysql 0.10.0+ always return "changed"
|
||||
- name: Stop replica that is no longer running
|
||||
mysql_replication:
|
||||
<<: *mysql_params
|
||||
login_port: '{{ mysql_replica1_port }}'
|
||||
mode: stopreplica
|
||||
fail_on_error: true
|
||||
register: result
|
||||
# # Test stopreplica mode:
|
||||
# # pymysql 0.10.0+ always return "changed"
|
||||
# - name: Stop replica that is no longer running
|
||||
# mysql_replication:
|
||||
# <<: *mysql_params
|
||||
# login_port: '{{ mysql_replica1_port }}'
|
||||
# mode: stopreplica
|
||||
# fail_on_error: true
|
||||
# register: result
|
||||
|
||||
- name: Assert that stopreplica is not changed
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
when:
|
||||
- connector_name == 'pymysql'
|
||||
- connector_version is version('0.10.0', '<')
|
||||
# - name: Assert that stopreplica is not changed
|
||||
# assert:
|
||||
# that:
|
||||
# - result is not changed
|
||||
|
||||
# master / slave related choices were removed in 3.0.0
|
||||
# https://github.com/ansible-collections/community.mysql/pull/252
|
||||
|
|
|
@ -50,21 +50,8 @@
|
|||
login_port: '{{ mysql_primary_port }}'
|
||||
ca_cert: /tmp/cert.pem
|
||||
register: result
|
||||
ignore_errors: true
|
||||
|
||||
- name: Issue-28 | Assert connection failed
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
||||
when:
|
||||
- connector_name == 'pymysql'
|
||||
|
||||
- name: Issue-28 | Assert connection succeeded
|
||||
assert:
|
||||
that:
|
||||
- result is succeeded
|
||||
when:
|
||||
- connector_name != 'pymysql'
|
||||
failed_when:
|
||||
- result is success
|
||||
|
||||
- name: Issue-28 | Attempt connection with newly created user ignoring hostname
|
||||
mysql_user:
|
||||
|
@ -77,13 +64,6 @@
|
|||
login_port: '{{ mysql_primary_port }}'
|
||||
ca_cert: /tmp/cert.pem
|
||||
check_hostname: false
|
||||
register: result
|
||||
ignore_errors: true
|
||||
|
||||
- name: Issue-28 | Assert connection succeeded
|
||||
assert:
|
||||
that:
|
||||
- result is succeeded or 'pymysql >= 0.7.11 is required' in result.msg
|
||||
|
||||
- name: Issue-28 | Drop mysql user
|
||||
mysql_user:
|
||||
|
|
|
@ -403,75 +403,66 @@
|
|||
# plugins that are loaded by default are sha2*, but these aren't compatible with pymysql < 0.9, so skip these tests
|
||||
# for those versions.
|
||||
#
|
||||
- name: Plugin auth | Test plugin auth switching which doesn't work on pymysql < 0.9
|
||||
when:
|
||||
- >
|
||||
connector_name != 'pymysql'
|
||||
or (
|
||||
connector_name == 'pymysql'
|
||||
and connector_version is version('0.9', '>=')
|
||||
)
|
||||
block:
|
||||
|
||||
- name: Plugin auth | Create user with plugin auth (empty auth string)
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ test_user_name }}'
|
||||
plugin: '{{ test_plugin_type }}'
|
||||
priv: '{{ test_default_priv }}'
|
||||
register: result
|
||||
- name: Plugin auth | Create user with plugin auth (empty auth string)
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ test_user_name }}'
|
||||
plugin: '{{ test_plugin_type }}'
|
||||
priv: '{{ test_default_priv }}'
|
||||
register: result
|
||||
|
||||
- name: Plugin auth | Get user information (empty auth string)
|
||||
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
||||
register: show_create_user
|
||||
- name: Plugin auth | Get user information (empty auth string)
|
||||
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
||||
register: show_create_user
|
||||
|
||||
- name: Plugin auth | Check that the module made a change (empty auth string)
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- name: Plugin auth | Check that the module made a change (empty auth string)
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Plugin auth | Check that the expected plugin type is set (empty auth string)
|
||||
assert:
|
||||
that:
|
||||
- test_plugin_type in show_create_user.stdout
|
||||
when: db_engine == 'mysql' or (db_engine == 'mariadb' and db_version is version('10.3', '>='))
|
||||
- name: Plugin auth | Check that the expected plugin type is set (empty auth string)
|
||||
assert:
|
||||
that:
|
||||
- test_plugin_type in show_create_user.stdout
|
||||
when: db_engine == 'mysql' or (db_engine == 'mariadb' and db_version is version('10.3', '>='))
|
||||
|
||||
- include_tasks: utils/assert_user.yml
|
||||
vars:
|
||||
user_name: "{{ test_user_name }}"
|
||||
user_host: localhost
|
||||
priv: "{{ test_default_priv_type }}"
|
||||
- include_tasks: utils/assert_user.yml
|
||||
vars:
|
||||
user_name: "{{ test_user_name }}"
|
||||
user_host: localhost
|
||||
priv: "{{ test_default_priv_type }}"
|
||||
|
||||
- name: Plugin auth | Switch user to sha256_password auth plugin
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ test_user_name }}'
|
||||
plugin: sha256_password
|
||||
priv: '{{ test_default_priv }}'
|
||||
register: result
|
||||
- name: Plugin auth | Switch user to sha256_password auth plugin
|
||||
mysql_user:
|
||||
<<: *mysql_params
|
||||
name: '{{ test_user_name }}'
|
||||
plugin: sha256_password
|
||||
priv: '{{ test_default_priv }}'
|
||||
register: result
|
||||
|
||||
- name: Plugin auth | Get user information (sha256_password)
|
||||
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
||||
register: show_create_user
|
||||
- name: Plugin auth | Get user information (sha256_password)
|
||||
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
||||
register: show_create_user
|
||||
|
||||
- name: Plugin auth | Check that the module made a change (sha256_password)
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- name: Plugin auth | Check that the module made a change (sha256_password)
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Plugin auth | Check that the expected plugin type is set (sha256_password)
|
||||
assert:
|
||||
that:
|
||||
- "'sha256_password' in show_create_user.stdout"
|
||||
when: db_engine == 'mysql' or (db_engine == 'mariadb' and db_version is version('10.3', '>='))
|
||||
- name: Plugin auth | Check that the expected plugin type is set (sha256_password)
|
||||
assert:
|
||||
that:
|
||||
- "'sha256_password' in show_create_user.stdout"
|
||||
when: db_engine == 'mysql' or (db_engine == 'mariadb' and db_version is version('10.3', '>='))
|
||||
|
||||
- include_tasks: utils/assert_user.yml
|
||||
vars:
|
||||
user_name: "{{ test_user_name }}"
|
||||
user_host: localhost
|
||||
priv: "{{ test_default_priv_type }}"
|
||||
- include_tasks: utils/assert_user.yml
|
||||
vars:
|
||||
user_name: "{{ test_user_name }}"
|
||||
user_host: localhost
|
||||
priv: "{{ test_default_priv_type }}"
|
||||
|
||||
# Cleanup
|
||||
- include_tasks: utils/remove_user.yml
|
||||
vars:
|
||||
user_name: "{{ test_user_name }}"
|
||||
# Cleanup
|
||||
- include_tasks: utils/remove_user.yml
|
||||
vars:
|
||||
user_name: "{{ test_user_name }}"
|
||||
|
|
|
@ -48,19 +48,8 @@
|
|||
login_port: '{{ mysql_primary_port }}'
|
||||
ca_cert: /tmp/cert.pem
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is failed
|
||||
when:
|
||||
- connector_name == 'pymysql'
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is succeeded
|
||||
when:
|
||||
- connector_name != 'pymysql'
|
||||
failed_when:
|
||||
- result is success
|
||||
|
||||
- name: attempt connection with newly created user ignoring hostname
|
||||
mysql_variables:
|
||||
|
@ -70,13 +59,7 @@
|
|||
login_host: '{{ mysql_host }}'
|
||||
login_port: '{{ mysql_primary_port }}'
|
||||
ca_cert: /tmp/cert.pem
|
||||
check_hostname: no
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is succeeded or 'pymysql >= 0.7.11 is required' in result.msg
|
||||
check_hostname: false
|
||||
|
||||
- name: Drop mysql user
|
||||
mysql_user:
|
||||
|
|
|
@ -188,16 +188,14 @@
|
|||
output: "{{ oor_result }}"
|
||||
var_name: max_connect_errors
|
||||
var_value: 1
|
||||
when:
|
||||
- connector_name == 'mysqlclient'
|
||||
- db_engine == 'mysql' # mysqlclient returns "changed" with MariaDB
|
||||
|
||||
- include_tasks: assert_fail_msg.yml
|
||||
vars:
|
||||
output: "{{ oor_result }}"
|
||||
msg: 'Truncated incorrect'
|
||||
when:
|
||||
- connector_name == 'pymsql'
|
||||
# pymysql apply the invalid value without errors:
|
||||
# msg: "Variable change succeeded prev_value=100"
|
||||
# query: "SET GLOBAL `max_connect_errors` = -1"
|
||||
# - include_tasks: assert_fail_msg.yml
|
||||
# vars:
|
||||
# output: "{{ oor_result }}"
|
||||
# msg: 'Truncated incorrect'
|
||||
|
||||
# ============================================================
|
||||
# Verify mysql_variable fails when setting an incorrect value (incorrect type)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue