Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
74f4d186
Commit
74f4d186
authored
Jan 19, 2015
by
Matt Martz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for rax_cbs_attachments
parent
5e00e72f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
259 additions
and
0 deletions
+259
-0
test/integration/rackspace.yml
+3
-0
test/integration/roles/test_rax_cbs_attachments/meta/main.yml
+3
-0
test/integration/roles/test_rax_cbs_attachments/tasks/main.yml
+253
-0
No files found.
test/integration/rackspace.yml
View file @
74f4d186
...
...
@@ -28,3 +28,6 @@
-
role
:
test_rax_cbs
tags
:
test_rax_cbs
-
role
:
test_rax_cbs_attachments
tags
:
test_rax_cbs_attachments
test/integration/roles/test_rax_cbs_attachments/meta/main.yml
0 → 100644
View file @
74f4d186
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_cbs_attachments/tasks/main.yml
0 → 100644
View file @
74f4d186
# ============================================================
-
name
:
Test rax_cbs_attachments with no args
rax_cbs_attachments
:
ignore_errors
:
true
register
:
rax_cbs_attachments
-
name
:
Validate results of rax_cbs_attachments with no args
assert
:
that
:
-
rax_cbs_attachments|failed
-
rax_cbs_attachments.msg == 'missing required arguments
:
server,volume,device'
# ============================================================
# ============================================================
-
name
:
Test rax_cbs_attachments with server, volume and device
rax_cbs_attachments
:
server
:
'
1234'
volume
:
'
1234'
device
:
/dev/xvde
ignore_errors
:
true
register
:
rax_cbs_attachments
-
name
:
Validate results of rax_cbs_attachments with server, volume and device
assert
:
that
:
-
rax_cbs_attachments|failed
-
rax_cbs_attachments.msg == 'No credentials supplied!'
# ============================================================
# ============================================================
-
name
:
Test rax_cbs_attachments with credentials, server, volume and device
rax_cbs_attachments
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
server
:
'
1234'
volume
:
'
1234'
device
:
/dev/xvde
ignore_errors
:
true
register
:
rax_cbs_attachments
-
name
:
Validate results of rax_cbs_attachments with credentials, server, volume and device
assert
:
that
:
-
rax_cbs_attachments|failed
-
rax_cbs_attachments.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
-
name
:
Test rax_cbs_attachments with creds, region, invalid server, invalid volume and device
rax_cbs_attachments
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
server
:
'
1234'
volume
:
'
1234'
device
:
/dev/xvde
ignore_errors
:
true
register
:
rax_cbs_attachments
-
name
:
Validate rax_cbs_attachments creds, region, invalid server, invalid volume and device
assert
:
that
:
-
rax_cbs_attachments|failed
-
rax_cbs_attachments.msg == 'No matching storage volumes were found'
# ============================================================
# ============================================================
-
name
:
Build Volume for rax_cbs_attachments test
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-rax_cbs_attachments"
wait
:
true
register
:
rax_cbs
-
name
:
Validate volume build
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
-
rax_cbs.volume.display_name == "{{ resource_prefix }}-rax_cbs_attachments"
# ============================================================
# ============================================================
-
name
:
Build CloudServer for rax_cbs_attachments tests
rax
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-rax_cbs_attachments"
wait
:
true
register
:
rax
-
name
:
Validate CloudServer build
assert
:
that
:
-
rax|success
-
rax|changed
-
rax.action == 'create'
-
rax.instances|length == 1
-
rax.instances[0].name == "{{ resource_prefix }}-rax_cbs_attachments"
# ============================================================
# ============================================================
-
name
:
Test rax_cbs_attachments with creds, region, invalid server, volume and device
rax_cbs_attachments
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
server
:
'
1234'
volume
:
"
{{
rax_cbs.volume.id
}}"
device
:
/dev/xvde
ignore_errors
:
true
register
:
rax_cbs_attachments
-
name
:
Validate rax_cbs_attachments creds, region, invalid server, volume and device
assert
:
that
:
-
rax_cbs_attachments|failed
-
rax_cbs_attachments.msg == 'No Server was matched by name, try using the Server ID instead'
# ============================================================
# ============================================================
-
name
:
Test rax_cbs_attachments with creds, region, server, volume and device (valid)
rax_cbs_attachments
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
server
:
"
{{
rax.instances[0].id
}}"
volume
:
"
{{
rax_cbs.volume.id
}}"
device
:
/dev/xvde
wait
:
true
register
:
rax_cbs_attachments
-
name
:
Validate rax_cbs_attachments creds, region, server, volume and device (valid)
assert
:
that
:
-
rax_cbs_attachments|success
-
rax_cbs_attachments|changed
-
rax_cbs_attachments.volume.attachments.0.device == '/dev/xvde'
-
rax_cbs_attachments.volume.attachments.0.server_id == "{{ rax.instances[0].id }}"
-
name
:
Idempotent present test
rax_cbs_attachments
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
server
:
"
{{
rax.instances[0].id
}}"
volume
:
"
{{
rax_cbs.volume.id
}}"
device
:
/dev/xvde
wait
:
true
register
:
rax_cbs_attachments
-
name
:
Validate idempotent present test
assert
:
that
:
-
rax_cbs_attachments|success
-
not rax_cbs_attachments|changed
-
name
:
Unattach volume
rax_cbs_attachments
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
server
:
"
{{
rax.instances[0].id
}}"
volume
:
"
{{
rax_cbs.volume.id
}}"
device
:
/dev/xvde
wait
:
true
state
:
absent
register
:
rax_cbs_attachments
-
name
:
Validate unattach volume
assert
:
that
:
-
rax_cbs_attachments|success
-
rax_cbs_attachments|changed
-
rax_cbs_attachments.volume.attachments == []
-
name
:
Idempotent absent test
rax_cbs_attachments
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
server
:
"
{{
rax.instances[0].id
}}"
volume
:
"
{{
rax_cbs.volume.id
}}"
device
:
/dev/xvde
wait
:
true
state
:
absent
register
:
rax_cbs_attachments
-
name
:
Validate idempotent absent test
assert
:
that
:
-
rax_cbs_attachments|success
-
not rax_cbs_attachments|changed
# ============================================================
# ============================================================
-
name
:
Delete test volume
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
rax_cbs.volume.id
}}"
state
:
absent
register
:
rax_cbs
-
name
:
Validate delete integration 6
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
# ============================================================
# ============================================================
-
name
:
"
Delete
CloudServer"
rax
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
instance_ids
:
"
{{
rax.instances[0].id
}}"
state
:
absent
wait
:
true
register
:
rax
-
name
:
"
Validate
delete"
assert
:
that
:
-
rax|changed
-
rax|success
-
rax.action == 'delete'
# ============================================================
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment