You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/cs_image_store/tasks/main.yml

166 lines
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"