mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-27 00:11:45 -07:00
Add changes from stable-1 integrations tests (PR 418)
This commit is contained in:
parent
97318559e5
commit
aa7818f922
12 changed files with 47 additions and 24 deletions
|
@ -14,7 +14,12 @@
|
||||||
- name: Add blank line
|
- name: Add blank line
|
||||||
shell: 'echo "" >> {{ config_file }}'
|
shell: 'echo "" >> {{ config_file }}'
|
||||||
when:
|
when:
|
||||||
- (connector.name.0 is search('pymysql') and connector_ver is version('0.9.3', '>=')) or connector.name.0 is not search('pymysql')
|
- >
|
||||||
|
connector_name is not search('pymysql')
|
||||||
|
or (
|
||||||
|
connector_name is search('pymysql')
|
||||||
|
and connector_ver is version('0.9.3', '>=')
|
||||||
|
)
|
||||||
|
|
||||||
- name: Create include_dir
|
- name: Create include_dir
|
||||||
file:
|
file:
|
||||||
|
@ -22,7 +27,12 @@
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0777'
|
mode: '0777'
|
||||||
when:
|
when:
|
||||||
- (connector.name.0 is search('pymysql') and connector_ver is version('0.9.3', '>=')) or connector.name.0 is not search('pymysql')
|
- >
|
||||||
|
connector_name is not search('pymysql')
|
||||||
|
or (
|
||||||
|
connector_name is search('pymysql')
|
||||||
|
and connector_ver is version('0.9.3', '>=')
|
||||||
|
)
|
||||||
|
|
||||||
- name: Add include_dir
|
- name: Add include_dir
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -30,7 +40,12 @@
|
||||||
line: '!includedir {{ include_dir }}'
|
line: '!includedir {{ include_dir }}'
|
||||||
insertafter: EOF
|
insertafter: EOF
|
||||||
when:
|
when:
|
||||||
- (connector.name.0 is search('pymysql') and connector_ver is version('0.9.3', '>=')) or connector.name.0 is not search('pymysql')
|
- >
|
||||||
|
connector_name is not search('pymysql')
|
||||||
|
or (
|
||||||
|
connector_name is search('pymysql')
|
||||||
|
and connector_ver is version('0.9.3', '>=')
|
||||||
|
)
|
||||||
|
|
||||||
- name: Create database using fake port to connect to, must fail
|
- name: Create database using fake port to connect to, must fail
|
||||||
mysql_db:
|
mysql_db:
|
||||||
|
|
|
@ -52,12 +52,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_db:
|
mysql_db:
|
||||||
|
|
|
@ -54,12 +54,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_info:
|
mysql_info:
|
||||||
|
|
|
@ -54,12 +54,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_query:
|
mysql_query:
|
||||||
|
|
|
@ -55,12 +55,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_replication:
|
mysql_replication:
|
||||||
|
|
|
@ -218,10 +218,13 @@
|
||||||
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: (pymysql_version.stdout | default('1000', true)) is version('0.9.3', '<=')
|
when:
|
||||||
|
- connector_name is search('pymysql')
|
||||||
|
- connector_ver is version('0.9.3', '<=')
|
||||||
|
|
||||||
# Test stopreplica mode:
|
# Test stopreplica mode:
|
||||||
- name: Stop replica
|
- name: Stop replica
|
||||||
|
@ -247,8 +250,7 @@
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result is not changed
|
- result is not changed
|
||||||
when: (pymysql_version.stdout | default('1000', true)) is version('0.9.3', '<=')
|
|
||||||
|
|
||||||
# master / slave related choices were removed in 3.0.0
|
# master / slave related choices were removed in 3.0.0
|
||||||
# https://github.com/ansible-collections/community.mysql/pull/252
|
# https://github.com/ansible-collections/community.mysql/pull/252
|
||||||
|
|
|
@ -53,12 +53,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_user:
|
mysql_user:
|
||||||
|
|
|
@ -361,7 +361,13 @@
|
||||||
register: pymysql_version
|
register: pymysql_version
|
||||||
|
|
||||||
- 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: pymysql_version.stdout == "" or (pymysql_version.stdout != "" and pymysql_version.stdout is version('0.9', '>='))
|
when:
|
||||||
|
- >
|
||||||
|
connector_name is not search('pymysql')
|
||||||
|
or (
|
||||||
|
connector_name is search('pymysql')
|
||||||
|
and connector_ver is version('0.9', '>=')
|
||||||
|
)
|
||||||
block:
|
block:
|
||||||
|
|
||||||
- name: Create user with plugin auth (empty auth string)
|
- name: Create user with plugin auth (empty auth string)
|
||||||
|
|
|
@ -22,4 +22,4 @@
|
||||||
- name: assert message failure (expect failed=true)
|
- name: assert message failure (expect failed=true)
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "output.failed == true"
|
- "output.failed | bool == true"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
- name: assert output message changed value
|
- name: assert output message changed value
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "output.changed == {{ changed }}"
|
- "output.changed | bool == changed | bool"
|
||||||
|
|
||||||
- name: run mysql command to show variable
|
- name: run mysql command to show variable
|
||||||
command: "{{ mysql_command }} \"-e show variables like '{{ var_name }}'\""
|
command: "{{ mysql_command }} \"-e show variables like '{{ var_name }}'\""
|
||||||
|
@ -31,6 +31,6 @@
|
||||||
- name: assert output mysql variable name and value
|
- name: assert output mysql variable name and value
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "result.changed == true"
|
- "result.changed | bool == true"
|
||||||
- "'{{ var_name }}' in result.stdout"
|
- "'{{ var_name }}' in result.stdout"
|
||||||
- "'{{ var_value }}' in result.stdout"
|
- "'{{ var_value }}' in result.stdout"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
- name: assert output message changed value
|
- name: assert output message changed value
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "output.changed == {{ changed }}"
|
- "output.changed | bool == changed | bool"
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
key_name: "{{ var_name }}"
|
key_name: "{{ var_name }}"
|
||||||
|
@ -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"
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
mysql_variables:
|
mysql_variables:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
variable: max_connect_errors
|
variable: max_connect_errors
|
||||||
value: -1
|
value: '-1'
|
||||||
register: oor_result
|
register: oor_result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue