-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
when a runme.sh exists in the test-path, it will be run. then the roles will be run in check-mode and normal-mode to test if they work in check mode (at least somewhat)
- Loading branch information
Showing
21 changed files
with
128 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux | ||
|
||
ansible-playbook site.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: Run tests for grafana_dashboard | ||
hosts: localhost | ||
tasks: | ||
- ansible.builtin.include_role: | ||
name: ../../grafana_dashboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux | ||
|
||
ansible-playbook site.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: Run tests for grafana_datasource | ||
hosts: localhost | ||
tasks: | ||
- ansible.builtin.include_role: | ||
name: ../../grafana_datasource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux | ||
|
||
ansible-playbook site.yml --check | ||
ansible-playbook site.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: Run tests for grafana_folder | ||
hosts: localhost | ||
tasks: | ||
- ansible.builtin.include_role: | ||
name: ../../grafana_folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
tests/integration/targets/grafana_notification_channel/runme.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux | ||
|
||
ansible-playbook site.yml |
6 changes: 6 additions & 0 deletions
6
tests/integration/targets/grafana_notification_channel/site.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: Run tests for grafana_notification_channel | ||
hosts: localhost | ||
tasks: | ||
- ansible.builtin.include_role: | ||
name: ../../grafana_notification_channel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux | ||
|
||
ansible-playbook site.yml --check | ||
ansible-playbook site.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: Run tests for grafana_organization | ||
hosts: localhost | ||
tasks: | ||
- ansible.builtin.include_role: | ||
name: ../../grafana_organization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux | ||
|
||
ansible-playbook site.yml --check | ||
ansible-playbook site.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: Run tests for grafana_organization_user | ||
hosts: localhost | ||
tasks: | ||
- ansible.builtin.include_role: | ||
name: ../../grafana_organization_user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux | ||
|
||
ansible-playbook site.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: Run tests for grafana_team | ||
hosts: localhost | ||
tasks: | ||
- ansible.builtin.include_role: | ||
name: ../../grafana_team |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,10 @@ | |
url: "{{ grafana_url }}" | ||
url_username: "{{ grafana_username }}" | ||
url_password: "{{ grafana_password }}" | ||
name: grafana_working_group | ||
name: grafana working group | ||
email: [email protected] | ||
state: present | ||
skip_version_check: true | ||
register: result | ||
|
||
- ansible.builtin.set_fact: | ||
|
@@ -19,7 +20,7 @@ | |
- ansible.builtin.assert: | ||
that: | ||
- result.changed == true | ||
- result.team.name == 'grafana_working_group' | ||
- result.team.name == 'grafana working group' | ||
- result.team.email == '[email protected]' | ||
- result.team.memberCount == (expected_members|length) | ||
- result.team.members == expected_members | ||
|
@@ -173,7 +174,6 @@ | |
- [email protected] | ||
- [email protected] | ||
state: present | ||
register: result | ||
|
||
- ansible.builtin.set_fact: | ||
expected_members: "{{ auto_member | ternary(['********@localhost', '[email protected]', '[email protected]'], ['[email protected]', '[email protected]']) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux | ||
|
||
ansible-playbook site.yml --check | ||
ansible-playbook site.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: Run tests for grafana_user | ||
hosts: localhost | ||
tasks: | ||
- ansible.builtin.include_role: | ||
name: ../../grafana_user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
- result.user.name == 'Harley Quinn' | ||
- result.user.email == '[email protected]' | ||
- result.user.isGrafanaAdmin == true | ||
when: not ansible_check_mode | ||
|
||
- name: Check idempotency on admin creation | ||
community.grafana.grafana_user: | ||
|
@@ -37,6 +38,7 @@ | |
- result.user.name == 'Harley Quinn' | ||
- result.user.email == '[email protected]' | ||
- result.user.isGrafanaAdmin == true | ||
when: not ansible_check_mode | ||
|
||
- name: Check user creation with Grafana API | ||
ansible.builtin.uri: | ||
|
@@ -54,6 +56,7 @@ | |
- result.json.name == 'Harley Quinn' | ||
- result.json.email == '[email protected]' | ||
- result.json.isGrafanaAdmin == true | ||
when: not ansible_check_mode | ||
|
||
- name: Create a Grafana user without password (expect failure) | ||
community.grafana.grafana_user: | ||
|
@@ -71,6 +74,7 @@ | |
- result.changed == false | ||
- result.failed == true | ||
- "result.msg == 'missing required arguments: password'" | ||
when: not ansible_check_mode | ||
|
||
- name: Create a Grafana user | ||
community.grafana.grafana_user: | ||
|
@@ -89,6 +93,7 @@ | |
- result.user.name == 'Bruce Wayne' | ||
- result.user.email == '[email protected]' | ||
- result.user.isGrafanaAdmin == false | ||
when: not ansible_check_mode | ||
|
||
- name: Check idempotency on user creation (password not requiered) | ||
community.grafana.grafana_user: | ||
|
@@ -106,6 +111,7 @@ | |
- result.user.name == 'Bruce Wayne' | ||
- result.user.email == '[email protected]' | ||
- result.user.isGrafanaAdmin == false | ||
when: not ansible_check_mode | ||
|
||
- name: Check user creation with Grafana API | ||
ansible.builtin.uri: | ||
|
@@ -123,6 +129,7 @@ | |
- result.json.name == 'Bruce Wayne' | ||
- result.json.email == '[email protected]' | ||
- result.json.isGrafanaAdmin == false | ||
when: not ansible_check_mode | ||
|
||
- name: Update Grafana user | ||
community.grafana.grafana_user: | ||
|
@@ -142,6 +149,7 @@ | |
- result.user.name == 'The Dark Knight' | ||
- result.user.email == '[email protected]' | ||
- result.user.isGrafanaAdmin == true | ||
when: not ansible_check_mode | ||
|
||
- name: Check user update with Grafana API | ||
ansible.builtin.uri: | ||
|
@@ -159,6 +167,7 @@ | |
- result.json.name == 'The Dark Knight' | ||
- result.json.email == '[email protected]' | ||
- result.json.isGrafanaAdmin == true | ||
when: not ansible_check_mode | ||
|
||
- name: Delete a Grafana user | ||
community.grafana.grafana_user: | ||
|
@@ -172,6 +181,7 @@ | |
that: | ||
- result.changed == true | ||
- result.message == 'User deleted' | ||
when: not ansible_check_mode | ||
|
||
- name: Check idempotency on user deletion | ||
community.grafana.grafana_user: | ||
|
@@ -185,6 +195,7 @@ | |
that: | ||
- result.changed == false | ||
- result.message == 'No user found, nothing to do' | ||
when: not ansible_check_mode | ||
|
||
- name: Check user deletion with Grafana API (expect 404 Not Found) | ||
ansible.builtin.uri: | ||
|
@@ -200,6 +211,7 @@ | |
- ansible.builtin.assert: | ||
that: | ||
- result.json.message | lower == 'user not found' | ||
when: not ansible_check_mode | ||
|
||
- name: Create a Grafana user with character encoding | ||
community.grafana.grafana_user: | ||
|
@@ -218,6 +230,7 @@ | |
- result.user.name == 'Bruce Wayne' | ||
- result.user.email == '[email protected]' | ||
- result.user.isGrafanaAdmin == false | ||
when: not ansible_check_mode | ||
|
||
- name: Check idempotency on user creation (password not requiered) | ||
community.grafana.grafana_user: | ||
|
@@ -235,3 +248,4 @@ | |
- result.user.name == 'Bruce Wayne' | ||
- result.user.email == '[email protected]' | ||
- result.user.isGrafanaAdmin == false | ||
when: not ansible_check_mode |