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
parent 2af5556901
commit d5b04aa1f1
32 changed files with 1838 additions and 33 deletions

View File

@@ -1,4 +1,17 @@
---
- name: test destroy instance in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
state: absent
register: instance
check_mode: true
- name: verify destroy instance in check mode
assert:
that:
- instance|success
- instance|changed
- instance.state != "Destroyed"
- name: test destroy instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
@@ -22,6 +35,19 @@
- instance|success
- not instance|changed
- name: test recover to stopped state and update a deleted instance in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
state: stopped
register: instance
check_mode: true
- name: verify test recover to stopped state and update a deleted instance in check mode
assert:
that:
- instance|success
- instance|changed
- name: test recover to stopped state and update a deleted instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
@@ -36,8 +62,54 @@
- instance.state == "Stopped"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
# force expunge, only works with admin permissions
- cs_instance:
- name: test recover to stopped state and update a deleted instance idempotence
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
state: stopped
register: instance
- name: verify test recover to stopped state and update a deleted instance idempotence
assert:
that:
- instance|success
- not instance|changed
- instance.state == "Stopped"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- name: test expunge instance in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
state: expunged
failed_when: false
register: instance
check_mode: true
- name: verify test expunge instance in check mode
assert:
that:
- instance|success
- instance|changed
- instance.state == "Stopped"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- name: test expunge instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
state: expunged
register: instance
- name: verify test expunge instance
assert:
that:
- instance|success
- instance|changed
- instance.state == "Stopped"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- name: test expunge instance idempotence
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
state: expunged
register: instance
- name: verify test expunge instance idempotence
assert:
that:
- instance|success
- not instance|changed