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
|
@ -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 }}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue