mirror of https://github.com/ansible/ansible.git
Merge pull request #11030 from resmo/feature/cloudstack_tests_cs_portforward
cloudstack: add tests for cs_portforwardpull/11032/head
commit
78985e5c33
@ -0,0 +1,3 @@
|
||||
---
|
||||
cs_portforward_public_ip: "10.100.212.5"
|
||||
cs_portforward_vm: "{{ cs_resource_prefix }}-vm"
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
@ -0,0 +1,111 @@
|
||||
---
|
||||
- name: setup
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
state: absent
|
||||
register: pf
|
||||
- name: verify setup
|
||||
assert:
|
||||
that:
|
||||
- pf|success
|
||||
|
||||
- name: test fail if missing params
|
||||
action: cs_portforward
|
||||
register: pf
|
||||
ignore_errors: true
|
||||
- name: verify results of fail if missing params
|
||||
assert:
|
||||
that:
|
||||
- pf|failed
|
||||
- 'pf.msg == "missing required arguments: private_port,ip_address,public_port"'
|
||||
|
||||
- name: test present port forwarding
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
public_port: 80
|
||||
vm: "{{ cs_portforward_vm }}"
|
||||
private_port: 8080
|
||||
register: pf
|
||||
- name: verify results of present port forwarding
|
||||
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 present port forwarding idempotence
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
public_port: 80
|
||||
vm: "{{ cs_portforward_vm }}"
|
||||
private_port: 8080
|
||||
register: pf
|
||||
- name: verify results of present 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 == 8080
|
||||
- pf.private_end_port == 8080
|
||||
|
||||
- name: test change port forwarding
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
public_port: 80
|
||||
vm: "{{ cs_portforward_vm }}"
|
||||
private_port: 8888
|
||||
register: pf
|
||||
- name: verify results of change port forwarding
|
||||
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 }}"
|
||||
public_port: 80
|
||||
private_port: 8888
|
||||
state: absent
|
||||
register: pf
|
||||
- name: verify results of absent port forwarding
|
||||
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 idempotence
|
||||
cs_portforward:
|
||||
ip_address: "{{ cs_portforward_public_ip }}"
|
||||
public_port: 80
|
||||
private_port: 8888
|
||||
state: absent
|
||||
register: pf
|
||||
- name: verify results of absent port forwarding idempotence
|
||||
assert:
|
||||
that:
|
||||
- pf|success
|
||||
- not pf|changed
|
Loading…
Reference in New Issue