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
3ae1014f
Commit
3ae1014f
authored
Jan 19, 2015
by
Matt Martz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for rax_cbs
parent
f01ae9f5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
365 additions
and
5 deletions
+365
-5
test/integration/cleanup_rax.py
+13
-0
test/integration/rackspace.yml
+3
-5
test/integration/roles/test_rax_cbs/meta/main.yml
+3
-0
test/integration/roles/test_rax_cbs/tasks/main.yml
+346
-0
No files found.
test/integration/cleanup_rax.py
View file @
3ae1014f
...
@@ -114,6 +114,18 @@ def delete_rax_network(args):
...
@@ -114,6 +114,18 @@ def delete_rax_network(args):
args
.
assumeyes
)
args
.
assumeyes
)
def
delete_rax_cbs
(
args
):
"""Function for deleting Cloud Networks"""
print
(
"--- Cleaning Cloud Block Storage matching '
%
s'"
%
args
.
match_re
)
for
region
in
pyrax
.
identity
.
services
.
network
.
regions
:
cbs
=
pyrax
.
connect_to_cloud_blockstorage
(
region
=
region
)
for
volume
in
cbs
.
list
():
if
re
.
search
(
args
.
match_re
,
volume
.
name
):
prompt_and_delete
(
volume
,
'Delete matching
%
s? [y/n]: '
%
volume
,
args
.
assumeyes
)
def
main
():
def
main
():
if
not
HAS_PYRAX
:
if
not
HAS_PYRAX
:
raise
SystemExit
(
'The pyrax python module is required for this script'
)
raise
SystemExit
(
'The pyrax python module is required for this script'
)
...
@@ -124,6 +136,7 @@ def main():
...
@@ -124,6 +136,7 @@ def main():
delete_rax_clb
(
args
)
delete_rax_clb
(
args
)
delete_rax_keypair
(
args
)
delete_rax_keypair
(
args
)
delete_rax_network
(
args
)
delete_rax_network
(
args
)
delete_rax_cbs
(
args
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
test/integration/rackspace.yml
View file @
3ae1014f
...
@@ -5,11 +5,6 @@
...
@@ -5,11 +5,6 @@
tags
:
tags
:
-
rackspace
-
rackspace
roles
:
roles
:
-
role
:
prepare_rax_tests
tags
:
-
prepare
-
prepare_rax_tests
-
role
:
test_rax
-
role
:
test_rax
tags
:
test_rax
tags
:
test_rax
...
@@ -30,3 +25,6 @@
...
@@ -30,3 +25,6 @@
-
role
:
test_rax_network
-
role
:
test_rax_network
tags
:
test_rax_network
tags
:
test_rax_network
-
role
:
test_rax_cbs
tags
:
test_rax_cbs
test/integration/roles/test_rax_cbs/meta/main.yml
0 → 100644
View file @
3ae1014f
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_cbs/tasks/main.yml
0 → 100644
View file @
3ae1014f
# ============================================================
-
name
:
Test rax_cbs with no args
rax_cbs
:
ignore_errors
:
true
register
:
rax_cbs
-
name
:
Validate results of rax_cbs with no args
assert
:
that
:
-
rax_cbs|failed
-
rax_cbs.msg == 'missing required arguments
:
name'
# ============================================================
# ============================================================
-
name
:
Test rax_cbs with name
rax_cbs
:
name
:
fail
ignore_errors
:
true
register
:
rax_cbs
-
name
:
Validate results of rax_cbs with no args
assert
:
that
:
-
rax_cbs|failed
-
rax_cbs.msg == 'No credentials supplied!'
# ============================================================
# ============================================================
-
name
:
Test rax_cbs with name and credentials
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
name
:
fail
ignore_errors
:
true
register
:
rax_cbs
-
name
:
Validate results of rax_cbs with name and credentials
assert
:
that
:
-
rax_cbs|failed
-
rax_cbs.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
-
name
:
Test rax_cbs with creds, region, name and public_key string
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-1"
wait
:
true
register
:
rax_cbs
-
name
:
Validate rax_cbs creds, region and name
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
-
rax_cbs.volume.display_name == "{{ resource_prefix }}-1"
-
rax_cbs.volume.attachments == []
-
rax_cbs.volume.size == 100
-
rax_cbs.volume.volume_type == 'SATA'
-
rax_cbs.volume.status == 'available'
-
name
:
Delete integration 1
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-1"
state
:
absent
register
:
rax_cbs
-
name
:
Validate delete integration 1
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
-
rax_cbs.volume.display_name == "{{ resource_prefix }}-1"
# ============================================================
# ============================================================
-
name
:
Test rax_cbs with creds, region, name and invalid size
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
fail
size
:
1
ignore_errors
:
true
register
:
rax_cbs
-
name
:
Validate rax_cbs creds, region, name and invalid size
assert
:
that
:
-
rax_cbs|failed
-
rax_cbs.msg == '"size" must be greater than or equal to 100'
# ============================================================
# ============================================================
-
name
:
Test rax_cbs with creds, region, name and valid size
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-2"
size
:
150
wait
:
true
register
:
rax_cbs
-
name
:
Validate rax_cbs creds, region and valid size
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
-
rax_cbs.volume.display_name == "{{ resource_prefix }}-2"
-
rax_cbs.volume.attachments == []
-
rax_cbs.volume.size == 150
-
rax_cbs.volume.volume_type == 'SATA'
-
rax_cbs.volume.status == 'available'
-
name
:
Delete integration 2
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-2"
state
:
absent
register
:
rax_cbs
-
name
:
Validate delete integration 2
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
-
rax_cbs.volume.display_name == "{{ resource_prefix }}-2"
# ============================================================
# ============================================================
-
name
:
Test rax_cbs with creds, region, name and invalid volume_type
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
fail
volume_type
:
fail
ignore_errors
:
true
register
:
rax_cbs
-
name
:
Validate rax_cbs creds, region, name and invalid volume_type
assert
:
that
:
-
rax_cbs|failed
-
"
rax_cbs.msg
==
'value
of
volume_type
must
be
one
of:
SSD,SATA,
got:
fail'"
# ============================================================
# ============================================================
-
name
:
Test rax_cbs with creds, region, name and valid volume_size
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-3"
volume_type
:
SSD
wait
:
true
register
:
rax_cbs
-
name
:
Validate rax_cbs creds, region and valid volume_size
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
-
rax_cbs.volume.display_name == "{{ resource_prefix }}-3"
-
rax_cbs.volume.attachments == []
-
rax_cbs.volume.size == 100
-
rax_cbs.volume.volume_type == 'SSD'
-
rax_cbs.volume.status == 'available'
-
name
:
Delete integration 3
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-3"
state
:
absent
register
:
rax_cbs
-
name
:
Validate delete integration 3
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
-
rax_cbs.volume.display_name == "{{ resource_prefix }}-3"
# ============================================================
# ============================================================
-
name
:
Test rax_cbs with creds, region, name and description
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-4"
description
:
"
{{
resource_prefix
}}-4
description"
wait
:
true
register
:
rax_cbs
-
name
:
Validate rax_cbs creds, region and description
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
-
rax_cbs.volume.display_name == "{{ resource_prefix }}-4"
-
rax_cbs.volume.description == '{{ resource_prefix }}-4 description'
-
rax_cbs.volume.attachments == []
-
rax_cbs.volume.size == 100
-
rax_cbs.volume.volume_type == 'SATA'
-
rax_cbs.volume.status == 'available'
-
name
:
Delete integration 4
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-4"
state
:
absent
register
:
rax_cbs
-
name
:
Validate delete integration 4
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
-
rax_cbs.volume.display_name == "{{ resource_prefix }}-4"
# ============================================================
# ============================================================
-
name
:
Test rax_cbs with creds, region, name and meta
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-5"
meta
:
foo
:
bar
wait
:
true
register
:
rax_cbs
-
name
:
Validate rax_cbs creds, region and meta
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
-
rax_cbs.volume.display_name == "{{ resource_prefix }}-5"
-
rax_cbs.volume.attachments == []
-
rax_cbs.volume.size == 100
-
rax_cbs.volume.volume_type == 'SATA'
-
rax_cbs.volume.status == 'available'
-
rax_cbs.volume.metadata.foo == 'bar'
-
name
:
Delete integration 5
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-5"
state
:
absent
register
:
rax_cbs
-
name
:
Validate delete integration 5
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
-
rax_cbs.volume.display_name == "{{ resource_prefix }}-5"
# ============================================================
# ============================================================
-
name
:
Test rax_cbs with idempotency 1
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-6"
wait
:
true
register
:
rax_cbs_1
-
name
:
Validate rax_cbs with idempotency 1
assert
:
that
:
-
rax_cbs_1|success
-
rax_cbs_1|changed
-
rax_cbs_1.volume.display_name == "{{ resource_prefix }}-6"
-
name
:
Test rax_cbs with idempotency 2
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-6"
register
:
rax_cbs_2
-
name
:
Validate rax_cbs with idempotency 2
assert
:
that
:
-
rax_cbs_2|success
-
not rax_cbs_2|changed
-
rax_cbs_2.volume.display_name == "{{ resource_prefix }}-6"
-
rax_cbs_2.volume.id == rax_cbs_1.volume.id
-
name
:
Delete integration 6
rax_cbs
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-6"
state
:
absent
register
:
rax_cbs
-
name
:
Validate delete integration 6
assert
:
that
:
-
rax_cbs|success
-
rax_cbs|changed
-
rax_cbs.volume.name == "{{ resource_prefix }}-6"
# ============================================================
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