summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2015-01-16 14:09:18 -0600
committerMatt Martz <matt@sivel.net>2015-02-11 12:59:01 -0600
commit9878ebf0eedcb8665f80c264047bdad587abc0e1 (patch)
treefbc9e1c320483b32ce05c6d1cba2f54415f73222 /test
parent340b845c38b646de05ea4397832959b614d2953d (diff)
downloadansible-9878ebf0eedcb8665f80c264047bdad587abc0e1.tar.gz
Add tests for rax instance_ids with state=absent
Diffstat (limited to 'test')
-rw-r--r--test/integration/roles/test_rax/tasks/main.yml61
1 files changed, 54 insertions, 7 deletions
diff --git a/test/integration/roles/test_rax/tasks/main.yml b/test/integration/roles/test_rax/tasks/main.yml
index 4fe820a3c2..e91c0a949f 100644
--- a/test/integration/roles/test_rax/tasks/main.yml
+++ b/test/integration/roles/test_rax/tasks/main.yml
@@ -748,11 +748,11 @@
region: "{{ rackspace_region }}"
image: "{{ rackspace_image_id }}"
flavor: "{{ rackspace_flavor }}"
- name: "{{ resource_prefix }}-10-%03d"
+ name: "{{ resource_prefix }}-11-%03d"
count: 2
count_offset: 10
exact_count: true
- group: "{{ resource_prefix }}-10"
+ group: "{{ resource_prefix }}-11"
wait: true
register: rax
@@ -764,24 +764,24 @@
- rax.action == 'create'
- rax.instances|length == 2
- rax.instances == rax.success
- - rax.instances|map(attribute='rax_name')|unique|list|sort == ['{{ resource_prefix }}-10-010', '{{ resource_prefix }}-10-011']
+ - rax.instances|map(attribute='rax_name')|unique|list|sort == ['{{ resource_prefix }}-11-010', '{{ resource_prefix }}-11-011']
-- name: "Test delete integration 10"
+- name: "Test delete integration 11"
rax:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
image: "{{ rackspace_image_id }}"
flavor: "{{ rackspace_flavor }}"
- name: "{{ resource_prefix }}-10-%03d"
+ name: "{{ resource_prefix }}-11-%03d"
count: 0
count_offset: 10
exact_count: true
- group: "{{ resource_prefix }}-10"
+ group: "{{ resource_prefix }}-11"
wait: true
register: rax
-- name: "Validate delete integration 10"
+- name: "Validate delete integration 11"
assert:
that:
- rax|success
@@ -790,3 +790,50 @@
- rax.success|length == 2
- not rax.instances
# ============================================================
+
+
+
+# ============================================================
+- name: Test rax instance_ids absent 1 (create)
+ rax:
+ username: "{{ rackspace_username }}"
+ api_key: "{{ rackspace_api_key }}"
+ region: "{{ rackspace_region }}"
+ image: "{{ rackspace_image_id }}"
+ flavor: "{{ rackspace_flavor }}"
+ name: "{{ resource_prefix }}-12"
+ wait: true
+ register: rax
+
+- name: Validate rax instance_ids absent 1 (create)
+ assert:
+ that:
+ - rax|success
+ - rax|changed
+ - rax.action == 'create'
+ - rax.instances|length == 1
+ - rax.instances[0].name == "{{ resource_prefix }}-12"
+ - rax.instances[0] == rax.success[0]
+ - rax.instances[0].rax_status == 'ACTIVE'
+
+- name: Test rax instance_ids absent 2 (delete)
+ rax:
+ username: "{{ rackspace_username }}"
+ api_key: "{{ rackspace_api_key }}"
+ region: "{{ rackspace_region }}"
+ image: "{{ rackspace_image_id }}"
+ flavor: "{{ rackspace_flavor }}"
+ instance_ids:
+ - "{{ rax.success.0.rax_id }}"
+ state: absent
+ wait: true
+ register: rax2
+
+- name: Validate rax instance_ids absent 2 (delete)
+ assert:
+ that:
+ - rax2|success
+ - rax2|changed
+ - rax2.action == 'delete'
+ - rax2.success.0.rax_id == rax.success.0.rax_id
+# ============================================================