From 0729b3036ccda8135be38d69db93e19d4f51d64c Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Tue, 28 May 2024 11:56:05 +0200 Subject: [PATCH] test: add update task and extend asserts --- .../tasks/alertmanager.yml | 39 ++++++++++++++-- .../grafana_contact_point/tasks/dingding.yml | 39 ++++++++++++++-- .../grafana_contact_point/tasks/discord.yml | 39 ++++++++++++++-- .../grafana_contact_point/tasks/email.yml | 46 ++++++++++++++++--- .../tasks/googlechat.yml | 39 ++++++++++++++-- .../grafana_contact_point/tasks/kafka.yml | 40 ++++++++++++++-- .../grafana_contact_point/tasks/line.yml | 39 ++++++++++++++-- .../grafana_contact_point/tasks/opsgenie.yml | 41 +++++++++++++++-- .../grafana_contact_point/tasks/pagerduty.yml | 39 ++++++++++++++-- .../grafana_contact_point/tasks/pushover.yml | 40 ++++++++++++++-- .../grafana_contact_point/tasks/sensugo.yml | 40 ++++++++++++++-- .../grafana_contact_point/tasks/slack.yml | 32 +++++++++---- .../grafana_contact_point/tasks/teams.yml | 39 ++++++++++++++-- .../grafana_contact_point/tasks/telegram.yml | 40 ++++++++++++++-- .../grafana_contact_point/tasks/threema.yml | 41 +++++++++++++++-- .../grafana_contact_point/tasks/victorops.yml | 39 ++++++++++++++-- .../grafana_contact_point/tasks/webhook.yml | 39 ++++++++++++++-- 17 files changed, 595 insertions(+), 76 deletions(-) diff --git a/tests/integration/targets/grafana_contact_point/tasks/alertmanager.yml b/tests/integration/targets/grafana_contact_point/tasks/alertmanager.yml index 6ca4b934..9fd23797 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/alertmanager.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/alertmanager.yml @@ -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 @@ -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 @@ -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 @@ -53,4 +83,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/dingding.yml b/tests/integration/targets/grafana_contact_point/tasks/dingding.yml index 5b14a909..b2fee63c 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/dingding.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/dingding.yml @@ -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 @@ -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 @@ -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 @@ -53,4 +83,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/discord.yml b/tests/integration/targets/grafana_contact_point/tasks/discord.yml index 89e62daa..a968d440 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/discord.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/discord.yml @@ -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 @@ -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 @@ -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 @@ -53,4 +83,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/email.yml b/tests/integration/targets/grafana_contact_point/tasks/email.yml index 91aeba8b..1d08ff03 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/email.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/email.yml @@ -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 @@ -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: + - foo@example-update.org + - bar@example-update.org + +- 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 @@ -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 @@ -58,4 +89,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/googlechat.yml b/tests/integration/targets/grafana_contact_point/tasks/googlechat.yml index 1243ca04..fdc13b96 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/googlechat.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/googlechat.yml @@ -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 @@ -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 @@ -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 @@ -53,4 +83,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/kafka.yml b/tests/integration/targets/grafana_contact_point/tasks/kafka.yml index 2503bbdd..3914b6a8 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/kafka.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/kafka.yml @@ -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 @@ -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 @@ -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 @@ -55,4 +86,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/line.yml b/tests/integration/targets/grafana_contact_point/tasks/line.yml index f1f88de9..33c749e8 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/line.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/line.yml @@ -12,7 +12,11 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "present" + - result.contact_point.uid == "line" + - result.contact_point.name == "line" + - result.contact_point.type == "line" - name: Create line contact point (idempotency) register: result @@ -27,7 +31,31 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "present" + - result.contact_point.uid == "line" + - result.contact_point.name == "line" + - result.contact_point.type == "line" + +- name: Update line contact point + register: result + community.grafana.grafana_contact_point: + uid: line + name: line + type: line + line_token: xxx-update + +- ansible.builtin.debug: + var: result + +- ansible.builtin.assert: + that: + - result.changed + - result.state == "present" + - result.contact_point.uid == "line" + - result.contact_point.name == "line" + - result.contact_point.type == "line" + - result.diff is defined - name: Delete line contact point register: result @@ -40,7 +68,9 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "absent" + - result.contact_point.uid == "line" - name: Delete line contact point (idempotency) register: result @@ -53,4 +83,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/opsgenie.yml b/tests/integration/targets/grafana_contact_point/tasks/opsgenie.yml index 6e810e2a..fef2813e 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/opsgenie.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/opsgenie.yml @@ -13,7 +13,11 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "present" + - result.contact_point.uid == "opsgenie" + - result.contact_point.name == "opsgenie" + - result.contact_point.type == "opsgenie" - name: Create opsgenie contact point (idempotency) register: result @@ -29,7 +33,32 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "present" + - result.contact_point.uid == "opsgenie" + - result.contact_point.name == "opsgenie" + - result.contact_point.type == "opsgenie" + +- name: Update opsgenie contact point + register: result + community.grafana.grafana_contact_point: + uid: opsgenie + name: opsgenie + type: opsgenie + opsgenie_url: https://example-update.org + opsgenie_api_key: xxx-update + +- ansible.builtin.debug: + var: result + +- ansible.builtin.assert: + that: + - result.changed + - result.state == "present" + - result.contact_point.uid == "opsgenie" + - result.contact_point.name == "opsgenie" + - result.contact_point.type == "opsgenie" + - result.diff is defined - name: Delete opsgenie contact point register: result @@ -42,8 +71,9 @@ - ansible.builtin.assert: that: - - result.changed == True - - result.state == 'absent' + - result.changed + - result.state == "absent" + - result.contact_point.uid == "opsgenie" - name: Delete opsgenie contact point (idempotency) register: result @@ -56,4 +86,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/pagerduty.yml b/tests/integration/targets/grafana_contact_point/tasks/pagerduty.yml index 3c5e65a9..86c24a6f 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/pagerduty.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/pagerduty.yml @@ -12,7 +12,11 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "present" + - result.contact_point.uid == "pagerduty" + - result.contact_point.name == "pagerduty" + - result.contact_point.type == "pagerduty" - name: Create pagerduty contact point (idempotency) register: result @@ -27,7 +31,31 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "present" + - result.contact_point.uid == "pagerduty" + - result.contact_point.name == "pagerduty" + - result.contact_point.type == "pagerduty" + +- name: Update pagerduty contact point + register: result + community.grafana.grafana_contact_point: + uid: pagerduty + name: pagerduty + type: pagerduty + pagerduty_integration_key: xxx-update + +- ansible.builtin.debug: + var: result + +- ansible.builtin.assert: + that: + - result.changed + - result.state == "present" + - result.contact_point.uid == "pagerduty" + - result.contact_point.name == "pagerduty" + - result.contact_point.type == "pagerduty" + - result.diff is defined - name: Delete pagerduty contact point register: result @@ -40,7 +68,9 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "absent" + - result.contact_point.uid == "pagerduty" - name: Delete pagerduty contact point (idempotency) register: result @@ -53,4 +83,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/pushover.yml b/tests/integration/targets/grafana_contact_point/tasks/pushover.yml index 27ed69be..5a264838 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/pushover.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/pushover.yml @@ -13,7 +13,11 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "present" + - result.contact_point.uid == "pushover" + - result.contact_point.name == "pushover" + - result.contact_point.type == "pushover" - name: Create pushover contact point (idempotency) register: result @@ -29,7 +33,32 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "present" + - result.contact_point.uid == "pushover" + - result.contact_point.name == "pushover" + - result.contact_point.type == "pushover" + +- name: Update pushover contact point + register: result + community.grafana.grafana_contact_point: + uid: pushover + name: pushover + type: pushover + pushover_api_token: xxx-update + pushover_user_key: yyy-update + +- ansible.builtin.debug: + var: result + +- ansible.builtin.assert: + that: + - result.changed + - result.state == "present" + - result.contact_point.uid == "pushover" + - result.contact_point.name == "pushover" + - result.contact_point.type == "pushover" + - result.diff is defined - name: Delete pushover contact point register: result @@ -42,7 +71,9 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "absent" + - result.contact_point.uid == "pushover" - name: Delete pushover contact point (idempotency) register: result @@ -55,4 +86,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/sensugo.yml b/tests/integration/targets/grafana_contact_point/tasks/sensugo.yml index 6cdf0478..16ffab43 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/sensugo.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/sensugo.yml @@ -13,7 +13,11 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "present" + - result.contact_point.uid == "sensugo" + - result.contact_point.name == "sensugo" + - result.contact_point.type == "sensugo" - name: Create sensugo contact point register: result @@ -29,7 +33,32 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "present" + - result.contact_point.uid == "sensugo" + - result.contact_point.name == "sensugo" + - result.contact_point.type == "sensugo" + +- name: Update sensugo contact point + register: result + community.grafana.grafana_contact_point: + uid: sensugo + name: sensugo + type: sensugo + sensugo_url: https://example-update.org + sensugo_api_key: testapikey-update + +- ansible.builtin.debug: + var: result + +- ansible.builtin.assert: + that: + - result.changed + - result.state == "present" + - result.contact_point.uid == "sensugo" + - result.contact_point.name == "sensugo" + - result.contact_point.type == "sensugo" + - result.diff is defined - name: Delete sensugo contact point register: result @@ -42,7 +71,9 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "absent" + - result.contact_point.uid == "sensugo" - name: Delete sensugo contact point (idempotency) register: result @@ -55,4 +86,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/slack.yml b/tests/integration/targets/grafana_contact_point/tasks/slack.yml index 110ec963..b803c041 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/slack.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/slack.yml @@ -14,7 +14,11 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "present" + - result.contact_point.uid == "slack" + - result.contact_point.name == "slack" + - result.contact_point.type == "slack" - name: Check slack contact point (idempotency) register: result @@ -31,7 +35,11 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "present" + - result.contact_point.uid == "slack" + - result.contact_point.name == "slack" + - result.contact_point.type == "slack" - name: Update slack contact point register: result @@ -39,16 +47,21 @@ uid: slack name: slack type: slack - slack_url: https://hooks.slack.com/services/xxx/yyy/fff - slack_token: testapitoken - slack_recipient: foo + slack_url: https://hooks.slack.com/services/xxx/yyy/update + slack_token: testapitoken-update + slack_recipient: foo-update - ansible.builtin.debug: var: result - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "present" + - result.contact_point.uid == "slack" + - result.contact_point.name == "slack" + - result.contact_point.type == "slack" + - result.diff is defined - name: Delete slack contact point register: result @@ -61,7 +74,9 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "absent" + - result.contact_point.uid == "slack" - name: Delete slack contact point (idempotency) register: result @@ -74,4 +89,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/teams.yml b/tests/integration/targets/grafana_contact_point/tasks/teams.yml index 019b407e..eb0d1e5d 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/teams.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/teams.yml @@ -12,7 +12,11 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "present" + - result.contact_point.uid == "teams" + - result.contact_point.name == "teams" + - result.contact_point.type == "teams" - name: Create teams contact point (idempotency) register: result @@ -27,7 +31,31 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "present" + - result.contact_point.uid == "teams" + - result.contact_point.name == "teams" + - result.contact_point.type == "teams" + +- name: Update teams contact point + register: result + community.grafana.grafana_contact_point: + uid: teams + name: teams + type: teams + teams_url: https://example-update.org + +- ansible.builtin.debug: + var: result + +- ansible.builtin.assert: + that: + - result.changed + - result.state == "present" + - result.contact_point.uid == "teams" + - result.contact_point.name == "teams" + - result.contact_point.type == "teams" + - result.diff is defined - name: Delete teams contact point register: result @@ -40,7 +68,9 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "absent" + - result.contact_point.uid == "teams" - name: Delete teams contact point (idempotency) register: result @@ -53,4 +83,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/telegram.yml b/tests/integration/targets/grafana_contact_point/tasks/telegram.yml index 2fd38a5a..1ff7191b 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/telegram.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/telegram.yml @@ -13,7 +13,11 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "present" + - result.contact_point.uid == "telegram" + - result.contact_point.name == "telegram" + - result.contact_point.type == "telegram" - name: Create telegram contact point register: result @@ -29,7 +33,32 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "present" + - result.contact_point.uid == "telegram" + - result.contact_point.name == "telegram" + - result.contact_point.type == "telegram" + +- name: Update telegram contact point + register: result + community.grafana.grafana_contact_point: + uid: telegram + name: telegram + type: telegram + telegram_token: xxx-update + telegram_chat_id: yyy-update + +- ansible.builtin.debug: + var: result + +- ansible.builtin.assert: + that: + - result.changed + - result.state == "present" + - result.contact_point.uid == "telegram" + - result.contact_point.name == "telegram" + - result.contact_point.type == "telegram" + - result.diff is defined - name: Delete telegram contact point register: result @@ -42,7 +71,9 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "absent" + - result.contact_point.uid == "telegram" - name: Delete telegram contact point (idempotency) register: result @@ -55,4 +86,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/threema.yml b/tests/integration/targets/grafana_contact_point/tasks/threema.yml index 6e17aa51..ac406a4e 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/threema.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/threema.yml @@ -14,7 +14,11 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "present" + - result.contact_point.uid == "threema" + - result.contact_point.name == "threema" + - result.contact_point.type == "threema" - name: Create threema contact point (idempotency) register: result @@ -31,7 +35,33 @@ - ansible.builtin.assert: that: - - result.changed == True + - not result.changed + - result.state == "present" + - result.contact_point.uid == "threema" + - result.contact_point.name == "threema" + - result.contact_point.type == "threema" + +- name: Update threema contact point + register: result + community.grafana.grafana_contact_point: + uid: threema + name: threema + type: threema + threema_gateway_id: "*xxxxxxx-update" + threema_recipient_id: yyyyyyyy-update + threema_api_secret: zzz-update + +- ansible.builtin.debug: + var: result + +- ansible.builtin.assert: + that: + - result.changed + - result.state == "present" + - result.contact_point.uid == "threema" + - result.contact_point.name == "threema" + - result.contact_point.type == "threema" + - result.diff is defined - name: Delete threema contact point register: result @@ -44,7 +74,9 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "absent" + - result.contact_point.uid == "threema" - name: Delete threema contact point (idempotency) register: result @@ -57,4 +89,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/victorops.yml b/tests/integration/targets/grafana_contact_point/tasks/victorops.yml index 8ab40387..1ee8c1fa 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/victorops.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/victorops.yml @@ -12,7 +12,11 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "present" + - result.contact_point.uid == "victorops" + - result.contact_point.name == "victorops" + - result.contact_point.type == "victorops" - name: Create victorops contact point (idempotency) register: result @@ -27,7 +31,31 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "present" + - result.contact_point.uid == "victorops" + - result.contact_point.name == "victorops" + - result.contact_point.type == "victorops" + +- name: Update victorops contact point + register: result + community.grafana.grafana_contact_point: + uid: victorops + name: victorops + type: victorops + victorops_url: https://example-update.org + +- ansible.builtin.debug: + var: result + +- ansible.builtin.assert: + that: + - result.changed + - result.state == "present" + - result.contact_point.uid == "victorops" + - result.contact_point.name == "victorops" + - result.contact_point.type == "victorops" + - result.diff is defined - name: Delete victorops contact point register: result @@ -40,7 +68,9 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "absent" + - result.contact_point.uid == "victorops" - name: Delete victorops contact point (idempotency) register: result @@ -53,4 +83,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent" diff --git a/tests/integration/targets/grafana_contact_point/tasks/webhook.yml b/tests/integration/targets/grafana_contact_point/tasks/webhook.yml index 8ff8ba4c..29dbc246 100644 --- a/tests/integration/targets/grafana_contact_point/tasks/webhook.yml +++ b/tests/integration/targets/grafana_contact_point/tasks/webhook.yml @@ -12,7 +12,11 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "present" + - result.contact_point.uid == "webhook" + - result.contact_point.name == "webhook" + - result.contact_point.type == "webhook" - name: Create webhook contact point (idempotency) register: result @@ -27,7 +31,31 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "present" + - result.contact_point.uid == "webhook" + - result.contact_point.name == "webhook" + - result.contact_point.type == "webhook" + +- name: Update webhook contact point + register: result + community.grafana.grafana_contact_point: + uid: webhook + name: webhook + type: webhook + webhook_url: https://example-update.org + +- ansible.builtin.debug: + var: result + +- ansible.builtin.assert: + that: + - result.changed + - result.state == "present" + - result.contact_point.uid == "webhook" + - result.contact_point.name == "webhook" + - result.contact_point.type == "webhook" + - result.diff is defined - name: Delete webhook contact point register: result @@ -40,7 +68,9 @@ - ansible.builtin.assert: that: - - result.changed == True + - result.changed + - result.state == "absent" + - result.contact_point.uid == "webhook" - name: Delete webhook contact point (idempotency) register: result @@ -53,4 +83,5 @@ - ansible.builtin.assert: that: - - result.changed == False + - not result.changed + - result.state == "absent"