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

@ -61,6 +61,21 @@
- pf|failed
- 'pf.msg.startswith("missing required arguments: ")'
- name: test present port forwarding in check mode
cs_portforward:
ip_address: "{{ cs_portforward_public_ip }}"
public_port: 80
vm: "{{ cs_portforward_vm }}"
private_port: 8080
zone: "{{ cs_common_zone_adv }}"
register: pf
check_mode: true
- name: verify results of present port forwarding in check mode
assert:
that:
- pf|success
- pf|changed
- name: test present port forwarding
cs_portforward:
ip_address: "{{ cs_portforward_public_ip }}"
@ -101,6 +116,27 @@
- pf.private_port == 8080
- pf.private_end_port == 8080
- name: test change port forwarding in check mode
cs_portforward:
ip_address: "{{ cs_portforward_public_ip }}"
public_port: 80
vm: "{{ cs_portforward_vm }}"
private_port: 8888
zone: "{{ cs_common_zone_adv }}"
register: pf
check_mode: true
- name: verify results of change port forwarding in check mode
assert:
that:
- pf|success
- pf|changed
- pf.vm_name == "{{ cs_portforward_vm }}"
- pf.ip_address == "{{ cs_portforward_public_ip }}"
- pf.public_port == 80
- pf.public_end_port == 80
- pf.private_port == 8080
- pf.private_end_port == 8080
- name: test change port forwarding
cs_portforward:
ip_address: "{{ cs_portforward_public_ip }}"
@ -121,6 +157,47 @@
- pf.private_port == 8888
- pf.private_end_port == 8888
- name: test change port forwarding idempotence
cs_portforward:
ip_address: "{{ cs_portforward_public_ip }}"
public_port: 80
vm: "{{ cs_portforward_vm }}"
private_port: 8888
zone: "{{ cs_common_zone_adv }}"
register: pf
- name: verify results of change port forwarding idempotence
assert:
that:
- pf|success
- not pf|changed
- pf.vm_name == "{{ cs_portforward_vm }}"
- pf.ip_address == "{{ cs_portforward_public_ip }}"
- pf.public_port == 80
- pf.public_end_port == 80
- pf.private_port == 8888
- pf.private_end_port == 8888
- name: test absent port forwarding in check mode
cs_portforward:
ip_address: "{{ cs_portforward_public_ip }}"
public_port: 80
private_port: 8888
state: absent
zone: "{{ cs_common_zone_adv }}"
register: pf
check_mode: true
- name: verify results of absent port forwarding in check mode
assert:
that:
- pf|success
- pf|changed
- pf.vm_name == "{{ cs_portforward_vm }}"
- pf.ip_address == "{{ cs_portforward_public_ip }}"
- pf.public_port == 80
- pf.public_end_port == 80
- pf.private_port == 8888
- pf.private_end_port == 8888
- name: test absent port forwarding
cs_portforward:
ip_address: "{{ cs_portforward_public_ip }}"