mirror of https://github.com/ansible/ansible.git
cloudstack: test_cs_instance: more integration tests
cloudstack: extend test_cs_instance addressing recovering cloudstack: test_cs_instance: add tests for using display_name as indentifier.pull/13616/head
parent
6963955cb4
commit
b85b92ecdd
@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
- name: test destroy instance with display_name
|
||||||
|
cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
state: absent
|
||||||
|
register: instance
|
||||||
|
- name: verify destroy instance with display_name
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- instance|changed
|
||||||
|
- instance.state == "Destroyed"
|
||||||
|
|
||||||
|
- name: test destroy instance with display_name idempotence
|
||||||
|
cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
state: absent
|
||||||
|
register: instance
|
||||||
|
- name: verify destroy instance with display_name idempotence
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- not instance|changed
|
||||||
|
|
||||||
|
- name: test recover to stopped state and update a deleted instance with display_name
|
||||||
|
cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||||
|
state: stopped
|
||||||
|
register: instance
|
||||||
|
- name: verify test recover to stopped state and update a deleted instance with display_name
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- instance|changed
|
||||||
|
- instance.state == "Stopped"
|
||||||
|
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||||
|
|
||||||
|
# force expunge, only works with admin permissions
|
||||||
|
- cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
state: expunged
|
||||||
|
failed_when: false
|
@ -0,0 +1,176 @@
|
|||||||
|
---
|
||||||
|
- name: setup instance with display_name to be absent
|
||||||
|
cs_instance: display_name={{ cs_resource_prefix }}-vm-{{ instance_number }} state=absent
|
||||||
|
register: instance
|
||||||
|
- name: verify instance with display_name to be absent
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
|
||||||
|
- name: test create instance with display_name
|
||||||
|
cs_instance:
|
||||||
|
display_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 with display_name
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- instance|changed
|
||||||
|
- 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 with display_name idempotence
|
||||||
|
cs_instance:
|
||||||
|
display_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 with display_name idempotence
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- not instance|changed
|
||||||
|
- 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 with display_name not updated
|
||||||
|
cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
service_offering: "{{ test_cs_instance_offering_2 }}"
|
||||||
|
register: instance
|
||||||
|
- name: verify running instance with display_name not updated
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- not instance|changed
|
||||||
|
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||||
|
- instance.state == "Running"
|
||||||
|
|
||||||
|
- name: test stopping instance with display_name
|
||||||
|
cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
state: stopped
|
||||||
|
register: instance
|
||||||
|
- name: verify stopping instance with display_name
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- instance|changed
|
||||||
|
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||||
|
- instance.state == "Stopped"
|
||||||
|
|
||||||
|
- name: test stopping instance with display_name idempotence
|
||||||
|
cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
state: stopped
|
||||||
|
register: instance
|
||||||
|
- name: verify stopping instance idempotence
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- not instance|changed
|
||||||
|
- instance.state == "Stopped"
|
||||||
|
|
||||||
|
- name: test updating stopped instance with display_name
|
||||||
|
cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
service_offering: "{{ test_cs_instance_offering_2 }}"
|
||||||
|
register: instance
|
||||||
|
- name: verify updating stopped instance with display_name
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- instance|changed
|
||||||
|
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
- instance.service_offering == "{{ test_cs_instance_offering_2 }}"
|
||||||
|
- instance.state == "Stopped"
|
||||||
|
|
||||||
|
- name: test starting instance with display_name
|
||||||
|
cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
state: started
|
||||||
|
register: instance
|
||||||
|
- name: verify starting instance with display_name
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- instance|changed
|
||||||
|
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
- instance.service_offering == "{{ test_cs_instance_offering_2 }}"
|
||||||
|
- instance.state == "Running"
|
||||||
|
|
||||||
|
- name: test starting instance with display_name idempotence
|
||||||
|
cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
state: started
|
||||||
|
register: instance
|
||||||
|
- name: verify starting instance with display_name idempotence
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- not instance|changed
|
||||||
|
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
- instance.service_offering == "{{ test_cs_instance_offering_2 }}"
|
||||||
|
- instance.state == "Running"
|
||||||
|
|
||||||
|
- name: test force update running instance with display_name
|
||||||
|
cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||||
|
force: true
|
||||||
|
register: instance
|
||||||
|
- name: verify force update running instance with display_name
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- instance|changed
|
||||||
|
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||||
|
- instance.state == "Running"
|
||||||
|
|
||||||
|
- name: test force update running instance with display_name idempotence
|
||||||
|
cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
service_offering: "{{ test_cs_instance_offering_1 }}"
|
||||||
|
force: true
|
||||||
|
register: instance
|
||||||
|
- name: verify force update running instance with display_name idempotence
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- not instance|changed
|
||||||
|
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||||
|
- instance.state == "Running"
|
||||||
|
|
||||||
|
- name: test restore instance with display_name
|
||||||
|
cs_instance:
|
||||||
|
display_name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
template: "{{ test_cs_instance_template }}"
|
||||||
|
state: restored
|
||||||
|
register: instance
|
||||||
|
- name: verify restore instance with display_name
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- instance|success
|
||||||
|
- instance|changed
|
||||||
|
- instance.display_name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||||
|
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
Loading…
Reference in New Issue