Skip to content

Commit

Permalink
test: add update task and extend asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemental committed May 28, 2024
1 parent 79267fa commit 0729b30
Show file tree
Hide file tree
Showing 17 changed files with 595 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

- ansible.builtin.assert:
that:
- result.changed == True
- result.changed
- result.state == "present"
- result.contact_point.uid == "alertmanager"
- result.contact_point.name == "alertmanager"
- result.contact_point.type == "prometheus-alertmanager"

- name: Create alertmanager contact point (idempotency)
register: result
Expand All @@ -27,7 +31,31 @@

- ansible.builtin.assert:
that:
- result.changed == False
- not result.changed
- result.state == "present"
- result.contact_point.uid == "alertmanager"
- result.contact_point.name == "alertmanager"
- result.contact_point.type == "prometheus-alertmanager"

- name: Update alertmanager contact point
register: result
community.grafana.grafana_contact_point:
uid: alertmanager
name: alertmanager
type: alertmanager
alertmanager_url: https://example-update.org

- ansible.builtin.debug:
var: result

- ansible.builtin.assert:
that:
- result.changed
- result.state == "present"
- result.contact_point.uid == "alertmanager"
- result.contact_point.name == "alertmanager"
- result.contact_point.type == "prometheus-alertmanager"
- result.diff is defined

- name: Delete alertmanager contact point
register: result
Expand All @@ -40,7 +68,9 @@

- ansible.builtin.assert:
that:
- result.changed == True
- result.changed
- result.state == "absent"
- result.contact_point.uid == "alertmanager"

- name: Delete alertmanager contact point (idempotency)
register: result
Expand All @@ -53,4 +83,5 @@

- ansible.builtin.assert:
that:
- result.changed == False
- not result.changed
- result.state == "absent"
39 changes: 35 additions & 4 deletions tests/integration/targets/grafana_contact_point/tasks/dingding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

- ansible.builtin.assert:
that:
- result.changed == True
- result.changed
- result.state == "present"
- result.contact_point.uid == "dingding"
- result.contact_point.name == "dingding"
- result.contact_point.type == "dingding"

- name: Create dingding contact point (idempotency)
register: result
Expand All @@ -27,7 +31,31 @@

- ansible.builtin.assert:
that:
- result.changed == False
- not result.changed
- result.state == "present"
- result.contact_point.uid == "dingding"
- result.contact_point.name == "dingding"
- result.contact_point.type == "dingding"

- name: Update dingding contact point
register: result
community.grafana.grafana_contact_point:
uid: dingding
name: dingding
type: dingding
dingding_url: https://example-update.org

- ansible.builtin.debug:
var: result

- ansible.builtin.assert:
that:
- result.changed
- result.state == "present"
- result.contact_point.uid == "dingding"
- result.contact_point.name == "dingding"
- result.contact_point.type == "dingding"
- result.diff is defined

- name: Delete dingding contact point
register: result
Expand All @@ -40,7 +68,9 @@

- ansible.builtin.assert:
that:
- result.changed == True
- result.changed
- result.state == "absent"
- result.contact_point.uid == "dingding"

- name: Delete dingding contact point (idempotency)
register: result
Expand All @@ -53,4 +83,5 @@

- ansible.builtin.assert:
that:
- result.changed == False
- not result.changed
- result.state == "absent"
39 changes: 35 additions & 4 deletions tests/integration/targets/grafana_contact_point/tasks/discord.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

- ansible.builtin.assert:
that:
- result.changed == True
- result.changed
- result.state == "present"
- result.contact_point.uid == "discord"
- result.contact_point.name == "discord"
- result.contact_point.type == "discord"

- name: Create discord contact point (idempotency)
register: result
Expand All @@ -27,7 +31,31 @@

- ansible.builtin.assert:
that:
- result.changed == False
- not result.changed
- result.state == "present"
- result.contact_point.uid == "discord"
- result.contact_point.name == "discord"
- result.contact_point.type == "discord"

- name: Update discord contact point
register: result
community.grafana.grafana_contact_point:
uid: discord
name: discord
type: discord
discord_url: https://example-update.org

- ansible.builtin.debug:
var: result

- ansible.builtin.assert:
that:
- result.changed
- result.state == "present"
- result.contact_point.uid == "discord"
- result.contact_point.name == "discord"
- result.contact_point.type == "discord"
- result.diff is defined

- name: Delete discord contact point
register: result
Expand All @@ -40,7 +68,9 @@

- ansible.builtin.assert:
that:
- result.changed == True
- result.changed
- result.state == "absent"
- result.contact_point.uid == "discord"

- name: Delete discord contact point (idempotency)
register: result
Expand All @@ -53,4 +83,5 @@

- ansible.builtin.assert:
that:
- result.changed == False
- not result.changed
- result.state == "absent"
46 changes: 39 additions & 7 deletions tests/integration/targets/grafana_contact_point/tasks/email.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@

