automated integration tests for cloudstack (#20552)

This commit is contained in:
René Moser 2017-05-09 05:32:11 +02:00 committed by Matt Clay
commit aaf4f04574
92 changed files with 1248 additions and 193 deletions

View file

@ -0,0 +1,3 @@
cloud/cs
posix/ci/cloud/cs
skip/python3

View file

@ -0,0 +1,6 @@
---
test_cs_instance_1: "{{ cs_resource_prefix }}-vm1"
test_cs_instance_2: "{{ cs_resource_prefix }}-vm2"
test_cs_instance_template: "{{ cs_common_template }}"
test_cs_instance_offering_1: Small Instance
test_cs_disk_offering_1: Custom

View file

@ -0,0 +1,3 @@
---
dependencies:
- cs_common

View file

@ -0,0 +1,215 @@
---
- name: setup
cs_volume: name={{ cs_resource_prefix }}_vol state=absent
register: vol
- name: verify setup
assert:
that:
- vol|success
- name: setup instance 1
cs_instance:
name: "{{ test_cs_instance_1 }}"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
register: instance
- name: verify create instance
assert:
that:
- instance|success
- name: setup instance 2
cs_instance:
name: "{{ test_cs_instance_2 }}"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
register: instance
- name: verify create instance
assert:
that:
- instance|success
- name: test fail if missing name
action: cs_volume
register: vol
ignore_errors: true
- name: verify results of fail if missing name
assert:
that:
- vol|failed
- "vol.msg == 'missing required arguments: name'"
- name: test create volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
disk_offering: "{{ test_cs_disk_offering_1 }}"
size: 20
register: vol
- name: verify results test create volume
assert:
that:
- vol|changed
- vol.size == 20 * 1024 ** 3
- vol.name == "{{ cs_resource_prefix }}_vol"
- name: test create volume idempotence
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
disk_offering: "{{ test_cs_disk_offering_1 }}"
size: 20
register: vol
- name: verify results test create volume idempotence
assert:
that:
- not vol|changed
- vol.size == 20 * 1024 ** 3
- vol.name == "{{ cs_resource_prefix }}_vol"
- name: test shrink volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
disk_offering: "{{ test_cs_disk_offering_1 }}"
size: 10
shrink_ok: yes
register: vol
- name: verify results test create volume
assert:
that:
- vol|changed
- vol.size == 10 * 1024 ** 3
- vol.name == "{{ cs_resource_prefix }}_vol"
- name: test shrink volume idempotence
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
disk_offering: "{{ test_cs_disk_offering_1 }}"
size: 10
shrink_ok: yes
register: vol
- name: verify results test create volume
assert:
that:
- not vol|changed
- vol.size == 10 * 1024 ** 3
- vol.name == "{{ cs_resource_prefix }}_vol"
- name: test attach volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
vm: "{{ test_cs_instance_1 }}"
state: attached
register: vol
- name: verify results test attach volume
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.vm == "{{ test_cs_instance_1 }}"
- vol.attached is defined
- name: test attach volume idempotence
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
vm: "{{ test_cs_instance_1 }}"
state: attached
register: vol
- name: verify results test attach volume idempotence
assert:
that:
- not vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.vm == "{{ test_cs_instance_1 }}"
- vol.attached is defined
- name: test attach attached volume to another vm
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
vm: "{{ test_cs_instance_2 }}"
state: attached
register: vol
- name: verify results test attach attached volume to another vm
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.vm == "{{ test_cs_instance_2 }}"
- vol.attached is defined
- name: test attach attached volume to another vm idempotence
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
vm: "{{ test_cs_instance_2 }}"
state: attached
register: vol
- name: verify results test attach attached volume to another vm idempotence
assert:
that:
- not vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.vm == "{{ test_cs_instance_2 }}"
- vol.attached is defined
- name: test detach volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
state: detached
register: vol
- name: verify results test detach volume
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.attached is undefined
- name: test detach volume idempotence
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
state: detached
register: vol
- name: verify results test detach volume idempotence
assert:
that:
- not vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.attached is undefined
- name: test delete volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
state: absent
register: vol
- name: verify results test create volume
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- name: test delete volume idempotence
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
state: absent
register: vol
- name: verify results test delete volume idempotence
assert:
that:
- not vol|changed
- name: cleanup instance 1
cs_instance:
name: "{{ test_cs_instance_1 }}"
state: absent
register: instance
- name: verify create instance
assert:
that:
- instance|success
- name: cleanup instance 2
cs_instance:
name: "{{ test_cs_instance_2 }}"
state: absent
register: instance
- name: verify create instance
assert:
that:
- instance|success