ansible/test/integration/targets/cs_instance/tasks/present.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

319 lines
12 KiB
YAML

---
- name: setup instance to be absent
cs_instance: name={{ cs_resource_prefix }}-vm-{{ instance_number }} state=absent
register: instance
- name: verify instance to be absent
assert:
that:
- instance is successful
- name: test create instance in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
affinity_group: "{{ cs_resource_prefix }}-ag"
security_group: "{{ cs_resource_prefix }}-sg"
ssh_key: "{{ cs_resource_prefix }}-sshkey"
tags: []
register: instance
check_mode: true
- name: verify create instance in check mode
assert:
that:
- instance is successful
- instance is changed
- name: test create instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
affinity_group: "{{ cs_resource_prefix }}-ag"
security_group: "{{ cs_resource_prefix }}-sg"
ssh_key: "{{ cs_resource_prefix }}-sshkey"
tags: []
register: instance
- name: verify create instance
assert:
that:
- instance is successful
- instance is changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- instance.state == "Running"
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey"
- not instance.tags
- name: test create instance idempotence
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
affinity_group: "{{ cs_resource_prefix }}-ag"
security_group: "{{ cs_resource_prefix }}-sg"
ssh_key: "{{ cs_resource_prefix }}-sshkey"
tags: []
register: instance
- name: verify create instance idempotence
assert:
that:
- instance is successful
- instance is not changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- instance.state == "Running"
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey"
- not instance.tags
- name: test running instance not updated in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
service_offering: "{{ test_cs_instance_offering_2 }}"
register: instance
check_mode: true
- name: verify running instance not updated in check mode
assert:
that:
- instance is successful
- instance is not changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- instance.state == "Running"
- name: test running instance not updated
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
service_offering: "{{ test_cs_instance_offering_2 }}"
register: instance
- name: verify running instance not updated
assert:
that:
- instance is successful
- instance is not changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- instance.state == "Running"
- name: test stopping instance in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
state: stopped
register: instance
check_mode: true
- name: verify stopping instance in check mode
assert:
that:
- instance is successful
- instance is changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- instance.state == "Running"
- name: test stopping instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
state: stopped
register: instance
- name: verify stopping instance
assert:
that:
- instance is successful
- instance is changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- instance.state == "Stopped"
- name: test stopping instance idempotence
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
state: stopped
register: instance
- name: verify stopping instance idempotence
assert:
that:
- instance is successful
- instance is not changed
- instance.state == "Stopped"
- name: test updating stopped instance in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
display_name: "{{ cs_resource_prefix }}-display-{{ instance_number }}"
service_offering: "{{ test_cs_instance_offering_2 }}"
register: instance
check_mode: true
- name: verify updating stopped instance in check mode
assert:
that:
- instance is successful
- instance is changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- instance.state == "Stopped"
- name: test updating stopped instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
display_name: "{{ cs_resource_prefix }}-display-{{ instance_number }}"
service_offering: "{{ test_cs_instance_offering_2 }}"
register: instance
- name: verify updating stopped instance
assert:
that:
- instance is successful
- instance is changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_2 }}"
- instance.state == "Stopped"
- name: test updating stopped instance idempotence
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
display_name: "{{ cs_resource_prefix }}-display-{{ instance_number }}"
service_offering: "{{ test_cs_instance_offering_2 }}"
register: instance
- name: verify updating stopped instance idempotence
assert:
that:
- instance is successful
- instance is not changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_2 }}"
- instance.state == "Stopped"
- name: test starting instance in check mdoe
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
state: started
register: instance
check_mode: true
- name: verify starting instance in check mode
assert:
that:
- instance is successful
- instance is changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_2 }}"
- instance.state == "Stopped"
- name: test starting instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
state: started
register: instance
- name: verify starting instance
assert:
that:
- instance is successful
- instance is changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_2 }}"
- instance.state == "Running"
- name: test starting instance idempotence
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
state: started
register: instance
- name: verify starting instance idempotence
assert:
that:
- instance is successful
- instance is not changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_2 }}"
- instance.state == "Running"
- name: test force update running instance in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
force: true
register: instance
check_mode: true
- name: verify force update running instance in check mode
assert:
that:
- instance is successful
- instance is changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_2 }}"
- instance.state == "Running"
- name: test force update running instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
force: true
register: instance
- name: verify force update running instance
assert:
that:
- instance is successful
- instance is changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- instance.state == "Running"
- name: test force update running instance idempotence
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
force: true
register: instance
- name: verify force update running instance idempotence
assert:
that:
- instance is successful
- instance is not changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- instance.state == "Running"
- name: test restore instance in check mode
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
template: "{{ test_cs_instance_template }}"
state: restored
register: instance
check_mode: true
- name: verify restore instance in check mode
assert:
that:
- instance is successful
- instance is changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
- name: test restore instance
cs_instance:
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
template: "{{ test_cs_instance_template }}"
state: restored
register: instance
- name: verify restore instance
assert:
that:
- instance is successful
- instance is changed
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
- instance.display_name == "{{ cs_resource_prefix }}-display-{{ instance_number }}"
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"