mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-08 19:50:31 -07:00
Skip tests that rely on sha256_password if pymysql < 0.9
This commit is contained in:
parent
38a7d416b9
commit
096f7dc592
1 changed files with 58 additions and 49 deletions
|
@ -310,62 +310,71 @@
|
||||||
- include: remove_user.yml user_name={{ test_user_name }} user_password={{ test_plugin_auth_string }}
|
- include: remove_user.yml user_name={{ test_user_name }} user_password={{ test_plugin_auth_string }}
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# Test plugin auth switching from one type of plugin to another.
|
# Test plugin auth switching from one type of plugin to another. The only other 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: Get pymysql version
|
||||||
|
shell: pip show pymysql | awk '/Version/ {print $2}'
|
||||||
|
register: pymysql_version
|
||||||
|
|
||||||
- name: Create user with plugin auth (empty auth string)
|
- name: Test plugin auth switching which doesn't work on pymysql < 0.9
|
||||||
mysql_user:
|
when: pymysql_version.stdout is version('0.9', '>=')
|
||||||
<<: *mysql_params
|
block:
|
||||||
name: '{{ test_user_name }}'
|
|
||||||
plugin: '{{ test_plugin_type }}'
|
|
||||||
priv: '{{ test_default_priv }}'
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Check that the module made a change
|
- name: Create user with plugin auth (empty auth string)
|
||||||
assert:
|
mysql_user:
|
||||||
that:
|
<<: *mysql_params
|
||||||
- "result.changed == true"
|
name: '{{ test_user_name }}'
|
||||||
|
plugin: '{{ test_plugin_type }}'
|
||||||
|
priv: '{{ test_default_priv }}'
|
||||||
|
register: result
|
||||||
|
|
||||||
- include: assert_user.yml user_name={{ test_user_name }} priv={{ test_default_priv_type }}
|
|
||||||
|
|
||||||
- name: Get the MySQL version using an empty password for the newly created user
|
- name: Check that the module made a change
|
||||||
mysql_info:
|
assert:
|
||||||
login_user: '{{ test_user_name }}'
|
that:
|
||||||
login_password: ''
|
- "result.changed == true"
|
||||||
login_host: '{{ mysql_host }}'
|
|
||||||
login_port: '{{ mysql_primary_port }}'
|
|
||||||
filter: version
|
|
||||||
register: result
|
|
||||||
ignore_errors: true
|
|
||||||
|
|
||||||
- name: Assert that mysql_info was successful
|
- include: assert_user.yml user_name={{ test_user_name }} priv={{ test_default_priv_type }}
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == false"
|
|
||||||
|
|
||||||
- name: Switch user to sha256_password auth plugin
|
- name: Get the MySQL version using an empty password for the newly created user
|
||||||
mysql_user:
|
mysql_info:
|
||||||
<<: *mysql_params
|
login_user: '{{ test_user_name }}'
|
||||||
name: '{{ test_user_name }}'
|
login_password: ''
|
||||||
plugin: sha256_password
|
login_host: '{{ mysql_host }}'
|
||||||
plugin_auth_string: '{{ test_plugin_auth_string }}'
|
login_port: '{{ mysql_primary_port }}'
|
||||||
priv: '{{ test_default_priv }}'
|
filter: version
|
||||||
register: result
|
register: result
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Get the MySQL version using the new plugin auth string
|
- name: Assert that mysql_info was successful
|
||||||
mysql_info:
|
assert:
|
||||||
login_user: '{{ test_user_name }}'
|
that:
|
||||||
login_password: '{{ test_plugin_auth_string }}'
|
- "result.failed == false"
|
||||||
login_host: '{{ mysql_host }}'
|
|
||||||
login_port: '{{ mysql_primary_port }}'
|
|
||||||
filter: version
|
|
||||||
register: result
|
|
||||||
ignore_errors: true
|
|
||||||
|
|
||||||
- name: Assert that mysql_info was successful
|
- name: Switch user to sha256_password auth plugin
|
||||||
assert:
|
mysql_user:
|
||||||
that:
|
<<: *mysql_params
|
||||||
- "result.failed == false"
|
name: '{{ test_user_name }}'
|
||||||
|
plugin: sha256_password
|
||||||
|
plugin_auth_string: '{{ test_plugin_auth_string }}'
|
||||||
|
priv: '{{ test_default_priv }}'
|
||||||
|
register: result
|
||||||
|
|
||||||
# Cleanup
|
- name: Get the MySQL version using the new plugin auth string
|
||||||
- include: remove_user.yml user_name={{ test_user_name }} user_password={{ test_plugin_auth_string }}
|
mysql_info:
|
||||||
|
login_user: '{{ test_user_name }}'
|
||||||
|
login_password: '{{ test_plugin_auth_string }}'
|
||||||
|
login_host: '{{ mysql_host }}'
|
||||||
|
login_port: '{{ mysql_primary_port }}'
|
||||||
|
filter: version
|
||||||
|
register: result
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: Assert that mysql_info was successful
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "result.failed == false"
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
- include: remove_user.yml user_name={{ test_user_name }} user_password={{ test_plugin_auth_string }}
|
||||||
|
|
Loading…
Add table
Reference in a new issue