Skip to content

Commit

Permalink
Tests for idempotency checking and check mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ar7z1 committed Jan 26, 2018
1 parent a5f9c83 commit 4300297
Showing 1 changed file with 38 additions and 3 deletions.
41 changes: 38 additions & 3 deletions test/integration/targets/influxdb_user/tasks/tests.yml
Expand Up @@ -3,17 +3,40 @@
- name: Install influxdb python module
pip: name=influxdb

- name: Check adding admin user
- name: Test add admin user in check mode
block:
- name: Add admin user
influxdb_user: user_name=admin user_password=admin admin=yes
check_mode: true
register: add_admin_user

- name: Check that admin user adding succeeds with a change
assert:
that:
- add_admin_user.changed == true

- name: Test add admin user
block:
- name: Add admin user
influxdb_user: user_name=admin user_password=admin admin=yes
register: add_admin_user

- name: Check that admin user adding succeeds with a change
assert:
that:
- add_admin_user.changed == true

- name: Test add admin user idempotence
block:
- name: Add admin user
influxdb_user: user_name=admin user_password=admin admin=yes
register: add_admin_user

- name: Check that admin user adding succeeds without a change
assert:
that:
- add_admin_user.changed == false

- name: Enable authentication and restart service
block:
- name: Enable authentication
Expand All @@ -25,7 +48,19 @@
- name: Restart InfluxDB service
service: name=influxdb state=restarted

- name: Check adding user when authentication enabled
- name: Test add user in check mode when authentication enabled
block:
- name: Add user
influxdb_user: user_name=user user_password=user login_username=admin login_password=admin
check_mode: true
register: add_user_with_auth_enabled

- name: Check that adding user with enabled authentication succeeds with a change
assert:
that:
- add_user_with_auth_enabled.changed == true

- name: Test add user when authentication enabled
block:
- name: Add user
influxdb_user: user_name=user user_password=user login_username=admin login_password=admin
Expand All @@ -36,7 +71,7 @@
that:
- add_user_with_auth_enabled.changed == true

- name: Check adding the same user
- name: Test add user when authentication enabled idempotence
block:
- name: Add the same user
influxdb_user: user_name=user user_password=user login_username=admin login_password=admin
Expand Down

0 comments on commit 4300297

Please sign in to comment.