Skip to content

Commit

Permalink
Integration tests for ansible/ansible-modules-core#416
Browse files Browse the repository at this point in the history
  • Loading branch information
abadger committed Dec 1, 2014
1 parent e61e8a3 commit 86b21a1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions test/integration/roles/test_mysql_user/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 86b21a1

Please sign in to comment.