ansible/test/integration/targets/cloudscale_floating_ip/tasks/floating_ip.yml
Gaudenz Steinlin 6471e4653d Integration test cleanup for cloudscale modules (#53629)
* Integration test cleanup for cloudscale modules

This refactors the cleanup procedure for the integration tests of the
cloudscale_server and cloudscale_volume modules to use an "always"
section for cleanup. The cleanup code also deletes all resources which
contain the test run prefix. This ensures that all resources are cleaned
up regardless of the actual test result which is a prerequisite for
running these tests in CI.

* Move cloudscale_floating_ip tests from legacy to integration

This also adds code to make sure that floating IPs are deleted even if a
test run fails. This is unfortunately not possible for floatint IPv6
networks.
2019-03-12 17:53:49 +01:00

94 lines
2.7 KiB
YAML

- name: Request floating IP
cloudscale_floating_ip:
server: '{{ test01.uuid }}'
ip_version: '{{ item.ip_version }}'
reverse_ptr: '{{ item.reverse_ptr | default(omit) }}'
prefix_length: '{{ item.prefix_length | default(omit) }}'
register: floating_ip
- name: Verify request floating IP
assert:
that:
- floating_ip is successful
- floating_ip is changed
- (item.ip_version == 4 and floating_ip.ip | ipv4) or (item.ip_version == 6 and floating_ip.ip | ipv6)
- floating_ip.server == test01.uuid
- name: Check floating IP indempotence
cloudscale_floating_ip:
server: '{{ test01.uuid }}'
ip: '{{ floating_ip.ip }}'
register: floating_ip_indempotence
- name: Verify floating IP indempotence
assert:
that:
- floating_ip_indempotence is successful
- floating_ip_indempotence is not changed
- floating_ip_indempotence.server == test01.uuid
- name: Check network parameter alias
cloudscale_floating_ip:
server: '{{ test01.uuid }}'
network: '{{ floating_ip.ip }}'
register: floating_ip_network
- name: Verify network parameter alias
assert:
that:
- floating_ip_network is successful
- name: Move floating IP to second server
cloudscale_floating_ip:
server: '{{ test02.uuid }}'
ip: '{{ floating_ip.ip }}'
register: move_ip
- name: Verify move floating IPv4 to second server
assert:
that:
- move_ip is successful
- move_ip is changed
- move_ip.server == test02.uuid
- name: Fail if server is missing on update
cloudscale_floating_ip:
ip: '{{ floating_ip.ip }}'
register: update_failed
ignore_errors: True
- name: Verify fail if server is missing on update
assert:
that:
- update_failed is failed
- "'Missing required parameter' in update_failed.msg"
- name: Release floating IP
cloudscale_floating_ip:
ip: '{{ floating_ip.ip }}'
state: 'absent'
register: release_ip
- name: Verify release floating IPs
assert:
that:
- release_ip is successful
- release_ip is changed
- release_ip.state == 'absent'
- name: Release floating IP indempotence
cloudscale_floating_ip:
ip: '{{ floating_ip.ip }}'
state: 'absent'
register: release_ip
- name: Verify release floating IPs indempotence
assert:
that:
- release_ip is successful
- release_ip is not changed
- release_ip.state == 'absent'
- name: Fail if server is missing on request
cloudscale_floating_ip:
ip_version: 6
register: request_failed
ignore_errors: True
- name: Verify fail if server is missing on request
assert:
that:
- request_failed is failed
- "'Missing required parameter' in request_failed.msg"