1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/alerta_customer/tasks/main.yml
CWollinger d7e5e85f3e
New module alerta_customer (#4554)
* first draft of alerta_customer

* Update BOTMETA.yml

* update after review

* fix pagination and state description

* remove whitespace
2022-04-26 07:58:32 +02:00

151 lines
3.6 KiB
YAML

####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
- name: Create customer (check mode)
alerta_customer:
alerta_url: "{{ alerta_url }}"
api_username: "{{ alerta_user }}"
api_password: "{{ alerta_password }}"
customer: customer1
match: admin@admin.admin
check_mode: true
register: result
- name: Check result (check mode)
assert:
that:
- result is changed
- name: Create customer
alerta_customer:
alerta_url: "{{ alerta_url }}"
api_username: "{{ alerta_user }}"
api_password: "{{ alerta_password }}"
customer: customer1
match: admin@admin.admin
register: result
- name: Check customer creation
assert:
that:
- result is changed
- name: Test customer creation idempotency
alerta_customer:
alerta_url: "{{ alerta_url }}"
api_username: "{{ alerta_user }}"
api_password: "{{ alerta_password }}"
customer: customer1
match: admin@admin.admin
register: result
- name: Check customer creation idempotency
assert:
that:
- result is not changed
- name: Delete customer (check mode)
alerta_customer:
alerta_url: "{{ alerta_url }}"
api_username: "{{ alerta_user }}"
api_password: "{{ alerta_password }}"
customer: customer1
match: admin@admin.admin
state: absent
check_mode: true
register: result
- name: Check customer deletion (check mode)
assert:
that:
- result is changed
- name: Delete customer
alerta_customer:
alerta_url: "{{ alerta_url }}"
api_username: "{{ alerta_user }}"
api_password: "{{ alerta_password }}"
customer: customer1
match: admin@admin.admin
state: absent
register: result
- name: Check customer deletion
assert:
that:
- result is changed
- name: Test customer deletion idempotency
alerta_customer:
alerta_url: "{{ alerta_url }}"
api_username: "{{ alerta_user }}"
api_password: "{{ alerta_password }}"
customer: customer1
match: admin@admin.admin
state: absent
register: result
- name: Check customer deletion idempotency
assert:
that:
- result is not changed
- name: Delete non-existing customer (check mode)
alerta_customer:
alerta_url: "{{ alerta_url }}"
api_username: "{{ alerta_user }}"
api_password: "{{ alerta_password }}"
customer: customer1
match: admin@admin.admin
state: absent
check_mode: true
register: result
- name: Check non-existing customer deletion (check mode)
assert:
that:
- result is not changed
- name: Create customer with api key
alerta_customer:
alerta_url: "{{ alerta_url }}"
api_key: "{{ alerta_key }}"
customer: customer1
match: admin@admin.admin
register: result
- name: Check customer creation with api key
assert:
that:
- result is changed
- name: Delete customer with api key
alerta_customer:
alerta_url: "{{ alerta_url }}"
api_key: "{{ alerta_key }}"
customer: customer1
match: admin@admin.admin
state: absent
register: result
- name: Check customer deletion with api key
assert:
that:
- result is changed
- name: Use wrong api key
alerta_customer:
alerta_url: "{{ alerta_url }}"
api_key: wrong_key
customer: customer1
match: admin@admin.admin
register: result
ignore_errors: true
- name: Check customer creation with api key
assert:
that:
- result is not changed
- result is failed