From 86b21a1b8d00d50f2d90416a05329f2e7e403345 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 1 Dec 2014 10:46:22 -0800 Subject: [PATCH] Integration tests for https://github.com/ansible/ansible-modules-core/issues/416 --- lib/ansible/modules/core | 2 +- .../roles/test_mysql_user/tasks/main.yml | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/core b/lib/ansible/modules/core index 2a794fa7769..3a80b734e6e 160000 --- a/lib/ansible/modules/core +++ b/lib/ansible/modules/core @@ -1 +1 @@ -Subproject commit 2a794fa77693a58ed0c2585d3f70f686c38dbe93 +Subproject commit 3a80b734e6e4c1ebe8cbd40b4957a7589520caf5 diff --git a/test/integration/roles/test_mysql_user/tasks/main.yml b/test/integration/roles/test_mysql_user/tasks/main.yml index 7ad42d471b2..cdfb7c4950f 100644 --- a/test/integration/roles/test_mysql_user/tasks/main.yml +++ b/test/integration/roles/test_mysql_user/tasks/main.yml @@ -118,6 +118,34 @@ - include: remove_user.yml user_name={{user_name_2}} user_password={{ user_password_1 }} +- name: give user access to database via wildcard + mysql_user: name={{ user_name_1 }} priv=%db.*:SELECT append_privs=yes password={{ user_password_1 }} + +- name: show grants access for user1 on multiple database + command: mysql "-e SHOW GRANTS FOR '{{ user_name_1 }}'@'localhost';" + register: result + +- name: assert grant access for user1 on multiple database + assert: + that: + - "'%db' in result.stdout" + - "'SELECT' in result.stdout" + +- name: change user access to database via wildcard + mysql_user: name={{ user_name_1 }} priv=%db.*:INSERT append_privs=yes password={{ user_password_1 }} + +- name: show grants access for user1 on multiple database + command: mysql "-e SHOW GRANTS FOR '{{ user_name_1 }}'@'localhost';" + register: result + +- name: assert grant access for user1 on multiple database + assert: + that: + - "'%db' in result.stdout" + - "'INSERT' in result.stdout" + +- include: remove_user.yml user_name={{user_name_1}} user_password={{ user_password_1 }} + # ============================================================ # Update user password for a user. # Assert the user password is updated and old password can no longer be used.