- ansible.builtin.assert:
that:
- result.changed == True
- result.changed
- result.state == "present"
- result.contact_point.uid == "email"
- result.contact_point.name == "email"
- result.contact_point.type == "email"

- name: Create email contact point (idempotency)
register: result
Expand All @@ -31,9 +35,35 @@

- ansible.builtin.assert:
that:
- result.changed == False
- not result.changed
- result.state == "present"
- result.contact_point.uid == "email"
- result.contact_point.name == "email"
- result.contact_point.type == "email"

- name: Delete discord contact point
- name: Update email contact point
register: result
community.grafana.grafana_contact_point:
uid: email
name: email
type: email
email_addresses:
- [email protected]
- [email protected]

- ansible.builtin.debug:
var: result

- ansible.builtin.assert:
that:
- result.changed
- result.state == "present"
- result.contact_point.uid == "email"
- result.contact_point.name == "email"
- result.contact_point.type == "email"
- result.diff is defined

- name: Delete email contact point
register: result
community.grafana.grafana_contact_point:
uid: email
Expand All @@ -44,10 +74,11 @@

- ansible.builtin.assert:
that:
- result.changed == True
- result.state == 'absent'
- result.changed
- result.state == "absent"
- result.contact_point.uid == "email"

- name: Delete discord contact point (idempotency)
- name: Delete email contact point (idempotency)
register: result
community.grafana.grafana_contact_point:
uid: email
Expand All @@ -58,4 +89,5 @@

- ansible.builtin.assert:
that:
- result.changed == False
- not result.changed
- result.state == "absent"
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

- ansible.builtin.assert:
that:
- result.changed == True
- result.changed
- result.state == "present"
- result.contact_point.uid == "googlechat"
- result.contact_point.name == "googlechat"
- result.contact_point.type == "googlechat"

- name: Create googlechat contact point (idempotency)
register: result
Expand All @@ -27,7 +31,31 @@

- ansible.builtin.assert:
that:
- result.changed == False
- not result.changed
- result.state == "present"
- result.contact_point.uid == "googlechat"
- result.contact_point.name == "googlechat"
- result.contact_point.type == "googlechat"

- name: Update googlechat contact point
register: result
community.grafana.grafana_contact_point:
uid: googlechat
name: googlechat
type: googlechat
googlechat_url: https://example-update.org

- ansible.builtin.debug:
var: result

- ansible.builtin.assert:
that:
- result.changed
- result.state == "present"
- result.contact_point.uid == "googlechat"
- result.contact_point.name == "googlechat"
- result.contact_point.type == "googlechat"
- result.diff is defined

- name: Delete googlechat contact point
register: result
Expand All @@ -40,7 +68,9 @@

- ansible.builtin.assert:
that:
- result.changed == True
- result.changed
- result.state == "absent"
- result.contact_point.uid == "googlechat"

- name: Delete googlechat contact point (idempotency)
register: result
Expand All @@ -53,4 +83,5 @@

- ansible.builtin.assert:
that:
- result.changed == False
- not result.changed
- result.state == "absent"
40 changes: 36 additions & 4 deletions tests/integration/targets/grafana_contact_point/tasks/kafka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@

- ansible.builtin.assert:
that:
- result.changed == True
- result.changed
- result.state == "present"
- result.contact_point.uid == "kafka"
- result.contact_point.name == "kafka"
- result.contact_point.type == "kafka"

- name: Create kafka contact point (idempotentcy)
register: result
Expand All @@ -29,7 +33,32 @@

- ansible.builtin.assert:
that:
- result.changed == False
- not result.changed
- result.state == "present"
- result.contact_point.uid == "kafka"
- result.contact_point.name == "kafka"
- result.contact_point.type == "kafka"

- name: Update kafka contact point
register: result
community.grafana.grafana_contact_point:
uid: kafka
name: kafka
type: kafka
kafka_rest_proxy_url: https://example-update.org
kafka_topic: test-update

- ansible.builtin.debug:
var: result

- ansible.builtin.assert:
that:
- result.changed
- result.state == "present"
- result.contact_point.uid == "kafka"
- result.contact_point.name == "kafka"
- result.contact_point.type == "kafka"
- result.diff is defined

- name: Delete kafka contact point
register: result
Expand All @@ -42,7 +71,9 @@

- ansible.builtin.assert:
that:
- result.changed == True
- result.changed
- result.state == "absent"
- result.contact_point.uid == "kafka"

- name: Delete kafka contact point (idempotency)
register: result
Expand All @@ -55,4 +86,5 @@

- ansible.builtin.assert:
that:
- result.changed == False
- not result.changed
- result.state == "absent"
Loading

0 comments on commit 0729b30

Please sign in to comment.