summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/grafana/tests/integration/targets/grafana_silence/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/community/grafana/tests/integration/targets/grafana_silence/tasks/main.yml')
-rw-r--r--ansible_collections/community/grafana/tests/integration/targets/grafana_silence/tasks/main.yml89
1 files changed, 89 insertions, 0 deletions
diff --git a/ansible_collections/community/grafana/tests/integration/targets/grafana_silence/tasks/main.yml b/ansible_collections/community/grafana/tests/integration/targets/grafana_silence/tasks/main.yml
new file mode 100644
index 000000000..ad4cfa25d
--- /dev/null
+++ b/ansible_collections/community/grafana/tests/integration/targets/grafana_silence/tasks/main.yml
@@ -0,0 +1,89 @@
+---
+- name: Create new silence
+ community.grafana.grafana_silence:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ comment: "a testcomment"
+ created_by: "me"
+ starts_at: "2029-07-29T08:45:45.000Z"
+ ends_at: "2029-07-29T08:55:45.000Z"
+ matchers:
+ - isEqual: true
+ isRegex: true
+ name: environment
+ value: test
+ state: present
+ register: result
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.failed == false"
+ - "result.silence.id != ''"
+
+- name: Check idempotency on silence creation
+ community.grafana.grafana_silence:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ comment: "a testcomment"
+ created_by: "me"
+ starts_at: "2029-07-29T08:45:45.000Z"
+ ends_at: "2029-07-29T08:55:45.000Z"
+ matchers:
+ - isEqual: true
+ isRegex: true
+ name: environment
+ value: test
+ state: present
+ register: result
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.msg != ''"
+
+- name: Delete the silence
+ community.grafana.grafana_silence:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ comment: "a testcomment"
+ created_by: "me"
+ starts_at: "2029-07-29T08:45:45.000Z"
+ ends_at: "2029-07-29T08:55:45.000Z"
+ matchers:
+ - isEqual: true
+ isRegex: true
+ name: environment
+ value: test
+ state: absent
+ register: result
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.failed == false"
+ - "result.silence.id != ''"
+ - - "result.silence.createdBy != 'me'"
+
+- name: Check idempotency on silence deletion
+ community.grafana.grafana_silence:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ comment: "a testcomment"
+ created_by: "me"
+ starts_at: "2029-07-29T08:45:45.000Z"
+ ends_at: "2029-07-29T08:55:45.000Z"
+ matchers:
+ - isEqual: true
+ isRegex: true
+ name: environment
+ value: test
+ state: absent
+ register: result
+ ignore_errors: yes
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.failed == false"
+ - "result.msg == 'Silence does not exist'" \ No newline at end of file