ansible/test/integration/targets/cloudscale_volume/tasks/tests.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

154 lines
3.6 KiB
YAML

---
- name: Create volume
cloudscale_volume:
name: '{{ cloudscale_resource_prefix }}-vol'
size_gb: 50
register: vol
- name: 'VERIFY: Create volume'
assert:
that:
- vol is successful
- vol is changed
- vol.size_gb == 50
- vol.name == '{{ cloudscale_resource_prefix }}-vol'
- name: Create volume indempotence
cloudscale_volume:
name: '{{ cloudscale_resource_prefix }}-vol'
size_gb: 50
register: vol
- name: 'VERIFY: Create volume indempotence'
assert:
that:
- vol is successful
- vol is not changed
- name: Attach existing volume by name to server
cloudscale_volume:
name: '{{ cloudscale_resource_prefix }}-vol'
server_uuids:
- '{{ server.uuid }}'
register: vol
- name: 'VERIFY: Attach existing volume by name to server'
assert:
that:
- vol is successful
- vol is changed
- server.uuid in vol.server_uuids
- name: Attach existing volume by name to server indempotence
cloudscale_volume:
name: '{{ cloudscale_resource_prefix }}-vol'
server_uuids:
- '{{ server.uuid }}'
register: vol
- name: 'VERIFY: Attach existing volume by name to server indempotence'
assert:
that:
- vol is successful
- vol is not changed
- server.uuid in vol.server_uuids
- name: Resize attached volume by UUID
cloudscale_volume:
uuid: '{{ vol.uuid }}'
size_gb: 100
register: vol
- name: 'VERIFY: Resize attached volume by UUID'
assert:
that:
- vol is successful
- vol is changed
- vol.size_gb == 100
- name: Resize attached volume by UUID indempotence
cloudscale_volume:
uuid: '{{ vol.uuid }}'
size_gb: 100
register: vol
- name: 'VERIFY: Resize attached volume by UUID indempotence'
assert:
that:
- vol is successful
- vol is not changed
- vol.size_gb == 100
- name: Delete attached volume by UUID
cloudscale_volume:
uuid: '{{ vol.uuid }}'
state: 'absent'
register: deleted
- name: 'VERIFY: Delete attached volume by UUID'
assert:
that:
- deleted is successful
- deleted is changed
- deleted.state == 'absent'
- name: Delete attached volume by UUID indempotence
cloudscale_volume:
uuid: '{{ vol.uuid }}'
state: 'absent'
register: deleted
- name: 'VERIFY: Delete attached volume by UUID indempotence'
assert:
that:
- deleted is successful
- deleted is not changed
- deleted.state == 'absent'
- name: Create bulk volume and attach
cloudscale_volume:
name: '{{ cloudscale_resource_prefix }}-bulk'
type: bulk
size_gb: 100
server_uuids:
- '{{ server.uuid }}'
register: bulk
- name: 'VERIFY: Create bulk volume and attach'
assert:
that:
- bulk is successful
- bulk is changed
- bulk.size_gb == 100
- server.uuid in bulk.server_uuids
- name: Detach volume by UUID
cloudscale_volume:
uuid: '{{ bulk.uuid }}'
server_uuids: []
register: bulk
- name: 'VERIFY: Detach volume by UUID'
assert:
that:
- bulk is successful
- bulk is changed
- bulk.server_uuids == []
- name: Resize detached volume by name
cloudscale_volume:
name: '{{ bulk.name }}'
size_gb: 200
register: bulk
- name: 'VERIFY: Resize detached volume by name'
assert:
that:
- bulk is successful
- bulk is changed
- bulk.size_gb == 200
- name: Delete volume by name
cloudscale_volume:
name: '{{ bulk.name }}'
state: 'absent'
register: bulk
- name: 'VERIFY: Delete volume by name'
assert:
that:
- bulk is successful
- bulk is changed
- bulk.state == 'absent'
- import_tasks: failures.yml
- import_tasks: check-mode.yml