Fix 2nd replication stop marked changed by mysqlclient

This commit is contained in:
Laurent Indermuehle 2022-08-15 09:33:14 +02:00
commit 4a82e16121
No known key found for this signature in database
GPG key ID: 93FA944C9F34DD09

View file

@ -184,8 +184,8 @@
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
pause:
seconds: 2
ansible.builtin.wait_for:
timeout: 2
# Test primary log pos has been changed:
- name: Get replica status
@ -218,13 +218,12 @@
fail_on_error: true
register: result
# Task is changed with mysqlclient 2.0.1 and pymysql 0.9.3
# mysqlclient 2.0.1 always return "changed"
- assert:
that:
- result is not changed
when:
- connector_name is search('pymysql')
- connector_ver is version('0.9.3', '<=')
- connector_name == 'pymysql'
# Test stopreplica mode:
- name: Stop replica
@ -239,7 +238,12 @@
- result is changed
- 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:
# mysqlclient 2.0.1 always return "changed"
- name: Stop replica that is no longer running
mysql_replication:
<<: *mysql_params
@ -251,6 +255,8 @@
- assert:
that:
- result is not changed
when:
- connector_name == 'pymysql'
# master / slave related choices were removed in 3.0.0
# https://github.com/ansible-collections/community.mysql/pull/252