mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-13 06:00:33 -07:00
Change tests
This commit is contained in:
parent
42797b1573
commit
a53dbd0172
7 changed files with 48 additions and 48 deletions
tests/integration/targets/test_mysql_replication
|
@ -7,7 +7,7 @@ mysql_replica2_port: 3309
|
||||||
|
|
||||||
test_db: test_db
|
test_db: test_db
|
||||||
test_table: test_table
|
test_table: test_table
|
||||||
test_master_delay: 60
|
test_primary_delay: 60
|
||||||
replication_user: replication_user
|
replication_user: replication_user
|
||||||
replication_pass: replication_pass
|
replication_pass: replication_pass
|
||||||
dump_path: /tmp/dump.sql
|
dump_path: /tmp/dump.sql
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
- name: attempt connection with newly created user (expect failure)
|
- name: attempt connection with newly created user (expect failure)
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
mode: getmaster
|
mode: getprimary
|
||||||
login_user: '{{ user_name_1 }}'
|
login_user: '{{ user_name_1 }}'
|
||||||
login_password: '{{ user_password_1 }}'
|
login_password: '{{ user_password_1 }}'
|
||||||
login_host: 127.0.0.1
|
login_host: 127.0.0.1
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
- name: attempt connection with newly created user ignoring hostname
|
- name: attempt connection with newly created user ignoring hostname
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
mode: getmaster
|
mode: getprimary
|
||||||
login_user: '{{ user_name_1 }}'
|
login_user: '{{ user_name_1 }}'
|
||||||
login_password: '{{ user_password_1 }}'
|
login_password: '{{ user_password_1 }}'
|
||||||
login_host: 127.0.0.1
|
login_host: 127.0.0.1
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
# Initial CI tests of mysql_replication module:
|
# Initial CI tests of mysql_replication module:
|
||||||
- import_tasks: mysql_replication_initial.yml
|
- import_tasks: mysql_replication_initial.yml
|
||||||
|
|
||||||
# Tests of master_delay parameter:
|
# Tests of primary_delay parameter:
|
||||||
- import_tasks: mysql_replication_master_delay.yml
|
- import_tasks: mysql_replication_primary_delay.yml
|
||||||
|
|
||||||
# Tests of channel parameter:
|
# Tests of channel parameter:
|
||||||
- import_tasks: mysql_replication_channel.yml
|
- import_tasks: mysql_replication_channel.yml
|
||||||
|
|
||||||
# Tests of resetmaster mode:
|
# Tests of resetprimary mode:
|
||||||
- import_tasks: mysql_replication_resetmaster_mode.yml
|
- import_tasks: mysql_replication_resetprimary_mode.yml
|
||||||
|
|
||||||
- include: issue-28.yml
|
- include: issue-28.yml
|
||||||
|
|
|
@ -8,26 +8,26 @@
|
||||||
login_host: 127.0.0.1
|
login_host: 127.0.0.1
|
||||||
|
|
||||||
block:
|
block:
|
||||||
# Get master log file and log pos:
|
# Get primary log file and log pos:
|
||||||
- name: Get master status
|
- name: Get primary status
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
login_port: '{{ mysql_primary_port }}'
|
login_port: '{{ mysql_primary_port }}'
|
||||||
mode: getmaster
|
mode: getprimary
|
||||||
register: mysql_primary_status
|
register: mysql_primary_status
|
||||||
|
|
||||||
# Test changemaster mode:
|
# Test changeprimary mode:
|
||||||
- name: Run replication with channel
|
- name: Run replication with channel
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
login_port: '{{ mysql_replica2_port }}'
|
login_port: '{{ mysql_replica2_port }}'
|
||||||
mode: changemaster
|
mode: changeprimary
|
||||||
master_host: '{{ mysql_host }}'
|
primary_host: '{{ mysql_host }}'
|
||||||
master_port: '{{ mysql_primary_port }}'
|
primary_port: '{{ mysql_primary_port }}'
|
||||||
master_user: '{{ replication_user }}'
|
primary_user: '{{ replication_user }}'
|
||||||
master_password: '{{ replication_pass }}'
|
primary_password: '{{ replication_pass }}'
|
||||||
master_log_file: '{{ mysql_primary_status.File }}'
|
primary_log_file: '{{ mysql_primary_status.File }}'
|
||||||
master_log_pos: '{{ mysql_primary_status.Position }}'
|
primary_log_pos: '{{ mysql_primary_status.Position }}'
|
||||||
channel: '{{ test_channel }}'
|
channel: '{{ test_channel }}'
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
|
|
@ -49,12 +49,12 @@
|
||||||
- name: Restore the dump to replica2
|
- name: Restore the dump to replica2
|
||||||
shell: '{{ mysql_command }} -P{{ mysql_replica2_port }} < {{ dump_path }}'
|
shell: '{{ mysql_command }} -P{{ mysql_replica2_port }} < {{ dump_path }}'
|
||||||
|
|
||||||
# Test getmaster mode:
|
# Test getprimary mode:
|
||||||
- name: Get master status
|
- name: Get primary status
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
login_port: '{{ mysql_primary_port }}'
|
login_port: '{{ mysql_primary_port }}'
|
||||||
mode: getmaster
|
mode: getprimary
|
||||||
register: mysql_primary_status
|
register: mysql_primary_status
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -63,8 +63,8 @@
|
||||||
- mysql_primary_status.Position != 0
|
- mysql_primary_status.Position != 0
|
||||||
- mysql_primary_status is not changed
|
- mysql_primary_status is not changed
|
||||||
|
|
||||||
# Test startreplica fails without changemaster first. This needs fail_on_error
|
# Test startreplica fails without changeprimary first. This needs fail_on_error
|
||||||
- name: Start replica (using deprecated startslave choice) and fail because master is not specified; failing on error as requested
|
- name: Start replica (using deprecated startslave choice) and fail because primary is not specified; failing on error as requested
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
login_port: '{{ mysql_replica1_port }}'
|
login_port: '{{ mysql_replica1_port }}'
|
||||||
|
@ -103,21 +103,21 @@
|
||||||
that:
|
that:
|
||||||
- result is not failed
|
- result is not failed
|
||||||
|
|
||||||
# Test changemaster mode:
|
# Test changeprimary mode:
|
||||||
# master_ssl_ca will be set as '' to check the module's behaviour for #23976,
|
# primary_ssl_ca will be set as '' to check the module's behaviour for #23976,
|
||||||
# must be converted to an empty string
|
# must be converted to an empty string
|
||||||
- name: Run replication
|
- name: Run replication
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
login_port: '{{ mysql_replica1_port }}'
|
login_port: '{{ mysql_replica1_port }}'
|
||||||
mode: changemaster
|
mode: changeprimary
|
||||||
master_host: '{{ mysql_host }}'
|
primary_host: '{{ mysql_host }}'
|
||||||
master_port: '{{ mysql_primary_port }}'
|
primary_port: '{{ mysql_primary_port }}'
|
||||||
master_user: '{{ replication_user }}'
|
primary_user: '{{ replication_user }}'
|
||||||
master_password: '{{ replication_pass }}'
|
primary_password: '{{ replication_pass }}'
|
||||||
master_log_file: '{{ mysql_primary_status.File }}'
|
primary_log_file: '{{ mysql_primary_status.File }}'
|
||||||
master_log_pos: '{{ mysql_primary_status.Position }}'
|
primary_log_pos: '{{ mysql_primary_status.Position }}'
|
||||||
master_ssl_ca: ''
|
primary_ssl_ca: ''
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
pause:
|
pause:
|
||||||
seconds: 2
|
seconds: 2
|
||||||
|
|
||||||
# Test master log pos has been changed:
|
# Test primary log pos has been changed:
|
||||||
- name: Get replica status
|
- name: Get replica status
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
|
|
||||||
block:
|
block:
|
||||||
|
|
||||||
# Test master_delay mode:
|
# Test primary_delay mode:
|
||||||
- name: Run replication
|
- name: Run replication
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
login_port: '{{ mysql_replica1_port }}'
|
login_port: '{{ mysql_replica1_port }}'
|
||||||
mode: changemaster
|
mode: changeprimary
|
||||||
master_delay: '{{ test_master_delay }}'
|
primary_delay: '{{ test_primary_delay }}'
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
mode: startreplica
|
mode: startreplica
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
# Check master_delay:
|
# Check primary_delay:
|
||||||
- name: Get standby status
|
- name: Get standby status
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
|
@ -41,5 +41,5 @@
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- replica_status.SQL_Delay == {{ test_master_delay }}
|
- replica_status.SQL_Delay == {{ test_primary_delay }}
|
||||||
- replica_status is not changed
|
- replica_status is not changed
|
|
@ -22,20 +22,20 @@
|
||||||
login_port: '{{ mysql_replica1_port }}'
|
login_port: '{{ mysql_replica1_port }}'
|
||||||
mode: resetreplicaall
|
mode: resetreplicaall
|
||||||
|
|
||||||
# Get master initial status:
|
# Get primary initial status:
|
||||||
- name: Get master status
|
- name: Get primary status
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
login_port: '{{ mysql_primary_port }}'
|
login_port: '{{ mysql_primary_port }}'
|
||||||
mode: getmaster
|
mode: getprimary
|
||||||
register: mysql_primary_initial_status
|
register: mysql_primary_initial_status
|
||||||
|
|
||||||
# Test resetmaster mode:
|
# Test resetprimary mode:
|
||||||
- name: Reset master
|
- name: Reset primary
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
login_port: '{{ mysql_primary_port }}'
|
login_port: '{{ mysql_primary_port }}'
|
||||||
mode: resetmaster
|
mode: resetprimary
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -43,12 +43,12 @@
|
||||||
- result is changed
|
- result is changed
|
||||||
- result.queries == ["RESET MASTER"]
|
- result.queries == ["RESET MASTER"]
|
||||||
|
|
||||||
# Get master final status:
|
# Get primary final status:
|
||||||
- name: Get master status
|
- name: Get primary status
|
||||||
mysql_replication:
|
mysql_replication:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
login_port: '{{ mysql_primary_port }}'
|
login_port: '{{ mysql_primary_port }}'
|
||||||
mode: getmaster
|
mode: getprimary
|
||||||
register: mysql_primary_final_status
|
register: mysql_primary_final_status
|
||||||
|
|
||||||
- assert:
|
- assert:
|
Loading…
Add table
Reference in a new issue