From 66cf9dd3696c7af92a96238c7ce92c008567aac7 Mon Sep 17 00:00:00 2001 From: "R. Sicart" Date: Wed, 1 Dec 2021 17:34:17 +0100 Subject: [PATCH] Make 'when' conditions uniform --- .../tasks/mysql_role_initial.yml | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/tests/integration/targets/test_mysql_role/tasks/mysql_role_initial.yml b/tests/integration/targets/test_mysql_role/tasks/mysql_role_initial.yml index 9e7d7dd..39f36b1 100644 --- a/tests/integration/targets/test_mysql_role/tasks/mysql_role_initial.yml +++ b/tests/integration/targets/test_mysql_role/tasks/mysql_role_initial.yml @@ -1490,34 +1490,26 @@ that: - result is failed - result.msg is search('option can be used only with MariaDB') - when: - # Semantically, when there's MySQL - - srv['version']['major'] < 10 + when: install_type == 'mysql' - name: Check with MariaDB assert: that: - result is changed - when: - # Semantically, when there's MariaDB - - srv['version']['major'] >= 10 + when: install_type == 'mariadb' - name: Check in DB <<: *task_params mysql_query: <<: *mysql_params query: "SELECT 1 FROM mysql.user WHERE User = '{{ role0 }}' AND Host = '%'" - when: - # Semantically, when there's MariaDB - - srv['version']['major'] >= 10 + when: install_type == 'mariadb' - name: Check assert: that: - result.rowcount.0 == 1 - when: - # Semantically, when there's MariaDB - - srv['version']['major'] >= 10 + when: install_type == 'mariadb' - name: Create role with admin again <<: *task_params @@ -1533,17 +1525,13 @@ that: - result is failed - result.msg is search('option can be used only with MariaDB') - when: - # Semantically, when there's MySQL - - srv['version']['major'] < 10 + when: install_type == 'mysql' - name: Check with MariaDB assert: that: - result is not changed - # Semantically, when there's MariaDB - when: - - srv['version']['major'] >= 10 + when: install_type == 'mariadb' # Try to grant a role to a user who does not exist - name: Create role with admin again @@ -1561,9 +1549,7 @@ that: - result is failed - result.msg is search('does not exist') - when: - # Semantically, when there's MySQL - - srv['version']['major'] < 10 + when: install_type == 'mysql' always: # Clean up