cloudstack: add check mode tests (#24908)

* cloudstack: test: cs_network_acl: add check_mode tests

* cloudstack: test: cs_pod: add check_mode tests

* cloudstack: test: cs_user: add check_mode tests

* cloudstack: test: cs_sshkeypair: add check_mode tests

* cloudstack: test: cs_project: add check_mode tests

* cloudstack: test: cs_vpc: add check_mode tests

* cloudstack: test: cs_vpn_gateway: add check_mode tests

* cloudstack: test: cs_volume: add check_mode tests

* cloudstack: test: cs_vmsnapshot: add check_mode tests

* cloudstack: test: cs_account: add check_mode tests

* cloudstack: test: cs_affinitygroup: add check_mode tests

* cloudstack: test: cs_cluster: add check_mode tests

* cloudstack: test: cs_domain: add check_mode tests

* cloudstack: test: cs_instancegroup: add check_mode tests

* cloudstack: test: cs_iso: add check_mode tests

* cloudstack: test: cs_loadbalancer_rule: add check_mode tests

* cloudstack: test: cs_portforward: add check_mode tests

* cloudstack: test: cs_resourcelimit: add check_mode tests

* cloudstack: test: cs_securitygroup: add check_mode tests

* cloudstack: test: cs_securitygroup_rule: add check_mode tests

* cloudstack: test: cs_configuration: add check_mode tests

* cloudstack: test: cs_firewall: add check_mode tests

* cloudstack: test: cs_instance: add check_mode tests

* cloudstack: query current tags from API

Fixes unexpected tags returned in check mode.
This commit is contained in:
René Moser 2017-05-26 12:19:47 +02:00 committed by GitHub
commit d5b04aa1f1
32 changed files with 1838 additions and 33 deletions

View file

@ -39,6 +39,18 @@
- vol|failed
- "vol.msg == 'missing required arguments: name'"
- name: test create volume in check mode
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
disk_offering: "{{ test_cs_disk_offering_1 }}"
size: 20
register: vol
check_mode: true
- name: verify results test create volume in check mode
assert:
that:
- vol|changed
- name: test create volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
@ -65,6 +77,21 @@
- vol.size == 20 * 1024 ** 3
- vol.name == "{{ cs_resource_prefix }}_vol"
- name: test shrink volume in check mode
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
disk_offering: "{{ test_cs_disk_offering_1 }}"
size: 10
shrink_ok: yes
register: vol
check_mode: true
- name: verify results test create volume in check mode
assert:
that:
- vol|changed
- vol.size == 20 * 1024 ** 3
- vol.name == "{{ cs_resource_prefix }}_vol"
- name: test shrink volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
@ -93,6 +120,20 @@
- vol.size == 10 * 1024 ** 3
- vol.name == "{{ cs_resource_prefix }}_vol"
- name: test attach volume in check mode
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
vm: "{{ test_cs_instance_1 }}"
state: attached
register: vol
check_mode: true
- name: verify results test attach volume in check mode
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.attached is not defined
- name: test attach volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
@ -121,6 +162,21 @@
- vol.vm == "{{ test_cs_instance_1 }}"
- vol.attached is defined
- name: test attach attached volume to another vm in check mdoe
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
vm: "{{ test_cs_instance_2 }}"
state: attached
register: vol
check_mode: true
- name: verify results test attach attached volume to another vm in check mode
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.vm == "{{ test_cs_instance_1 }}"
- vol.attached is defined
- name: test attach attached volume to another vm
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
@ -149,6 +205,19 @@
- vol.vm == "{{ test_cs_instance_2 }}"
- vol.attached is defined
- name: test detach volume in check mode
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
state: detached
register: vol
check_mode: true
- name: verify results test detach volume in check mdoe
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.attached is defined
- name: test detach volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
@ -173,6 +242,18 @@
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.attached is undefined
- name: test delete volume in check mode
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
state: absent
register: vol
check_mode: true
- name: verify results test create volume in check mode
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- name: test delete volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"