Merge pull request #13616 from resmo/for-ansible-stable-2.0
[stable-2.0] cloudstack: test_cs_instance: more integration tests
This commit is contained in:
commit
2281c455db
7 changed files with 272 additions and 23 deletions
|
@ -21,3 +21,23 @@
|
|||
that:
|
||||
- instance|success
|
||||
- not instance|changed
|
||||
|
||||
- name: test recover to stopped state and update a deleted instance
|
||||
cs_instance:
|
||||
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
|
||||
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:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
state: expunged
|
||||
failed_when: false
|
||||
|
|
|
@ -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
|
|
@ -28,9 +28,3 @@
|
|||
assert:
|
||||
that:
|
||||
- sg|success
|
||||
|
||||
# force expunge, only works with admin permissions
|
||||
- cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
state: expunged
|
||||
failed_when: false
|
||||
|
|
|
@ -4,3 +4,8 @@
|
|||
- include: tags.yml
|
||||
- include: absent.yml
|
||||
- include: cleanup.yml
|
||||
|
||||
- include: setup.yml
|
||||
- include: present_display_name.yml
|
||||
- include: absent_display_name.yml
|
||||
- include: cleanup.yml
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
---
|
||||
- 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|success
|
||||
|
||||
- name: test create instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -21,7 +29,6 @@
|
|||
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey"
|
||||
- not instance.tags
|
||||
|
||||
|
||||
- name: test create instance idempotence
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -44,7 +51,6 @@
|
|||
- instance.ssh_key == "{{ cs_resource_prefix }}-sshkey"
|
||||
- not instance.tags
|
||||
|
||||
|
||||
- name: test running instance not updated
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -60,7 +66,6 @@
|
|||
- instance.service_offering == "{{ test_cs_instance_offering_1 }}"
|
||||
- instance.state == "Running"
|
||||
|
||||
|
||||
- name: test stopping instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -76,7 +81,6 @@
|
|||
- 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 }}"
|
||||
|
@ -89,7 +93,6 @@
|
|||
- not instance|changed
|
||||
- instance.state == "Stopped"
|
||||
|
||||
|
||||
- name: test updating stopped instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -106,7 +109,6 @@
|
|||
- instance.service_offering == "{{ test_cs_instance_offering_2 }}"
|
||||
- instance.state == "Stopped"
|
||||
|
||||
|
||||
- name: test starting instance
|
||||
cs_instance:
|
||||
name: "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
|
@ -122,7 +124,6 @@
|
|||
- 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 }}"
|
||||
|
@ -133,6 +134,9 @@
|
|||
that:
|
||||
- instance|success
|
||||
- not instance|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
|
||||
|
@ -147,7 +151,7 @@
|
|||
- instance|success
|
||||
- instance|changed
|
||||
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
- instance.display_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"
|
||||
|
||||
|
@ -163,6 +167,21 @@
|
|||
- instance|success
|
||||
- not instance|changed
|
||||
- instance.name == "{{ cs_resource_prefix }}-vm-{{ instance_number }}"
|
||||
- instance.display_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
|
||||
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|success
|
||||
- instance|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 }}"
|
||||
|
|
|
@ -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 }}"
|
|
@ -22,11 +22,3 @@
|
|||
assert:
|
||||
that:
|
||||
- sg|success
|
||||
|
||||
- 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|success
|
||||
|
|
Loading…
Reference in a new issue