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/cs_image_store/tasks/main.yml
Ansible Core Team aebc1b03fd Initial commit
2020-03-09 09:11:07 +00:00

166 lines
No EOL
4.2 KiB
YAML

---
- name: setup image store is absent
cs_image_store:
name: "storage_pool_adv"
zone: "{{ cs_common_zone_adv }}"
state: absent
register: sp
- name: verify setup image store is absent
assert:
that:
- sp is successful
- name: test fail if missing params
cs_image_store:
register: ss
ignore_errors: true
- name: verify test fail if missing params
assert:
that:
- ss is failed
- "'name' in ss.msg"
- "'zone' in ss.msg"
- "'missing required arguments: ' in ss.msg"
- name: setup image store with wrong parameters
cs_image_store:
name: "storage_pool_adv"
zone: "{{ cs_common_zone_adv }}"
state: present
ignore_errors: true
register: ss
- name: verify setup image store with wrong parameters
assert:
that:
- ss is failed
- "ss.msg == 'state is present but all of the following are missing: url, provider'"
- name: setup image store in check mode
cs_image_store:
name: "storage_pool_adv"
zone: "{{ cs_common_zone_adv }}"
url: "nfs://nfs-mount.domain/share/images/"
provider: "NFS"
state: present
check_mode: true
register: ss
- name: verify setup image store in check mode
assert:
that:
- ss is successful
- ss is changed
- name: setup image store
cs_image_store:
name: "storage_pool_adv"
zone: "{{ cs_common_zone_adv }}"
url: "nfs://nfs-mount.domain/share/images/"
provider: "NFS"
state: present
register: ss
- name: verify setup image store
assert:
that:
- ss is successful
- ss is changed
- "ss.url == 'nfs://nfs-mount.domain/share/images/'"
- "ss.provider_name == 'NFS'"
- "ss.zone == cs_common_zone_adv"
- "ss.protocol == 'nfs'"
- name: setup image store idempotence
cs_image_store:
name: "storage_pool_adv"
zone: "{{ cs_common_zone_adv }}"
url: "nfs://nfs-mount.domain/share/images/"
provider: "NFS"
state: present
register: ss
- name: verify setup image store idempotence
assert:
that:
- ss is successful
- ss is not changed
- "ss.url == 'nfs://nfs-mount.domain/share/images/'"
- "ss.provider_name == 'NFS'"
- "ss.zone == cs_common_zone_adv"
- "ss.protocol == 'nfs'"
- "ss.name == 'storage_pool_adv'"
- name: image store not recreated
cs_image_store:
name: "storage_pool_adv"
zone: "{{ cs_common_zone_adv }}"
url: "nfs://nfs-mount.domain/share2/images/"
provider: "NFS"
state: present
register: ss
- name: verify image store not recreated
assert:
that:
- ss is successful
- ss is not changed
- "ss.url == 'nfs://nfs-mount.domain/share/images/'"
- "ss.name == 'storage_pool_adv'"
- "ss.zone == cs_common_zone_adv"
- name: recreate image store
cs_image_store:
name: "storage_pool_adv"
zone: "{{ cs_common_zone_adv }}"
url: "nfs://nfs-mount.domain/share2/images/"
provider: "NFS"
force_recreate: yes
state: present
register: ss
- name: verify setup image store idempotence
assert:
that:
- ss is successful
- ss is changed
- "ss.url == 'nfs://nfs-mount.domain/share2/images/'"
- "ss.name == 'storage_pool_adv'"
- "ss.zone == cs_common_zone_adv"
- name: delete the image store in check_mode
cs_image_store:
name: "storage_pool_adv"
zone: "{{ cs_common_zone_adv }}"
state: absent
register: ss
check_mode: yes
- name: verify results for delete the image store in check_mode
assert:
that:
- ss is successful
- ss is changed
- "ss.name == 'storage_pool_adv'"
- "ss.zone == cs_common_zone_adv"
- name: delete the image store
cs_image_store:
name: "storage_pool_adv"
zone: "{{ cs_common_zone_adv }}"
state: absent
register: ss
- name: verify results for delete the image store
assert:
that:
- ss is successful
- ss is changed
- "ss.name == 'storage_pool_adv'"
- "ss.zone == cs_common_zone_adv"
- name: delete the image store idempotence
cs_image_store:
name: "storage_pool_adv"
zone: "{{ cs_common_zone_adv }}"
state: absent
register: ss
- name: verify delete the image store idempotence
assert:
that:
- ss is successful
- ss is not changed
- ss.name is undefined
- "ss.zone == cs_common_zone_adv"