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/integration/targets/cs_vmsnapshot/tasks/main.yml
Matt Martz 4fe08441be Deprecate tests used as filters ()
* 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

152 lines
3.9 KiB
YAML

---
- name: setup instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm-snapshot"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
register: instance
- name: verify create instance
assert:
that:
- instance is successful
- name: ensure no snapshot exists
cs_vmsnapshot:
name: "{{ cs_resource_prefix }}_snapshot"
vm: "{{ cs_resource_prefix }}-vm-snapshot"
state: absent
register: snap
- name: verify setup
assert:
that:
- snap is successful
- name: test fail if missing name
action: cs_vmsnapshot
register: snap
ignore_errors: true
- name: verify results of fail if missing params
assert:
that:
- snap is failed
- 'snap.msg.startswith("missing required arguments: ")'
- name: test create snapshot in check mode
cs_vmsnapshot:
name: "{{ cs_resource_prefix }}_snapshot"
vm: "{{ cs_resource_prefix }}-vm-snapshot"
snapshot_memory: yes
register: snap
check_mode: true
- name: verify test create snapshot in check mode
assert:
that:
- snap is changed
- name: test create snapshot
cs_vmsnapshot:
name: "{{ cs_resource_prefix }}_snapshot"
vm: "{{ cs_resource_prefix }}-vm-snapshot"
snapshot_memory: yes
register: snap
- name: verify test create snapshot
assert:
that:
- snap is changed
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
- name: test create snapshot idempotence
cs_vmsnapshot:
name: "{{ cs_resource_prefix }}_snapshot"
vm: "{{ cs_resource_prefix }}-vm-snapshot"
snapshot_memory: yes
register: snap
- name: verify test create snapshot idempotence
assert:
that:
- snap is not changed
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
- name: test revert snapshot in check mode
cs_vmsnapshot:
name: "{{ cs_resource_prefix }}_snapshot"
vm: "{{ cs_resource_prefix }}-vm-snapshot"
state: revert
register: snap
check_mode: true
- name: verify test revert snapshot in check mode
assert:
that:
- snap is changed
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
- name: test fail revert unknown snapshot
cs_vmsnapshot:
name: "{{ cs_resource_prefix }}_snapshot_unknown"
vm: "{{ cs_resource_prefix }}-vm-snapshot"
state: revert
register: snap
ignore_errors: true
- name: verify test fail revert unknown snapshot
assert:
that:
- snap is failed
- snap.msg == "snapshot not found, could not revert VM"
- name: test revert snapshot
cs_vmsnapshot:
name: "{{ cs_resource_prefix }}_snapshot"
vm: "{{ cs_resource_prefix }}-vm-snapshot"
state: revert
register: snap
- name: verify test revert snapshot
assert:
that:
- snap is changed
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
- name: test remove snapshot in check mode
cs_vmsnapshot:
name: "{{ cs_resource_prefix }}_snapshot"
vm: "{{ cs_resource_prefix }}-vm-snapshot"
state: absent
register: snap
check_mode: true
- name: verify test remove snapshot in check mode
assert:
that:
- snap is changed
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
- name: test remove snapshot
cs_vmsnapshot:
name: "{{ cs_resource_prefix }}_snapshot"
vm: "{{ cs_resource_prefix }}-vm-snapshot"
state: absent
register: snap
- name: verify test remove snapshot
assert:
that:
- snap is changed
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
- name: test remove snapshot idempotence
cs_vmsnapshot:
name: "{{ cs_resource_prefix }}_snapshot"
vm: "{{ cs_resource_prefix }}-vm-snapshot"
state: absent
register: snap
- name: verify test remove snapshot idempotence
assert:
that:
- snap is not changed
- name: cleanup instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm-snapshot"
state: expunged
register: instance
- name: verify destroy instance
assert:
that:
- instance is successful