ansible/test/integration/targets/cs_loadbalancer_rule/tasks/main.yml
Matt Martz 4fe08441be Deprecate tests used as filters (#32361)
* Warn on tests used as filters

* Update docs, add aliases for tests that fit more gramatically with test syntax

* Fix rst formatting

* Add successful filter, alias of success

* Remove renamed_deprecation, it was overkill

* Make directory alias for is_dir

* Update tests to use proper jinja test syntax

* Update additional documentation, living outside of YAML files, to reflect proper jinja test syntax

* Add conversion script, porting guide updates, and changelog updates

* Update newly added uses of tests as filters

* No underscore variable

* Convert recent tests as filter changes to win_stat

* Fix some changes related to rebasing a few integration tests

* Make tests_as_filters_warning explicitly accept the name of the test, instead of inferring the name

* Add test for tests_as_filters_warning

* Update tests as filters in newly added/modified tests

* Address recent changes to several integration tests

* Address recent changes in cs_vpc
2017-11-27 17:58:08 -05:00

330 lines
8.8 KiB
YAML

---
- name: test create network for lb
cs_network:
name: "{{ cs_resource_prefix }}_net_lb"
zone: "{{ cs_common_zone_adv }}"
network_offering: Offering for Isolated networks with Source Nat service enabled
register: lb_net
- name: verify test create network for lb
assert:
that:
- lb_net is successful
- lb_net is changed
- lb_net.name == "{{ cs_resource_prefix }}_net_lb"
- name: setup instance in lb
cs_instance:
name: "{{ cs_resource_prefix }}-vm-lb"
template: "{{ cs_common_template }}"
service_offering: "{{ cs_common_service_offering }}"
zone: "{{ cs_common_zone_adv }}"
network: "{{ cs_resource_prefix }}_net_lb"
register: instance
- name: verify setup instance in lb
assert:
that:
- instance is successful
- instance is changed
- instance.name == "{{ cs_resource_prefix }}-vm-lb"
- instance.state == "Running"
- name: setup get ip address for lb
cs_ip_address:
network: "{{ cs_resource_prefix }}_net_lb"
zone: "{{ cs_common_zone_adv }}"
register: ip_address
- name: verify setup instance in lb
assert:
that:
- ip_address is successful
- name: setup lb rule absent
cs_loadbalancer_rule:
name: "{{ cs_resource_prefix }}_lb"
public_ip: "{{ ip_address.ip_address }}"
state: absent
register: lb
- name: verify setup lb rule absent
assert:
that:
- lb is successful
- name: test rule requires params
cs_loadbalancer_rule:
ignore_errors: true
register: lb
- name: verify test rule requires params
assert:
that:
- lb is failed
- "lb.msg.startswith('missing required arguments: ')"
- name: test create rule in check mode
cs_loadbalancer_rule:
name: "{{ cs_resource_prefix }}_lb"
public_ip: "{{ ip_address.ip_address }}"
algorithm: roundrobin
public_port: 80
private_port: 8080
register: lb
check_mode: true
- name: verify test create rule in check mode
assert:
that:
- lb is successful
- lb is changed
- name: test create rule
cs_loadbalancer_rule:
name: "{{ cs_resource_prefix }}_lb"
public_ip: "{{ ip_address.ip_address }}"
algorithm: roundrobin
public_port: 80
private_port: 8080
register: lb
- name: verify test create rule
assert:
that:
- lb is successful
- lb is changed
- lb.name == "{{ cs_resource_prefix }}_lb"
- lb.algorithm == "roundrobin"
- lb.public_ip == "{{ ip_address.ip_address }}"
- lb.public_port == 80
- lb.private_port == 8080
- name: test create rule idempotence
cs_loadbalancer_rule:
name: "{{ cs_resource_prefix }}_lb"
public_ip: "{{ ip_address.ip_address }}"
algorithm: roundrobin
public_port: 80
private_port: 8080
register: lb
- name: verify test create rule idempotence
assert:
that:
- lb is successful
- lb is not changed
- lb.name == "{{ cs_resource_prefix }}_lb"
- lb.algorithm == "roundrobin"
- lb.public_ip == "{{ ip_address.ip_address }}"
- lb.public_port == 80
- lb.private_port == 8080
- name: test update rule in check mode
cs_loadbalancer_rule:
name: "{{ cs_resource_prefix }}_lb"
public_ip: "{{ ip_address.ip_address }}"
algorithm: source
public_port: 80
private_port: 8080
register: lb
check_mode: true
- name: verify test update rule in check mode
assert:
that:
- lb is successful
- lb is changed
- lb.name == "{{ cs_resource_prefix }}_lb"
- lb.algorithm == "roundrobin"
- lb.public_ip == "{{ ip_address.ip_address }}"
- lb.public_port == 80
- lb.private_port == 8080
- name: test update rule
cs_loadbalancer_rule:
name: "{{ cs_resource_prefix }}_lb"
public_ip: "{{ ip_address.ip_address }}"
algorithm: source
public_port: 80
private_port: 8080
register: lb
- name: verify test update rule
assert:
that:
- lb is successful
- lb is changed
- lb.name == "{{ cs_resource_prefix }}_lb"
- lb.algorithm == "source"
- lb.public_ip == "{{ ip_address.ip_address }}"
- lb.public_port == 80
- lb.private_port == 8080
- name: test update rule idempotence
cs_loadbalancer_rule:
name: "{{ cs_resource_prefix }}_lb"
public_ip: "{{ ip_address.ip_address }}"
algorithm: source
public_port: 80
private_port: 8080
register: lb
- name: verify test update rule idempotence
assert:
that:
- lb is successful
- lb is not changed
- lb.name == "{{ cs_resource_prefix }}_lb"
- lb.algorithm == "source"
- lb.public_ip == "{{ ip_address.ip_address }}"
- 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 is failed
- "lb.msg.startswith('missing required arguments: ')"
- name: test add members to rule in check mode
cs_loadbalancer_rule_member:
name: "{{ cs_resource_prefix }}_lb"
vm: "{{ cs_resource_prefix }}-vm-lb"
register: lb
check_mode: true
- name: verify add members to rule in check mode
assert:
that:
- lb is successful
- lb is changed
- lb.name == "{{ cs_resource_prefix }}_lb"
- lb.algorithm == "source"
- lb.public_ip == "{{ ip_address.ip_address }}"
- lb.public_port == 80
- lb.private_port == 8080
- "'{{ cs_resource_prefix }}-vm-lb' not in lb.vms"
- name: test add members to rule
cs_loadbalancer_rule_member:
name: "{{ cs_resource_prefix }}_lb"
vm: "{{ cs_resource_prefix }}-vm-lb"
register: lb
- name: verify add members to rule
assert:
that:
- lb is successful
- lb is changed
- lb.name == "{{ cs_resource_prefix }}_lb"
- lb.algorithm == "source"
- lb.public_ip == "{{ ip_address.ip_address }}"
- lb.public_port == 80
- lb.private_port == 8080
- "'{{ cs_resource_prefix }}-vm-lb' in lb.vms"
- name: test add members to rule idempotence
cs_loadbalancer_rule_member:
name: "{{ cs_resource_prefix }}_lb"
vm: "{{ cs_resource_prefix }}-vm-lb"
register: lb
- name: verify add members to rule idempotence
assert:
that:
- lb is successful
- lb is not changed
- lb.name == "{{ cs_resource_prefix }}_lb"
- lb.algorithm == "source"
- lb.public_ip == "{{ ip_address.ip_address }}"
- lb.public_port == 80
- lb.private_port == 8080
- "'{{ cs_resource_prefix }}-vm-lb' in lb.vms"
- name: test remove members to rule in check mode
cs_loadbalancer_rule_member:
name: "{{ cs_resource_prefix }}_lb"
vm: "{{ cs_resource_prefix }}-vm-lb"
state: absent
register: lb
check_mode: true
- name: verify remove members to rule in check mode
assert:
that:
- lb is successful
- lb is changed
- lb.name == "{{ cs_resource_prefix }}_lb"
- lb.algorithm == "source"
- lb.public_ip == "{{ ip_address.ip_address }}"
- lb.public_port == 80
- lb.private_port == 8080
- "'{{ cs_resource_prefix }}-vm-lb' in lb.vms"
- name: test remove members to rule
cs_loadbalancer_rule_member:
name: "{{ cs_resource_prefix }}_lb"
vm: "{{ cs_resource_prefix }}-vm-lb"
state: absent
register: lb
- name: verify remove members to rule
assert:
that:
- lb is successful
- lb is changed
- lb.name == "{{ cs_resource_prefix }}_lb"
- lb.algorithm == "source"
- lb.public_ip == "{{ ip_address.ip_address }}"
- lb.public_port == 80
- lb.private_port == 8080
- "'{{ cs_resource_prefix }}-vm-lb' not in lb.vms"
- name: test remove members to rule idempotence
cs_loadbalancer_rule_member:
name: "{{ cs_resource_prefix }}_lb"
vm: "{{ cs_resource_prefix }}-vm-lb"
state: absent
register: lb
- name: verify remove members to rule
assert:
that:
- lb is successful
- lb is not changed
- name: test remove rule in check mode
cs_loadbalancer_rule:
name: "{{ cs_resource_prefix }}_lb"
public_ip: "{{ ip_address.ip_address }}"
state: absent
register: lb
check_mode: true
- name: verify remove rule in check mode
assert:
that:
- lb is successful
- lb is changed
- lb.name == "{{ cs_resource_prefix }}_lb"
- lb.algorithm == "source"
- lb.public_ip == "{{ ip_address.ip_address }}"
- lb.public_port == 80
- lb.private_port == 8080
- name: test remove rule
cs_loadbalancer_rule:
name: "{{ cs_resource_prefix }}_lb"
public_ip: "{{ ip_address.ip_address }}"
state: absent
register: lb
- name: verify remove rule
assert:
that:
- lb is successful
- lb is changed
- lb.name == "{{ cs_resource_prefix }}_lb"
- lb.algorithm == "source"
- lb.public_ip == "{{ ip_address.ip_address }}"
- lb.public_port == 80
- lb.private_port == 8080
- name: test remove rule idempotence
cs_loadbalancer_rule:
name: "{{ cs_resource_prefix }}_lb"
public_ip: "{{ ip_address.ip_address }}"
state: absent
register: lb
- name: verify remove rule idempotence
assert:
that:
- lb is successful
- lb is not changed