mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-08 03:30:33 -07:00
* Add changes from stable-1 integrations tests (PR 418)
* Refactor to use connectors' info declared in setup_mysql
* Fix 2nd replication stop marked changed by mysqlclient
(cherry picked from commit 61586ae4cc
)
This commit is contained in:
parent
4cfdbe64a3
commit
108c4ae729
7 changed files with 18 additions and 16 deletions
|
@ -20,6 +20,7 @@
|
||||||
connector_name is search('pymysql')
|
connector_name is search('pymysql')
|
||||||
and connector_ver is version('0.9.3', '>=')
|
and connector_ver is version('0.9.3', '>=')
|
||||||
)
|
)
|
||||||
|
|
||||||
- name: Create include_dir
|
- name: Create include_dir
|
||||||
file:
|
file:
|
||||||
path: '{{ include_dir }}'
|
path: '{{ include_dir }}'
|
||||||
|
|
|
@ -343,7 +343,7 @@
|
||||||
that:
|
that:
|
||||||
# PyMySQL driver throws a warning, so the following is correct
|
# PyMySQL driver throws a warning, so the following is correct
|
||||||
- result is not changed
|
- result is not changed
|
||||||
when: connector.name.0 is search('pymysql')
|
when: connector_name is search('pymysql')
|
||||||
|
|
||||||
# Issue https://github.com/ansible-collections/community.mysql/issues/268
|
# Issue https://github.com/ansible-collections/community.mysql/issues/268
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -352,7 +352,7 @@
|
||||||
# if the state was changed or not.
|
# if the state was changed or not.
|
||||||
# We assume that it was for DDL queryes by default in the code
|
# We assume that it was for DDL queryes by default in the code
|
||||||
- result is changed
|
- result is changed
|
||||||
when: connector.name.0 is search('mysqlclient')
|
when: connector_name is search('mysqlclient')
|
||||||
|
|
||||||
- name: Drop db {{ test_db }}
|
- name: Drop db {{ test_db }}
|
||||||
mysql_query:
|
mysql_query:
|
||||||
|
|
|
@ -176,8 +176,8 @@
|
||||||
shell: "echo \"INSERT INTO {{ test_table }} (id) VALUES (1), (2), (3); FLUSH LOGS;\" | {{ mysql_command }} -P{{ mysql_primary_port }} {{ test_db }}"
|
shell: "echo \"INSERT INTO {{ test_table }} (id) VALUES (1), (2), (3); FLUSH LOGS;\" | {{ mysql_command }} -P{{ mysql_primary_port }} {{ test_db }}"
|
||||||
|
|
||||||
- name: Small pause to be sure the bin log, which was flushed previously, reached the replica
|
- name: Small pause to be sure the bin log, which was flushed previously, reached the replica
|
||||||
pause:
|
ansible.builtin.wait_for:
|
||||||
seconds: 2
|
timeout: 2
|
||||||
|
|
||||||
# Test master log pos has been changed:
|
# Test master log pos has been changed:
|
||||||
- name: Get replica status
|
- name: Get replica status
|
||||||
|
@ -207,13 +207,12 @@
|
||||||
fail_on_error: true
|
fail_on_error: true
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
# Task is changed with mysqlclient 2.0.1 and pymysql 0.9.3
|
# mysqlclient 2.0.1 always return "changed"
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result is not changed
|
- result is not changed
|
||||||
when:
|
when:
|
||||||
- connector_name is search('pymysql')
|
- connector_name == 'pymysql'
|
||||||
- connector_ver is version('0.9.3', '<=')
|
|
||||||
|
|
||||||
# Test stopreplica mode:
|
# Test stopreplica mode:
|
||||||
- name: Stop replica using deprecated stopslave choice
|
- name: Stop replica using deprecated stopslave choice
|
||||||
|
@ -228,7 +227,12 @@
|
||||||
- result is changed
|
- result is changed
|
||||||
- result.queries == ["STOP SLAVE"] or result.queries == ["STOP REPLICA"]
|
- result.queries == ["STOP SLAVE"] or result.queries == ["STOP REPLICA"]
|
||||||
|
|
||||||
|
- name: Pause for 2 seconds to let the replication stop
|
||||||
|
ansible.builtin.wait_for:
|
||||||
|
timeout: 2
|
||||||
|
|
||||||
# Test stopreplica mode:
|
# Test stopreplica mode:
|
||||||
|
# mysqlclient 2.0.1 always return "changed"
|
||||||
- name: Stop replica that is no longer running
|
- name: Stop replica that is no longer running
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
|
@ -237,10 +241,8 @@
|
||||||
fail_on_error: true
|
fail_on_error: true
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
# Task is changed with mysqlclient 2.0.1 and pymysql 0.9.3
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result is not changed
|
- result is not changed
|
||||||
when:
|
when:
|
||||||
- connector_name is search('pymysql')
|
- connector_name == 'pymysql'
|
||||||
- connector_ver is version('0.9.3', '<=')
|
|
||||||
|
|
|
@ -334,7 +334,6 @@
|
||||||
# plugins that are loaded by default are sha2*, but these aren't compatible with pymysql < 0.9, so skip these tests
|
# plugins that are loaded by default are sha2*, but these aren't compatible with pymysql < 0.9, so skip these tests
|
||||||
# for those versions.
|
# for those versions.
|
||||||
#
|
#
|
||||||
|
|
||||||
- name: Test plugin auth switching which doesn't work on pymysql < 0.9
|
- name: Test plugin auth switching which doesn't work on pymysql < 0.9
|
||||||
when:
|
when:
|
||||||
- >
|
- >
|
||||||
|
|
|
@ -35,6 +35,6 @@
|
||||||
- name: assert output variable info match mysql variable info
|
- name: assert output variable info match mysql variable info
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "result.changed == true"
|
- "result.changed | bool == true"
|
||||||
- "key_name in result.stdout"
|
- "key_name in result.stdout"
|
||||||
- "key_value in result.stdout"
|
- "key_value in result.stdout"
|
||||||
|
|
|
@ -46,12 +46,12 @@
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result is failed
|
- result is failed
|
||||||
when: connector.name.0 is search('pymysql')
|
when: connector_name is search('pymysql')
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result is succeeded
|
- result is succeeded
|
||||||
when: connector.name.0 is not search('pymysql')
|
when: connector_name is not search('pymysql')
|
||||||
|
|
||||||
- name: attempt connection with newly created user ignoring hostname
|
- name: attempt connection with newly created user ignoring hostname
|
||||||
mysql_variables:
|
mysql_variables:
|
||||||
|
|
|
@ -161,10 +161,10 @@
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- include: assert_var.yml changed=true output={{ oor_result }} var_name=max_connect_errors var_value=1
|
- include: assert_var.yml changed=true output={{ oor_result }} var_name=max_connect_errors var_value=1
|
||||||
when: connector.name.0 is not search('pymysql')
|
when: connector_name is not search('pymysql')
|
||||||
|
|
||||||
- include: assert_fail_msg.yml output={{ oor_result }} msg='Truncated incorrect'
|
- include: assert_fail_msg.yml output={{ oor_result }} msg='Truncated incorrect'
|
||||||
when: connector.name.0 is search('pymysql')
|
when: connector_name is search('pymysql')
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# Verify mysql_variable fails when setting an incorrect value (incorrect type)
|
# Verify mysql_variable fails when setting an incorrect value (incorrect type)
|
||||||
|
|
Loading…
Add table
Reference in a new issue