mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-08 11:40:33 -07:00
make integration tests work
This commit is contained in:
parent
a69c0e91d6
commit
778fbd497c
4 changed files with 22 additions and 11 deletions
|
@ -932,7 +932,8 @@ class Role():
|
||||||
result = user_mod(self.cursor, self.name, self.host,
|
result = user_mod(self.cursor, self.name, self.host,
|
||||||
None, None, None, None, None, None,
|
None, None, None, None, None, None,
|
||||||
privs, append_privs, subtract_privs, None,
|
privs, append_privs, subtract_privs, None,
|
||||||
self.module, role=True, maria_role=self.is_mariadb)
|
self.module, None, None, role=True,
|
||||||
|
maria_role=self.is_mariadb)
|
||||||
changed = result['changed']
|
changed = result['changed']
|
||||||
|
|
||||||
if admin:
|
if admin:
|
||||||
|
|
|
@ -16,15 +16,15 @@
|
||||||
- version
|
- version
|
||||||
register: primary_info
|
register: primary_info
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
registred_db_version: "'{{ primary_info.version.major }}.{{ primary_info.version.minor }}\
|
|
||||||
.{{ primary_info.version.release }}'"
|
|
||||||
db_version_value: "'{{ db_version }}'"
|
|
||||||
|
|
||||||
- name: Assert that test container runs the expected MySQL/MariaDB version
|
- name: Assert that test container runs the expected MySQL/MariaDB version
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- registred_db_version == db_version_value
|
- registred_db_version == db_version_value
|
||||||
|
vars:
|
||||||
|
registred_db_version: "'{{ primary_info.version.major }}.{{ primary_info.version.minor }}\
|
||||||
|
.{{ primary_info.version.release }}'"
|
||||||
|
db_version_value: "'{{ db_version }}'"
|
||||||
|
|
||||||
- name: Assert that mysql_info module used the expected version of pymysql
|
- name: Assert that mysql_info module used the expected version of pymysql
|
||||||
assert:
|
assert:
|
||||||
|
|
|
@ -339,7 +339,9 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
- "result.db =='{{ db_name }}'"
|
- result.db == db_name_value
|
||||||
|
vars:
|
||||||
|
db_name_value: "{{ db_name }}"
|
||||||
|
|
||||||
# - name: Dump and Import | Assert database was backed up successfully
|
# - name: Dump and Import | Assert database was backed up successfully
|
||||||
# command: "file {{ db_file_name }}"
|
# command: "file {{ db_file_name }}"
|
||||||
|
|
|
@ -158,7 +158,9 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
- result.queries == ["CHANGE MASTER TO MASTER_HOST='{{ mysql_host }}',MASTER_USER='{{ replication_user }}',MASTER_PASSWORD='********',MASTER_PORT={{ mysql_primary_port }},MASTER_LOG_FILE='{{ mysql_primary_status.File }}',MASTER_LOG_POS={{ mysql_primary_status.Position }},MASTER_SSL=0,MASTER_SSL_CA=''"]
|
- result.queries == result_query
|
||||||
|
vars:
|
||||||
|
result_query: ["CHANGE MASTER TO MASTER_HOST='{{ mysql_host }}',MASTER_USER='{{ replication_user }}',MASTER_PASSWORD='********',MASTER_PORT={{ mysql_primary_port }},MASTER_LOG_FILE='{{ mysql_primary_status.File }}',MASTER_LOG_POS={{ mysql_primary_status.Position }},MASTER_SSL=0,MASTER_SSL_CA=''"]
|
||||||
|
|
||||||
# Test startreplica mode:
|
# Test startreplica mode:
|
||||||
- name: Start replica
|
- name: Start replica
|
||||||
|
@ -186,25 +188,31 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- replica_status.Is_Replica == true
|
- replica_status.Is_Replica == true
|
||||||
- replica_status.Master_Host == '{{ mysql_host }}'
|
- replica_status.Master_Host == mysql_host_value
|
||||||
- replica_status.Exec_Master_Log_Pos == mysql_primary_status.Position
|
- replica_status.Exec_Master_Log_Pos == mysql_primary_status.Position
|
||||||
- replica_status.Master_Port == {{ mysql_primary_port }}
|
- replica_status.Master_Port == mysql_primary_port_value
|
||||||
- replica_status.Last_IO_Errno == 0
|
- replica_status.Last_IO_Errno == 0
|
||||||
- replica_status.Last_IO_Error == ''
|
- replica_status.Last_IO_Error == ''
|
||||||
- replica_status is not changed
|
- replica_status is not changed
|
||||||
when: mysql8022_and_higher == false
|
when: mysql8022_and_higher == false
|
||||||
|
vars:
|
||||||
|
mysql_host_value: "{{ mysql_host }}"
|
||||||
|
mysql_primary_port_value: "{{ mysql_primary_port }}"
|
||||||
|
|
||||||
- name: Assert that getreplica returns expected values for MySQL newer than 8.0.22
|
- name: Assert that getreplica returns expected values for MySQL newer than 8.0.22
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- replica_status.Is_Replica == true
|
- replica_status.Is_Replica == true
|
||||||
- replica_status.Source_Host == '{{ mysql_host }}'
|
- replica_status.Source_Host == mysql_host_value
|
||||||
- replica_status.Exec_Source_Log_Pos == mysql_primary_status.Position
|
- replica_status.Exec_Source_Log_Pos == mysql_primary_status.Position
|
||||||
- replica_status.Source_Port == {{ mysql_primary_port }}
|
- replica_status.Source_Port == mysql_primary_port_value
|
||||||
- replica_status.Last_IO_Errno == 0
|
- replica_status.Last_IO_Errno == 0
|
||||||
- replica_status.Last_IO_Error == ''
|
- replica_status.Last_IO_Error == ''
|
||||||
- replica_status is not changed
|
- replica_status is not changed
|
||||||
when: mysql8022_and_higher == true
|
when: mysql8022_and_higher == true
|
||||||
|
vars:
|
||||||
|
mysql_host_value: "{{ mysql_host }}"
|
||||||
|
mysql_primary_port_value: "{{ mysql_primary_port }}"
|
||||||
|
|
||||||
# Create test table and add data to it:
|
# Create test table and add data to it:
|
||||||
- name: Create test table
|
- name: Create test table
|
||||||
|
|
Loading…
Add table
Reference in a new issue