From 70683314f1c440948b76268b5032d2968a98037f Mon Sep 17 00:00:00 2001 From: Felix Hamme Date: Tue, 19 Apr 2022 11:42:56 +0200 Subject: [PATCH] fix mysql_role, mysql_user integration tests --- .../targets/test_mysql_role/tasks/test_priv_subtract.yml | 9 ++++++++- .../targets/test_mysql_user/tasks/test_priv_subtract.yml | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/integration/targets/test_mysql_role/tasks/test_priv_subtract.yml b/tests/integration/targets/test_mysql_role/tasks/test_priv_subtract.yml index 43e5b0c..d5fe69c 100644 --- a/tests/integration/targets/test_mysql_role/tasks/test_priv_subtract.yml +++ b/tests/integration/targets/test_mysql_role/tasks/test_priv_subtract.yml @@ -139,10 +139,17 @@ command: "{{ mysql_command }} -e \"SHOW GRANTS FOR '{{ role2 }}'\"" register: result - - name: Assert that the permissions stayed the same + - name: Assert that the permissions stayed the same, with check_mode=='yes' + assert: + that: + - "'GRANT SELECT, INSERT ON `data1`.*' in result.stdout" + when: enable_check_mode == 'yes' + + - name: Assert that the permissions stayed the same, with check_mode=='no' assert: that: - "'GRANT SELECT ON `data1`.*' in result.stdout" + when: enable_check_mode == 'no' ########## # Clean up diff --git a/tests/integration/targets/test_mysql_user/tasks/test_priv_subtract.yml b/tests/integration/targets/test_mysql_user/tasks/test_priv_subtract.yml index 8bedd1f..c8d08c7 100644 --- a/tests/integration/targets/test_mysql_user/tasks/test_priv_subtract.yml +++ b/tests/integration/targets/test_mysql_user/tasks/test_priv_subtract.yml @@ -144,10 +144,17 @@ command: "{{ mysql_command }} -e \"SHOW GRANTS FOR '{{ user_name_4 }}'@'localhost'\"" register: result - - name: Assert that the permissions stayed the same + - name: Assert that the permissions stayed the same, with check_mode=='yes' + assert: + that: + - "'GRANT SELECT, INSERT ON `data1`.*' in result.stdout" + when: enable_check_mode == 'yes' + + - name: Assert that the permissions stayed the same, with check_mode=='no' assert: that: - "'GRANT SELECT ON `data1`.*' in result.stdout" + when: enable_check_mode == 'no' ########## # Clean up