mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
4fe08441be
* 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
260 lines
7.8 KiB
YAML
260 lines
7.8 KiB
YAML
# ============================================================
|
|
- name: Test rax_cbs_attachments with no args
|
|
rax_cbs_attachments:
|
|
ignore_errors: true
|
|
register: rax_cbs_attachments
|
|
|
|
- name: Validate results of rax_cbs_attachments with no args
|
|
assert:
|
|
that:
|
|
- rax_cbs_attachments is failed
|
|
- 'rax_cbs_attachments.msg == "missing required arguments: server,volume,device"'
|
|
# ============================================================
|
|
|
|
|
|
|
|
# ============================================================
|
|
- name: Test rax_cbs_attachments with server, volume and device
|
|
rax_cbs_attachments:
|
|
server: '1234'
|
|
volume: '1234'
|
|
device: /dev/xvde
|
|
ignore_errors: true
|
|
register: rax_cbs_attachments
|
|
|
|
- name: Validate results of rax_cbs_attachments with server, volume and device
|
|
assert:
|
|
that:
|
|
- rax_cbs_attachments is failed
|
|
- rax_cbs_attachments.msg == 'No credentials supplied!'
|
|
# ============================================================
|
|
|
|
|
|
|
|
# ============================================================
|
|
- name: Test rax_cbs_attachments with credentials, server, volume and device
|
|
rax_cbs_attachments:
|
|
username: "{{ rackspace_username }}"
|
|
api_key: "{{ rackspace_api_key }}"
|
|
server: '1234'
|
|
volume: '1234'
|
|
device: /dev/xvde
|
|
ignore_errors: true
|
|
register: rax_cbs_attachments
|
|
|
|
- name: Validate results of rax_cbs_attachments with credentials, server, volume and device
|
|
assert:
|
|
that:
|
|
- rax_cbs_attachments is failed
|
|
- rax_cbs_attachments.msg.startswith('None is not a valid region')
|
|
# ============================================================
|
|
|
|
|
|
|
|
# ============================================================
|
|
- name: Test rax_cbs_attachments with creds, region, invalid server, invalid volume and device
|
|
rax_cbs_attachments:
|
|
username: "{{ rackspace_username }}"
|
|
api_key: "{{ rackspace_api_key }}"
|
|
region: "{{ rackspace_region }}"
|
|
server: '1234'
|
|
volume: '1234'
|
|
device: /dev/xvde
|
|
ignore_errors: true
|
|
register: rax_cbs_attachments
|
|
|
|
- name: Validate rax_cbs_attachments creds, region, invalid server, invalid volume and device
|
|
assert:
|
|
that:
|
|
- rax_cbs_attachments is failed
|
|
- rax_cbs_attachments.msg == 'No matching storage volumes were found'
|
|
# ============================================================
|
|
|
|
|
|
|
|
# ============================================================
|
|
- name: Build Volume for rax_cbs_attachments test
|
|
rax_cbs:
|
|
username: "{{ rackspace_username }}"
|
|
api_key: "{{ rackspace_api_key }}"
|
|
region: "{{ rackspace_region }}"
|
|
name: "{{ resource_prefix }}-rax_cbs_attachments"
|
|
wait: true
|
|
wait_timeout: "{{ rackspace_wait_timeout }}"
|
|
register: rax_cbs
|
|
|
|
- name: Validate volume build
|
|
assert:
|
|
that:
|
|
- rax_cbs is successful
|
|
- rax_cbs is changed
|
|
- rax_cbs.volume.display_name == "{{ resource_prefix }}-rax_cbs_attachments"
|
|
# ============================================================
|
|
|
|
|
|
|
|
# ============================================================
|
|
- name: Build CloudServer for rax_cbs_attachments tests
|
|
rax:
|
|
username: "{{ rackspace_username }}"
|
|
api_key: "{{ rackspace_api_key }}"
|
|
region: "{{ rackspace_region }}"
|
|
image: "{{ rackspace_image_id }}"
|
|
flavor: "{{ rackspace_flavor }}"
|
|
name: "{{ resource_prefix }}-rax_cbs_attachments"
|
|
wait: true
|
|
wait_timeout: "{{ rackspace_wait_timeout }}"
|
|
register: rax
|
|
|
|
- name: Validate CloudServer build
|
|
assert:
|
|
that:
|
|
- rax is successful
|
|
- rax is changed
|
|
- rax.action == 'create'
|
|
- rax.instances|length == 1
|
|
- rax.instances[0].name == "{{ resource_prefix }}-rax_cbs_attachments"
|
|
# ============================================================
|
|
|
|
|
|
|
|
# ============================================================
|
|
- name: Test rax_cbs_attachments with creds, region, invalid server, volume and device
|
|
rax_cbs_attachments:
|
|
username: "{{ rackspace_username }}"
|
|
api_key: "{{ rackspace_api_key }}"
|
|
region: "{{ rackspace_region }}"
|
|
server: '1234'
|
|
volume: "{{ rax_cbs.volume.id }}"
|
|
device: /dev/xvde
|
|
ignore_errors: true
|
|
register: rax_cbs_attachments
|
|
|
|
- name: Validate rax_cbs_attachments creds, region, invalid server, volume and device
|
|
assert:
|
|
that:
|
|
- rax_cbs_attachments is failed
|
|
- rax_cbs_attachments.msg == 'No Server was matched by name, try using the Server ID instead'
|
|
# ============================================================
|
|
|
|
|
|
|
|
# ============================================================
|
|
- name: Test rax_cbs_attachments with creds, region, server, volume and device (valid)
|
|
rax_cbs_attachments:
|
|
username: "{{ rackspace_username }}"
|
|
api_key: "{{ rackspace_api_key }}"
|
|
region: "{{ rackspace_region }}"
|
|
server: "{{ rax.instances[0].id }}"
|
|
volume: "{{ rax_cbs.volume.id }}"
|
|
device: /dev/xvde
|
|
wait: true
|
|
wait_timeout: "{{ rackspace_wait_timeout }}"
|
|
register: rax_cbs_attachments
|
|
|
|
- name: Validate rax_cbs_attachments creds, region, server, volume and device (valid)
|
|
assert:
|
|
that:
|
|
- rax_cbs_attachments is successful
|
|
- rax_cbs_attachments is changed
|
|
- rax_cbs_attachments.volume.attachments.0.device == '/dev/xvde'
|
|
- rax_cbs_attachments.volume.attachments.0.server_id == "{{ rax.instances[0].id }}"
|
|
|
|
- name: Idempotent present test
|
|
rax_cbs_attachments:
|
|
username: "{{ rackspace_username }}"
|
|
api_key: "{{ rackspace_api_key }}"
|
|
region: "{{ rackspace_region }}"
|
|
server: "{{ rax.instances[0].id }}"
|
|
volume: "{{ rax_cbs.volume.id }}"
|
|
device: /dev/xvde
|
|
wait: true
|
|
wait_timeout: "{{ rackspace_wait_timeout }}"
|
|
register: rax_cbs_attachments
|
|
|
|
- name: Validate idempotent present test
|
|
assert:
|
|
that:
|
|
- rax_cbs_attachments is successful
|
|
- rax_cbs_attachments is not changed
|
|
|
|
- name: Unattach volume
|
|
rax_cbs_attachments:
|
|
username: "{{ rackspace_username }}"
|
|
api_key: "{{ rackspace_api_key }}"
|
|
region: "{{ rackspace_region }}"
|
|
server: "{{ rax.instances[0].id }}"
|
|
volume: "{{ rax_cbs.volume.id }}"
|
|
device: /dev/xvde
|
|
wait: true
|
|
wait_timeout: "{{ rackspace_wait_timeout }}"
|
|
state: absent
|
|
register: rax_cbs_attachments
|
|
|
|
- name: Validate unattach volume
|
|
assert:
|
|
that:
|
|
- rax_cbs_attachments is successful
|
|
- rax_cbs_attachments is changed
|
|
- rax_cbs_attachments.volume.attachments == []
|
|
|
|
- name: Idempotent absent test
|
|
rax_cbs_attachments:
|
|
username: "{{ rackspace_username }}"
|
|
api_key: "{{ rackspace_api_key }}"
|
|
region: "{{ rackspace_region }}"
|
|
server: "{{ rax.instances[0].id }}"
|
|
volume: "{{ rax_cbs.volume.id }}"
|
|
device: /dev/xvde
|
|
wait: true
|
|
wait_timeout: "{{ rackspace_wait_timeout }}"
|
|
state: absent
|
|
register: rax_cbs_attachments
|
|
|
|
- name: Validate idempotent absent test
|
|
assert:
|
|
that:
|
|
- rax_cbs_attachments is successful
|
|
- rax_cbs_attachments is not changed
|
|
# ============================================================
|
|
|
|
|
|
|
|
# ============================================================
|
|
- name: Delete test volume
|
|
rax_cbs:
|
|
username: "{{ rackspace_username }}"
|
|
api_key: "{{ rackspace_api_key }}"
|
|
region: "{{ rackspace_region }}"
|
|
name: "{{ rax_cbs.volume.id }}"
|
|
state: absent
|
|
register: rax_cbs
|
|
|
|
- name: Validate delete integration 6
|
|
assert:
|
|
that:
|
|
- rax_cbs is successful
|
|
- rax_cbs is changed
|
|
# ============================================================
|
|
|
|
|
|
|
|
# ============================================================
|
|
- name: "Delete CloudServer"
|
|
rax:
|
|
username: "{{ rackspace_username }}"
|
|
api_key: "{{ rackspace_api_key }}"
|
|
region: "{{ rackspace_region }}"
|
|
instance_ids: "{{ rax.instances[0].id }}"
|
|
state: absent
|
|
wait: true
|
|
wait_timeout: "{{ rackspace_wait_timeout }}"
|
|
register: rax
|
|
|
|
- name: "Validate delete"
|
|
assert:
|
|
that:
|
|
- rax is changed
|
|
- rax is successful
|
|
- rax.action == 'delete'
|
|
# ============================================================
|