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

@ -99,6 +99,19 @@
- fw|failed
- "fw.msg == 'one of the following is required: ip_address,network'"
- name: test present firewall rule ingress 80 in check mode
cs_firewall:
port: 80
ip_address: "{{ cs_firewall_ip_address }}"
zone: "{{ cs_common_zone_adv }}"
register: fw
check_mode: true
- name: verify results of present firewall rule ingress 80 in check mode
assert:
that:
- fw|success
- fw|changed
- name: test present firewall rule ingress 80
cs_firewall:
port: 80
@ -135,6 +148,22 @@
- fw.end_port == 80
- fw.type == "ingress"
- name: test present firewall rule ingress 5300 in check mode
cs_firewall:
ip_address: "{{ cs_firewall_ip_address }}"
protocol: udp
start_port: 5300
end_port: 5333
cidr: 1.2.3.4/24
zone: "{{ cs_common_zone_adv }}"
register: fw
check_mode: true
- name: verify results of present firewall rule ingress 5300 in check mode
assert:
that:
- fw|success
- fw|changed
- name: test present firewall rule ingress 5300
cs_firewall:
ip_address: "{{ cs_firewall_ip_address }}"
@ -177,6 +206,20 @@
- fw.end_port == 5333
- fw.type == "ingress"
- name: test present firewall rule egress all in check mode
cs_firewall:
network: "{{ cs_firewall_network }}"
protocol: all
type: egress
zone: "{{ cs_common_zone_adv }}"
register: fw
check_mode: true
- name: verify results of present firewall rule egress all in check mode
assert:
that:
- fw|success
- fw|changed
- name: test present firewall rule egress all
cs_firewall:
network: "{{ cs_firewall_network }}"
@ -211,6 +254,26 @@
- fw.protocol == "all"
- fw.type == "egress"
- name: test absent firewall rule ingress 80 in check mode
cs_firewall:
port: 80
ip_address: "{{ cs_firewall_ip_address }}"
zone: "{{ cs_common_zone_adv }}"
state: absent
register: fw
check_mode: true
- name: verify results of absent firewall rule ingress 80 in check mode
assert:
that:
- fw|success
- fw|changed
- fw.cidr == "0.0.0.0/0"
- fw.ip_address == "{{ cs_firewall_ip_address }}"
- fw.protocol == "tcp"
- fw.start_port == 80
- fw.end_port == 80
- fw.type == "ingress"
- name: test absent firewall rule ingress 80
cs_firewall:
port: 80
@ -243,6 +306,29 @@
- fw|success
- not fw|changed
- name: test absent firewall rule ingress 5300 in check mode
cs_firewall:
ip_address: "{{ cs_firewall_ip_address }}"
protocol: udp
start_port: 5300
end_port: 5333
cidr: 1.2.3.4/24
zone: "{{ cs_common_zone_adv }}"
state: absent
register: fw
check_mode: true
- name: verify results of absent firewall rule ingress 5300 in check mode
assert:
that:
- fw|success
- fw|changed
- fw.cidr == "1.2.3.4/24"
- fw.ip_address == "{{ cs_firewall_ip_address }}"
- fw.protocol == "udp"
- fw.start_port == 5300
- fw.end_port == 5333
- fw.type == "ingress"
- name: test absent firewall rule ingress 5300
cs_firewall:
ip_address: "{{ cs_firewall_ip_address }}"
@ -281,6 +367,25 @@
- fw|success
- not fw|changed
- name: test absent firewall rule egress all in check mode
cs_firewall:
network: "{{ cs_firewall_network }}"
protocol: all
type: egress
state: absent
zone: "{{ cs_common_zone_adv }}"
register: fw
check_mode: true
- name: verify results of absent firewall rule egress all in check mode
assert:
that:
- fw|success
- fw|changed
- fw.cidr == "0.0.0.0/0"
- fw.network == "{{ cs_firewall_network }}"
- fw.protocol == "all"
- fw.type == "egress"
- name: test absent firewall rule egress all
cs_firewall:
network: "{{ cs_firewall_network }}"