Fix assertion for older mysqlclient than 2.0.1 with mysql (mariadb ok)

This commit is contained in:
Laurent Indermuehle 2023-01-17 18:11:19 +01:00
parent 0e5f87e969
commit db72c7948b
No known key found for this signature in database
GPG key ID: 93FA944C9F34DD09

View file

@ -368,19 +368,26 @@
- result is not changed
when:
- connector_name == 'pymysql'
or (connector_name == 'mysqlclient' and connector_ver is version('2.0.1', '>'))
or db_engine == 'mariadb'
or (
db_engine == 'mysql'
and connector_name == 'mysqlclient'
and connector_ver is version('2.0.1', '>')
)
# Issue https://github.com/ansible-collections/community.mysql/issues/268
- name: Assert that create table IF NOT EXISTS is changed with mysqlclient <=2.0.1
- name: "Assert that create table IF NOT EXISTS is changed with mysqlclient \
2.0.1 and mysql"
assert:
that:
# Before mysqlclient 2.0.3, driver throws nothing, so it's impossible to
# figure out if the state was changed or not.
# Mysqlclient 2.0.1, driver throws nothing with mysql, so it's
# impossible to figure out if the state was changed or not.
# We assume that it was for DDL queries by default in the code
- result is changed
when:
- connector_name == 'mysqlclient'
- connector_ver is version('2.0.1', '<=')
- connector_ver is version('2.0.1', '==')
- db_engine == 'mysql'
- name: Drop db {{ test_db }}
mysql_query: