generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds support for 'change replication source to' statement
- Loading branch information
1 parent
6ce2f49
commit a8b7337
Showing
3 changed files
with
141 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...gration/targets/test_mysql_replication/tasks/mysql_replication_changereplication_mode.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
|
||
- vars: | ||
mysql_params: &mysql_params | ||
login_user: '{{ mysql_user }}' | ||
login_password: '{{ mysql_password }}' | ||
login_host: '{{ mysql_host }}' | ||
|
||
block: | ||
# Get primary log file and log pos: | ||
- name: Get primary status | ||
mysql_replication: | ||
<<: *mysql_params | ||
login_port: '{{ mysql_primary_port }}' | ||
mode: getprimary | ||
register: mysql_primary_status | ||
|
||
# Test changereplication mode: | ||
- name: Run replication | ||
mysql_replication: | ||
<<: *mysql_params | ||
login_port: '{{ mysql_replica1_port }}' | ||
mode: changereplication | ||
primary_host: '{{ mysql_host }}' | ||
primary_port: '{{ mysql_primary_port }}' | ||
primary_user: '{{ replication_user }}' | ||
primary_password: '{{ replication_pass }}' | ||
primary_log_file: '{{ mysql_primary_status.File }}' | ||
primary_log_pos: '{{ mysql_primary_status.Position }}' | ||
primary_ssl_ca: '' | ||
primary_ssl: no | ||
register: result | ||
|
||
- name: Assert that changereplication is changed and return expected query | ||
assert: | ||
that: | ||
- result is changed | ||
- result.queries == expected_queries | ||
vars: | ||
expected_queries: ["CHANGE REPLICATION SOURCE TO SOURCE_HOST='{{ mysql_host }}',\ | ||
SOURCE_USER='{{ replication_user }}',SOURCE_PASSWORD='********',\ | ||
SOURCE_PORT={{ mysql_primary_port }},SOURCE_LOG_FILE=\ | ||
'{{ mysql_primary_status.File }}',SOURCE_LOG_POS=\ | ||
{{ mysql_primary_status.Position }},SOURCE_SSL=0,SOURCE_SSL_CA=''"] | ||
|
||
# Test changereplication mode with channel: | ||
- name: Run replication | ||
mysql_replication: | ||
<<: *mysql_params | ||
login_port: '{{ mysql_replica1_port }}' | ||
mode: changereplication | ||
primary_user: '{{ replication_user }}' | ||
primary_password: '{{ replication_pass }}' | ||
channel: '{{ test_channel }}' | ||
|
||
register: with_channel_result_queries | ||
|
||
- name: Assert that changereplication is changed and is called correctly with channel | ||
assert: | ||
that: | ||
- with_channel_result_queries is changed | ||
- with_channel_result_queries.queries == expected_queries | ||
vars: | ||
expected_queries: ["CHANGE REPLICATION SOURCE TO SOURCE_USER='{{ replication_user }}',\ | ||
SOURCE_PASSWORD='********' FOR CHANNEL '{{ test_channel }}'"] |