From b0525da8c879faf837fba026c908bf0521e7629f Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Sat, 5 Dec 2015 15:19:43 +0100 Subject: [PATCH] cloudstack: cs_volume: add tests for volume resize See https://github.com/ansible/ansible-modules-extras/pull/1333 --- .../roles/test_cs_volume/defaults/main.yml | 2 +- .../roles/test_cs_volume/tasks/main.yml | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/test/integration/roles/test_cs_volume/defaults/main.yml b/test/integration/roles/test_cs_volume/defaults/main.yml index 546469f33f..311a99bbe8 100644 --- a/test/integration/roles/test_cs_volume/defaults/main.yml +++ b/test/integration/roles/test_cs_volume/defaults/main.yml @@ -3,4 +3,4 @@ test_cs_instance_1: "{{ cs_resource_prefix }}-vm1" test_cs_instance_2: "{{ cs_resource_prefix }}-vm2" test_cs_instance_template: CentOS 5.3(64-bit) no GUI (Simulator) test_cs_instance_offering_1: Small Instance -test_cs_disk_offering_1: Small +test_cs_disk_offering_1: Custom diff --git a/test/integration/roles/test_cs_volume/tasks/main.yml b/test/integration/roles/test_cs_volume/tasks/main.yml index fa1f102602..ae57039cee 100644 --- a/test/integration/roles/test_cs_volume/tasks/main.yml +++ b/test/integration/roles/test_cs_volume/tasks/main.yml @@ -43,22 +43,54 @@ 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