From db72c7948b66a72d570d79b72e484b9ab64613d5 Mon Sep 17 00:00:00 2001 From: Laurent Indermuehle Date: Tue, 17 Jan 2023 18:11:19 +0100 Subject: [PATCH] Fix assertion for older mysqlclient than 2.0.1 with mysql (mariadb ok) --- .../tasks/mysql_query_initial.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/integration/targets/test_mysql_query/tasks/mysql_query_initial.yml b/tests/integration/targets/test_mysql_query/tasks/mysql_query_initial.yml index c58e94a..fa42117 100644 --- a/tests/integration/targets/test_mysql_query/tasks/mysql_query_initial.yml +++ b/tests/integration/targets/test_mysql_query/tasks/mysql_query_initial.yml @@ -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: