mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudstack: add tests for cs_loadbalancer_rule and _member
This commit is contained in:
parent
450c8d45c6
commit
bb5dcc00b6
4 changed files with 220 additions and 0 deletions
|
@ -21,3 +21,4 @@
|
|||
- { role: test_cs_portforward, tags: test_cs_portforward }
|
||||
- { role: test_cs_account, tags: test_cs_account }
|
||||
- { role: test_cs_firewall, tags: test_cs_firewall }
|
||||
- { role: test_cs_loadbalancer_rule, tags: test_cs_loadbalancer_rule }
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
test_cs_lb_public_ip: "1.2.3.4"
|
||||
test_cs_instance_template: CentOS 5.3(64-bit) no GUI (Simulator)
|
||||
test_cs_instance_offering_1: Small Instance
|
||||
test_cs_lb_member: "{{ cs_resource_prefix }}_member1"
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- test_cs_common
|
211
test/integration/roles/test_cs_loadbalancer_rule/tasks/main.yml
Normal file
211
test/integration/roles/test_cs_loadbalancer_rule/tasks/main.yml
Normal file
|
@ -0,0 +1,211 @@
|
|||
---
|
||||
- name: setup
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify setup
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
|
||||
- name: setup instance
|
||||
cs_instance:
|
||||
name: "{{ test_cs_lb_member }}"
|
||||
template: "{{ test_cs_instance_template }}"
|
||||
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||
register: instance
|
||||
- name: verify create instance
|
||||
assert:
|
||||
that:
|
||||
- instance|success
|
||||
|
||||
- name: test rule requires params
|
||||
cs_loadbalancer_rule:
|
||||
ignore_errors: true
|
||||
register: lb
|
||||
- name: verify test rule requires params
|
||||
assert:
|
||||
that:
|
||||
- lb|failed
|
||||
- "'ip_address,name' in lb.msg"
|
||||
|
||||
- name: test create rule
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
algorithm: roundrobin
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
register: lb
|
||||
- name: verify test create rule
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "roundrobin"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test create rule idempotence
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
algorithm: roundrobin
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
register: lb
|
||||
- name: verify test create rule idempotence
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- not lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "roundrobin"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test update rule
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
algorithm: source
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
register: lb
|
||||
- name: verify test update rule
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "source"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test update rule idempotence
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
algorithm: source
|
||||
public_port: 80
|
||||
private_port: 8080
|
||||
register: lb
|
||||
- name: verify test update rule idempotence
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- not lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "source"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test rule member requires params
|
||||
cs_loadbalancer_rule_member:
|
||||
ignore_errors: true
|
||||
register: lb
|
||||
- name: verify test rule requires params
|
||||
assert:
|
||||
that:
|
||||
- lb|failed
|
||||
- "'vms,name' in lb.msg"
|
||||
|
||||
- name: test add members to rule
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ test_cs_lb_member }}"
|
||||
register: lb
|
||||
- name: verify add members to rule
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "source"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
- "'{{ test_cs_lb_member }}' in lb.vms"
|
||||
|
||||
- name: test add members to rule idempotence
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ test_cs_lb_member }}"
|
||||
register: lb
|
||||
- name: verify add members to rule idempotence
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- not lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "source"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
- "'{{ test_cs_lb_member }}' in lb.vms"
|
||||
|
||||
- name: test remove members to rule
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ test_cs_lb_member }}"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify remove members to rule
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "source"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
- "'{{ test_cs_lb_member }}' not in lb.vms"
|
||||
|
||||
- name: test remove members to rule idempotence
|
||||
cs_loadbalancer_rule_member:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
vm: "{{ test_cs_lb_member }}"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify remove members to rule
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- not lb|changed
|
||||
|
||||
- name: test remove rule
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify remove rule
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- lb|changed
|
||||
- lb.name == "{{ cs_resource_prefix }}_lb"
|
||||
- lb.algorithm == "source"
|
||||
- lb.public_ip == "{{ test_cs_lb_public_ip }}"
|
||||
- lb.public_port == 80
|
||||
- lb.private_port == 8080
|
||||
|
||||
- name: test remove rule idempotence
|
||||
cs_loadbalancer_rule:
|
||||
name: "{{ cs_resource_prefix }}_lb"
|
||||
public_ip: "{{ test_cs_lb_public_ip }}"
|
||||
state: absent
|
||||
register: lb
|
||||
- name: verify remove rule idempotence
|
||||
assert:
|
||||
that:
|
||||
- lb|success
|
||||
- not lb|changed
|
Loading…
Reference in a new issue