1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/legacy/roles/test_rax_clb_nodes/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

237 lines
7.2 KiB
YAML

# ============================================================
- name: Test rax_clb_nodes with no args
rax_clb_nodes:
ignore_errors: true
register: rax_clb_nodes
- name: Validate results of rax_clb_nodes with no args
assert:
that:
- rax_clb_nodes is failed
- 'rax_clb_nodes.msg == "missing required arguments: load_balancer_id"'
# ============================================================
# ============================================================
- name: Test rax_clb_nodes with load_balancer_Id
rax_clb_nodes:
load_balancer_id: 1234
ignore_errors: true
register: rax_clb_nodes
- name: Validate results of rax_clb_nodes with load_balancer_id
assert:
that:
- rax_clb_nodes is failed
- rax_clb_nodes.msg == 'No credentials supplied!'
# ============================================================
# ============================================================
- name: Test rax_clb_nodes with credentials and load_balancer_id
rax_clb_nodes:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
load_balancer_id: 1234
ignore_errors: true
register: rax_clb_nodes
- name: Validate results of rax_clb_nodes with credentials and load_balancer_id
assert:
that:
- rax_clb_nodes is failed
- rax_clb_nodes.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
- name: Test rax_clb_nodes with creds, region and load_balancer_id
rax_clb_nodes:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
load_balancer_id: 1234
ignore_errors: true
register: rax_clb_nodes
- name: Validate rax_clb_nodes creds, region and load_balancer_id
assert:
that:
- rax_clb_nodes is failed
- rax_clb_nodes.msg == 'Load balancer not found'
# ============================================================
# ============================================================
- name: Build a CLB to test rax_clb_nodes with
rax_clb:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
name: "{{ resource_prefix }}-clb"
wait: true
wait_timeout: "{{ rackspace_wait_timeout }}"
register: rax_clb
- name: Validate rax_clb creation
assert:
that:
- rax_clb is successful
- name: Set variable for CLB ID
set_fact:
rax_clb_id: "{{ rax_clb.balancer.id }}"
# ============================================================
# ============================================================
- name: Test rax_clb_nodes with creds, region and valid load_balancer_id
rax_clb_nodes:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
load_balancer_id: "{{ rax_clb_id }}"
ignore_errors: true
register: rax_clb_nodes
- name: Validate rax_clb_nodes creds, region and valid load_balancer_id
assert:
that:
- rax_clb_nodes is failed
- rax_clb_nodes.msg == 'You must include an address and a port when creating a node.'
# ============================================================
# ============================================================
- name: Test rax_clb_nodes with creds, region, load_balancer_id and address
rax_clb_nodes:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
load_balancer_id: "{{ rax_clb_id }}"
address: '10.10.10.10'
ignore_errors: true
register: rax_clb_nodes
- name: Validate rax_clb_nodes creds, region, load_balancer_id and address
assert:
that:
- rax_clb_nodes is failed
- rax_clb_nodes.msg == 'You must include an address and a port when creating a node.'
# ============================================================
# ============================================================
- name: Test rax_clb_nodes with creds, region, load_balancer_id, invalid address and port
rax_clb_nodes:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
load_balancer_id: "{{ rax_clb_id }}"
address: '10.10.10.10'
port: 80
ignore_errors: true
register: rax_clb_nodes
- name: Validate rax_clb_nodes creds, region, load_balancer_id, invalid address and port
assert:
that:
- rax_clb_nodes is failed
- rax_clb_nodes.msg == "Invalid node address. The address '10.10.10.10' is currently not accepted for this request."
# ============================================================
# ============================================================
- name: Test rax_clb_nodes with creds, region, load_balancer_id, address and port
rax_clb_nodes:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
load_balancer_id: "{{ rax_clb_id }}"
address: '172.16.0.1'
port: 80
wait: true
wait_timeout: "{{ rackspace_wait_timeout }}"
register: rax_clb_nodes
- name: Validate rax_clb_nodes creds, region, load_balancer_id, address and port
assert:
that:
- rax_clb_nodes is successful
- rax_clb_nodes.node.address == '172.16.0.1'
- rax_clb_nodes.node.condition == 'ENABLED'
- rax_clb_nodes.node.port == 80
- rax_clb_nodes.node.status == 'ONLINE'
- rax_clb_nodes.node.type == 'PRIMARY'
- rax_clb_nodes.node.weight == 1
- name: Delete integration 1
rax_clb_nodes:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
load_balancer_id: "{{ rax_clb_id }}"
node_id: "{{ rax_clb_nodes.node.id }}"
state: absent
wait: true
wait_timeout: "{{ rackspace_wait_timeout }}"
register: rax_clb_nodes
- name: Validate delete integration 1
assert:
that:
- rax_clb_nodes is successful
# ============================================================
# ============================================================
- name: Test rax_clb_nodes with creds, region, load_balancer_id, address, port and type
rax_clb_nodes:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
load_balancer_id: "{{ rax_clb_id }}"
address: '172.16.0.1'
port: 80
type: secondary
wait: true
wait_timeout: "{{ rackspace_wait_timeout }}"
ignore_errors: true
register: rax_clb_nodes
- name: Validate rax_clb_nodes creds, region, load_balancer_id, address, port and type
assert:
that:
- rax_clb_nodes is failed
- rax_clb_nodes.msg == 'you must enable health monitoring to use secondary nodes'
# ============================================================
# ============================================================
- name: Delete CLB
rax_clb:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
name: "{{ rax_clb.balancer.name }}"
state: absent
wait: true
wait_timeout: "{{ rackspace_wait_timeout }}"
register: rax_clb
- name: "Validate delete integration 3"
assert:
that:
- rax_clb is changed
- rax_clb.balancer.id == rax_clb_id|int
# ============================================================