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
9fe0b883
Commit
9fe0b883
authored
Feb 11, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10220 from sivel/more-rax-tests
More integration tests for rax modules
parents
78888922
be6e49dd
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
3521 additions
and
82 deletions
+3521
-82
test/integration/cleanup_rax.py
+87
-2
test/integration/rackspace.yml
+33
-0
test/integration/roles/prepare_rax_tests/defaults/main.yml
+10
-0
test/integration/roles/test_rax/defaults/main.yml
+0
-3
test/integration/roles/test_rax/meta/main.yml
+3
-0
test/integration/roles/test_rax/tasks/main.yml
+115
-77
test/integration/roles/test_rax_cbs/meta/main.yml
+3
-0
test/integration/roles/test_rax_cbs/tasks/main.yml
+346
-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
test/integration/roles/test_rax_cdb/meta/main.yml
+3
-0
test/integration/roles/test_rax_cdb/tasks/main.yml
+270
-0
test/integration/roles/test_rax_cdb_database/meta/main.yml
+3
-0
test/integration/roles/test_rax_cdb_database/tasks/main.yml
+215
-0
test/integration/roles/test_rax_clb/meta/main.yml
+3
-0
test/integration/roles/test_rax_clb/tasks/main.yml
+857
-0
test/integration/roles/test_rax_clb_nodes/meta/main.yml
+3
-0
test/integration/roles/test_rax_clb_nodes/tasks/main.yml
+232
-0
test/integration/roles/test_rax_facts/meta/main.yml
+3
-0
test/integration/roles/test_rax_facts/tasks/main.yml
+279
-0
test/integration/roles/test_rax_identity/meta/main.yml
+3
-0
test/integration/roles/test_rax_identity/tasks/main.yml
+51
-0
test/integration/roles/test_rax_keypair/meta/main.yml
+3
-0
test/integration/roles/test_rax_keypair/tasks/main.yml
+245
-0
test/integration/roles/test_rax_meta/meta/main.yml
+3
-0
test/integration/roles/test_rax_meta/tasks/main.yml
+334
-0
test/integration/roles/test_rax_network/meta/main.yml
+3
-0
test/integration/roles/test_rax_network/tasks/main.yml
+158
-0
No files found.
test/integration/cleanup_rax.py
View file @
9fe0b883
#!/usr/bin/env python
import
os
import
re
import
yaml
import
argparse
...
...
@@ -11,6 +12,19 @@ except ImportError:
HAS_PYRAX
=
False
def
rax_list_iterator
(
svc
,
*
args
,
**
kwargs
):
method
=
kwargs
.
pop
(
'method'
,
'list'
)
items
=
getattr
(
svc
,
method
)(
*
args
,
**
kwargs
)
while
items
:
retrieved
=
getattr
(
svc
,
method
)(
*
args
,
marker
=
items
[
-
1
]
.
id
,
**
kwargs
)
if
items
and
retrieved
and
items
[
-
1
]
.
id
==
retrieved
[
0
]
.
id
:
del
items
[
-
1
]
items
.
extend
(
retrieved
)
if
len
(
retrieved
)
<
2
:
break
return
items
def
parse_args
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'-y'
,
'--yes'
,
action
=
'store_true'
,
dest
=
'assumeyes'
,
...
...
@@ -53,23 +67,94 @@ def prompt_and_delete(item, prompt, assumeyes):
def
delete_rax
(
args
):
"""Function for deleting CloudServers"""
print
(
"--- Cleaning CloudServers matching '
%
s'"
%
args
.
match_re
)
search_opts
=
dict
(
name
=
'^
%
s'
%
args
.
match_re
)
for
region
in
pyrax
.
identity
.
services
.
compute
.
regions
:
cs
=
pyrax
.
connect_to_cloudservers
(
region
=
region
)
servers
=
cs
.
servers
.
list
(
search_opts
=
dict
(
name
=
'^
%
s'
%
args
.
match_re
)
)
servers
=
rax_list_iterator
(
cs
.
servers
,
search_opts
=
search_opts
)
for
server
in
servers
:
prompt_and_delete
(
server
,
'Delete matching
%
s? [y/n]: '
%
server
,
args
.
assumeyes
)
def
delete_rax_clb
(
args
):
"""Function for deleting Cloud Load Balancers"""
print
(
"--- Cleaning Cloud Load Balancers matching '
%
s'"
%
args
.
match_re
)
for
region
in
pyrax
.
identity
.
services
.
load_balancer
.
regions
:
clb
=
pyrax
.
connect_to_cloud_loadbalancers
(
region
=
region
)
for
lb
in
rax_list_iterator
(
clb
):
if
re
.
search
(
args
.
match_re
,
lb
.
name
):
prompt_and_delete
(
lb
,
'Delete matching
%
s? [y/n]: '
%
lb
,
args
.
assumeyes
)
def
delete_rax_keypair
(
args
):
"""Function for deleting Rackspace Key pairs"""
print
(
"--- Cleaning Key Pairs matching '
%
s'"
%
args
.
match_re
)
for
region
in
pyrax
.
identity
.
services
.
compute
.
regions
:
cs
=
pyrax
.
connect_to_cloudservers
(
region
=
region
)
for
keypair
in
cs
.
keypairs
.
list
():
if
re
.
search
(
args
.
match_re
,
keypair
.
name
):
prompt_and_delete
(
keypair
,
'Delete matching
%
s? [y/n]: '
%
keypair
,
args
.
assumeyes
)
def
delete_rax_network
(
args
):
"""Function for deleting Cloud Networks"""
print
(
"--- Cleaning Cloud Networks matching '
%
s'"
%
args
.
match_re
)
for
region
in
pyrax
.
identity
.
services
.
network
.
regions
:
cnw
=
pyrax
.
connect_to_cloud_networks
(
region
=
region
)
for
network
in
cnw
.
list
():
if
re
.
search
(
args
.
match_re
,
network
.
name
):
prompt_and_delete
(
network
,
'Delete matching
%
s? [y/n]: '
%
network
,
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
delete_rax_cdb
(
args
):
"""Function for deleting Cloud Databases"""
print
(
"--- Cleaning Cloud Databases matching '
%
s'"
%
args
.
match_re
)
for
region
in
pyrax
.
identity
.
services
.
database
.
regions
:
cdb
=
pyrax
.
connect_to_cloud_databases
(
region
=
region
)
for
db
in
rax_list_iterator
(
cdb
):
if
re
.
search
(
args
.
match_re
,
db
.
name
):
prompt_and_delete
(
db
,
'Delete matching
%
s? [y/n]: '
%
db
,
args
.
assumeyes
)
def
main
():
if
not
HAS_PYRAX
:
raise
SystemExit
(
'The pyrax python module is required for this script'
)
args
=
parse_args
()
authenticate
()
delete_rax
(
args
)
funcs
=
[
f
for
n
,
f
in
globals
()
.
items
()
if
n
.
startswith
(
'delete_rax'
)]
for
func
in
sorted
(
funcs
,
key
=
lambda
f
:
f
.
__name__
):
try
:
func
(
args
)
except
Exception
as
e
:
print
(
"----
%
s failed (
%
s)"
%
(
func
.
__name__
,
e
.
message
))
if
__name__
==
'__main__'
:
try
:
main
()
except
KeyboardInterrupt
:
print
(
'
\n
Exiting...'
)
test/integration/rackspace.yml
View file @
9fe0b883
...
...
@@ -7,3 +7,36 @@
roles
:
-
role
:
test_rax
tags
:
test_rax
-
role
:
test_rax_facts
tags
:
test_rax_facts
-
role
:
test_rax_meta
tags
:
test_rax_meta
-
role
:
test_rax_keypair
tags
:
test_rax_keypair
-
role
:
test_rax_clb
tags
:
test_rax_clb
-
role
:
test_rax_clb_nodes
tags
:
test_rax_clb_nodes
-
role
:
test_rax_network
tags
:
test_rax_network
-
role
:
test_rax_cbs
tags
:
test_rax_cbs
-
role
:
test_rax_cbs_attachments
tags
:
test_rax_cbs_attachments
-
role
:
test_rax_identity
tags
:
test_rax_identity
-
role
:
test_rax_cdb
tags
:
test_rax_cdb
-
role
:
test_rax_cdb_database
tags
:
test_rax_cdb_database
test/integration/roles/prepare_rax_tests/defaults/main.yml
0 → 100644
View file @
9fe0b883
---
rackspace_region
:
IAD
rackspace_image_human_id
:
"
ubuntu-1404-lts-trusty-tahr-pvhvm"
rackspace_image_id
:
"
753a7703-4960-488b-aab4-a3cdd4b276dc"
rackspace_image_name
:
"
Ubuntu
14.04
LTS
(Trusty
Tahr)
(PVHVM)"
rackspace_flavor
:
"
performance1-1"
rackspace_keypair_pub
:
"
ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAABAQDymofzvt86DUA6XSSxc7eDHwUNvcOSmUWjB76jFvhYc6PbS5QmTzBtCka1ORdaW0Z2i3EjfFvzA8WvuY3qP/FpIVDL25ZqZHgxSfGN5pbJ2tAeXK165kNPXBuuISrMhmdLFbRZNn6PwKHEmtrtfEQ3w6ay9+MhqlEr0OX2r6bCXLj+f50QnQXamU6Fm4IpkTsb60osvHNi569Dd8cADEv92oLZpNMa8/MPGnlipjauhzNtEDTUeZwtrAQUXe6CzJ0QmIlyKDglDZLuAKU/VRumo1FRsn4AwJnVsbP2CHBPkbNoYt6LhQiQqXypEIWGmIln0dlO6gZTr3dYC4BVGREl"
resource_prefix
:
ansible-testing
test/integration/roles/test_rax/defaults/main.yml
deleted
100644 → 0
View file @
78888922
---
rackspace_region
:
IAD
resource_prefix
:
ansible-testing
test/integration/roles/test_rax/meta/main.yml
0 → 100644
View file @
9fe0b883
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax/tasks/main.yml
View file @
9fe0b883
---
-
name
:
Check for required variables
assert
:
that
:
-
resource_prefix is defined and resource_prefix
-
rackspace_username is defined and rackspace_username
-
rackspace_api_key is defined and rackspace_api_key
-
rackspace_region is defined and rackspace_region
# ============================================================
-
name
:
Test rax with no args
rax
:
...
...
@@ -63,7 +54,7 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
image
:
"
{{
rackspace_image_id
}}"
ignore_errors
:
true
register
:
rax
...
...
@@ -82,8 +73,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
ignore_errors
:
true
register
:
rax
...
...
@@ -102,8 +93,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-1"
register
:
rax
...
...
@@ -123,8 +114,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-1"
state
:
absent
wait
:
true
...
...
@@ -146,8 +137,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-2"
wait
:
true
register
:
rax
...
...
@@ -168,8 +159,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-2"
wait
:
true
register
:
rax
...
...
@@ -189,8 +180,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-2"
state
:
absent
wait
:
true
...
...
@@ -214,8 +205,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-3"
meta
:
foo
:
bar
...
...
@@ -239,8 +230,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-3"
meta
:
foo
:
bar
...
...
@@ -262,8 +253,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-3"
state
:
absent
meta
:
...
...
@@ -289,8 +280,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-4"
count
:
2
wait
:
true
...
...
@@ -310,8 +301,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-4"
count
:
2
wait
:
true
...
...
@@ -331,8 +322,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-4"
count
:
3
wait
:
true
...
...
@@ -352,8 +343,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-4"
count
:
3
state
:
absent
...
...
@@ -378,8 +369,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-5-%02d"
count
:
2
group
:
"
{{
resource_prefix
}}-5"
...
...
@@ -401,8 +392,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-5-%02d"
count
:
2
group
:
"
{{
resource_prefix
}}-5"
...
...
@@ -428,8 +419,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-6-%02d"
count
:
2
group
:
"
{{
resource_prefix
}}-6"
...
...
@@ -451,8 +442,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-6-%02d"
count
:
2
group
:
"
{{
resource_prefix
}}-6"
...
...
@@ -473,8 +464,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-6-%02d"
count
:
4
group
:
"
{{
resource_prefix
}}-6"
...
...
@@ -500,8 +491,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-7-%02d"
count
:
2
exact_count
:
true
...
...
@@ -524,8 +515,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-7-%02d"
count
:
2
exact_count
:
true
...
...
@@ -547,8 +538,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-7-%02d"
count
:
4
exact_count
:
true
...
...
@@ -572,8 +563,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-7-%02d"
count
:
0
exact_count
:
true
...
...
@@ -599,8 +590,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-8"
count
:
2
group
:
"
{{
resource_prefix
}}-8"
...
...
@@ -623,8 +614,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-8"
count
:
2
group
:
"
{{
resource_prefix
}}-8"
...
...
@@ -651,8 +642,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-9"
count
:
2
exact_count
:
true
...
...
@@ -675,8 +666,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-9"
count
:
0
exact_count
:
true
...
...
@@ -702,8 +693,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-10-%03d"
count
:
2
count_offset
:
10
...
...
@@ -727,8 +718,8 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-10-%03d"
count
:
0
count_offset
:
10
...
...
@@ -755,13 +746,13 @@
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
name
:
"
{{
resource_prefix
}}-1
0
-%03d"
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-1
1
-%03d"
count
:
2
count_offset
:
10
exact_count
:
true
group
:
"
{{
resource_prefix
}}-1
0
"
group
:
"
{{
resource_prefix
}}-1
1
"
wait
:
true
register
:
rax
...
...
@@ -773,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 }}-1
0-010', '{{ resource_prefix }}-10
-011']
-
rax.instances|map(attribute='rax_name')|unique|list|sort == ['{{ resource_prefix }}-1
1-010', '{{ resource_prefix }}-11
-011']
-
name
:
"
Test
delete
integration
1
0
"
-
name
:
"
Test
delete
integration
1
1
"
rax
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
ubuntu-1204-lts-precise-pangolin
flavor
:
performance1-1
name
:
"
{{
resource_prefix
}}-1
0
-%03d"
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-1
1
-%03d"
count
:
0
count_offset
:
10
exact_count
:
true
group
:
"
{{
resource_prefix
}}-1
0
"
group
:
"
{{
resource_prefix
}}-1
1
"
wait
:
true
register
:
rax
-
name
:
"
Validate
delete
integration
1
0
"
-
name
:
"
Validate
delete
integration
1
1
"
assert
:
that
:
-
rax|success
...
...
@@ -799,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
# ============================================================
test/integration/roles/test_rax_cbs/meta/main.yml
0 → 100644
View file @
9fe0b883
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_cbs/tasks/main.yml
0 → 100644
View file @
9fe0b883
# ============================================================
-
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"
# ============================================================
test/integration/roles/test_rax_cbs_attachments/meta/main.yml
0 → 100644
View file @
9fe0b883
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_cbs_attachments/tasks/main.yml
0 → 100644
View file @
9fe0b883
# ============================================================
-
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'
# ============================================================
test/integration/roles/test_rax_cdb/meta/main.yml
0 → 100644
View file @
9fe0b883
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_cdb/tasks/main.yml
0 → 100644
View file @
9fe0b883
# ============================================================
-
name
:
Test rax_cdb with no args
rax_cdb
:
ignore_errors
:
true
register
:
rax_cdb
-
name
:
Validate results of rax_cdb with no args
assert
:
that
:
-
rax_cdb|failed
-
rax_cdb.msg == 'missing required arguments
:
name'
# ============================================================
# ============================================================
-
name
:
Test rax_cdb with name
rax_cdb
:
name
:
fail
ignore_errors
:
true
register
:
rax_cdb
-
name
:
Validate results of rax_cdb with only creds
assert
:
that
:
-
rax_cdb|failed
-
rax_cdb.msg == 'No credentials supplied!'
# ============================================================
# ============================================================
-
name
:
Test rax_cdb with name and credentials
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
name
:
fail
ignore_errors
:
true
register
:
rax_cdb
-
name
:
Validate results of rax_cdb with only creds
assert
:
that
:
-
rax_cdb|failed
-
rax_cdb.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
-
name
:
Test rax_cdb with creds and region
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
ignore_errors
:
true
register
:
rax_cdb
-
name
:
Validate rax_cdb creds and region
assert
:
that
:
-
rax_cdb|failed
-
rax_cdb.msg == 'missing required arguments
:
name'
# ============================================================
# ============================================================
-
name
:
Test rax_cdb with creds, region and name
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-1"
wait
:
true
register
:
rax_cdb
-
name
:
Validate rax_cdb with creds, region and name
assert
:
that
:
-
rax_cdb|success
-
rax_cdb|changed
-
rax_cdb.cdb.name == '{{ resource_prefix }}-1'
-
rax_cdb.cdb.hostname
-
rax_cdb.cdb.status == 'ACTIVE'
-
name
:
"
Delete
integration
1"
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-1"
state
:
absent
wait
:
true
register
:
rax_cdb
-
name
:
"
Validate
delete
integration
1"
assert
:
that
:
-
rax_cdb|success
-
rax_cdb|changed
-
rax_cdb.cdb.name == "{{ resource_prefix }}-1"
# ============================================================
# ============================================================
-
name
:
Test rax_cdb idempotent test 1
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-2"
wait
:
true
register
:
rax_cdb
-
name
:
Validate rax_cdb idempotent test 1
assert
:
that
:
-
rax_cdb|success
-
rax_cdb|changed
-
rax_cdb.cdb.name == "{{ resource_prefix }}-2"
-
rax_cdb.cdb.status == 'ACTIVE'
-
name
:
Test rax_cdb idempotent test 2
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-2"
wait
:
true
register
:
rax_cdb
-
name
:
Validate rax_cdb idempotent test 2
assert
:
that
:
-
rax_cdb|success
-
not rax_cdb|changed
-
rax_cdb.cdb.name == "{{ resource_prefix }}-2"
-
rax_cdb.cdb.status == 'ACTIVE'
-
name
:
"
Delete
integration
2"
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-2"
state
:
absent
wait
:
true
register
:
rax_cdb
-
name
:
"
Validate
delete
integration
2"
assert
:
that
:
-
rax_cdb|changed
-
rax_cdb.cdb.name == "{{ resource_prefix }}-2"
# ============================================================
# ============================================================
-
name
:
Test rax_cdb resize volume 1
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-3"
wait
:
true
register
:
rax_cdb
-
name
:
Validate rax_cdb resize volume 1
assert
:
that
:
-
rax_cdb|success
-
rax_cdb|changed
-
rax_cdb.cdb.name == "{{ resource_prefix }}-3"
-
rax_cdb.cdb.status == 'ACTIVE'
-
name
:
Test rax_cdb resize volume 2
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-3"
volume
:
3
wait
:
true
wait_timeout
:
600
register
:
rax_cdb
-
name
:
Validate rax_cdb resize volume 2
assert
:
that
:
-
rax_cdb|success
-
rax_cdb|changed
-
rax_cdb.cdb.name == "{{ resource_prefix }}-3"
-
rax_cdb.cdb.status == 'ACTIVE'
-
name
:
"
Delete
integration
3"
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-3"
state
:
absent
wait
:
true
register
:
rax_cdb
-
name
:
"
Validate
delete
integration
3"
assert
:
that
:
-
rax_cdb|changed
-
rax_cdb.cdb.name == "{{ resource_prefix }}-3"
# ============================================================
# ============================================================
-
name
:
Test rax_cdb resize flavor 1
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-4"
wait
:
true
register
:
rax_cdb
-
name
:
Validate rax_cdb resize flavor 1
assert
:
that
:
-
rax_cdb|success
-
rax_cdb|changed
-
rax_cdb.cdb.name == "{{ resource_prefix }}-4"
-
rax_cdb.cdb.status == 'ACTIVE'
-
name
:
Test rax_cdb resize flavor 2
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-4"
flavor
:
2
wait
:
true
wait_timeout
:
600
register
:
rax_cdb
-
name
:
Validate rax_cdb resize flavor 2
assert
:
that
:
-
rax_cdb|success
-
rax_cdb|changed
-
rax_cdb.cdb.name == "{{ resource_prefix }}-4"
-
rax_cdb.cdb.status == 'ACTIVE'
-
name
:
"
Delete
integration
4"
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-4"
state
:
absent
wait
:
true
register
:
rax_cdb
-
name
:
"
Validate
delete
integration
4"
assert
:
that
:
-
rax_cdb|changed
-
rax_cdb.cdb.name == "{{ resource_prefix }}-4"
# ============================================================
test/integration/roles/test_rax_cdb_database/meta/main.yml
0 → 100644
View file @
9fe0b883
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_cdb_database/tasks/main.yml
0 → 100644
View file @
9fe0b883
# ============================================================
-
name
:
Test rax_cdb_database with no args
rax_cdb_database
:
ignore_errors
:
true
register
:
rax_cdb_database
-
name
:
Validate results of rax_cdb_database with no args
assert
:
that
:
-
rax_cdb_database|failed
-
rax_cdb_database.msg == 'missing required arguments
:
name,cdb_id'
# ============================================================
# ============================================================
-
name
:
Test rax_cdb_database with name
rax_cdb_database
:
name
:
fail
ignore_errors
:
true
register
:
rax_cdb_database
-
name
:
Validate results of rax_cdb_database with name
assert
:
that
:
-
rax_cdb_database|failed
-
rax_cdb_database.msg == 'missing required arguments
:
cdb_id'
# ============================================================
# ============================================================
-
name
:
Test rax_cdb_database with name and cdb_id
rax_cdb_database
:
name
:
fail
cdb_id
:
'
1234'
ignore_errors
:
true
register
:
rax_cdb_database
-
name
:
Validate results of rax_cdb_database with name and cdb_id
assert
:
that
:
-
rax_cdb_database|failed
-
rax_cdb_database.msg == 'No credentials supplied!'
# ============================================================
# ============================================================
-
name
:
Test rax_cdb_database with name, cdb_id and creds
rax_cdb_database
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
name
:
fail
cdb_id
:
'
1234'
ignore_errors
:
true
register
:
rax_cdb_database
-
name
:
Validate results of rax_cdb_database with name, cdb_id and creds
assert
:
that
:
-
rax_cdb_database|failed
-
rax_cdb_database.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
-
name
:
Test rax_cdb_database with name, invalid cdb_id, creds and region
rax_cdb_database
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
fail
cdb_id
:
'
1234'
ignore_errors
:
true
register
:
rax_cdb_database
-
name
:
Validate rax_cdb_database name, invalid cdb_id, creds and region
assert
:
that
:
-
rax_cdb_database|failed
# ============================================================
# ============================================================
-
name
:
Build Cloud Database for testing
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-rax_cdb_database"
wait
:
true
register
:
rax_cdb
-
name
:
Validate build
assert
:
that
:
-
rax_cdb|success
-
rax_cdb|changed
-
rax_cdb.cdb.name == '{{ resource_prefix }}-rax_cdb_database'
-
rax_cdb.cdb.status == 'ACTIVE'
# ============================================================
# ============================================================
-
name
:
Test rax_cdb_database with name, cdb_id, creds and region
rax_cdb_database
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-1"
cdb_id
:
"
{{
rax_cdb.cdb.id
}}"
register
:
rax_cdb_database
-
name
:
Validate rax_cdb_database name, cdb_id, creds and region
assert
:
that
:
-
rax_cdb_database|success
-
rax_cdb_database|changed
-
rax_cdb_database.database.name == "{{ resource_prefix }}-1"
-
name
:
Delete integration 1
rax_cdb_database
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-1"
cdb_id
:
"
{{
rax_cdb.cdb.id
}}"
state
:
absent
register
:
rax_cdb_database
-
name
:
Validate delete integration 1
assert
:
that
:
-
rax_cdb_database|success
-
rax_cdb_database|changed
-
rax_cdb_database.database.name == "{{ resource_prefix }}-1"
# ============================================================
# ============================================================
-
name
:
Test rax_cdb_database idempotency 1
rax_cdb_database
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-2"
cdb_id
:
"
{{
rax_cdb.cdb.id
}}"
register
:
rax_cdb_database
-
name
:
Validate rax_cdb_database idempotency 1
assert
:
that
:
-
rax_cdb_database|success
-
rax_cdb_database|changed
-
rax_cdb_database.database.name == "{{ resource_prefix }}-2"
-
name
:
Test rax_cdb_database idempotency 2
rax_cdb_database
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-2"
cdb_id
:
"
{{
rax_cdb.cdb.id
}}"
register
:
rax_cdb_database
-
name
:
Validate rax_cdb_database idempotency 2
assert
:
that
:
-
rax_cdb_database|success
-
not rax_cdb_database|changed
-
rax_cdb_database.database.name == "{{ resource_prefix }}-2"
-
name
:
Delete integration 2
rax_cdb_database
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-2"
cdb_id
:
"
{{
rax_cdb.cdb.id
}}"
state
:
absent
register
:
rax_cdb_database
-
name
:
Validate delete integration 2
assert
:
that
:
-
rax_cdb_database|success
-
rax_cdb_database|changed
-
rax_cdb_database.database.name == "{{ resource_prefix }}-2"
# ============================================================
# ============================================================
-
name
:
Delete Cloud Database
rax_cdb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-rax_cdb_database"
state
:
absent
wait
:
true
register
:
rax_cdb
-
name
:
Validate Delete
assert
:
that
:
-
rax_cdb|success
-
rax_cdb|changed
-
rax_cdb.cdb.name == "{{ resource_prefix }}-rax_cdb_database"
# ============================================================
test/integration/roles/test_rax_clb/meta/main.yml
0 → 100644
View file @
9fe0b883
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_clb/tasks/main.yml
0 → 100644
View file @
9fe0b883
# ============================================================
-
name
:
Test rax_clb with no args
rax_clb
:
ignore_errors
:
true
register
:
rax_clb
-
name
:
Validate results of rax_clb with no args
assert
:
that
:
-
rax_clb|failed
-
rax_clb.msg == 'missing required arguments
:
name'
# ============================================================
# ============================================================
-
name
:
Test rax_clb with name
rax_clb
:
name
:
fail
ignore_errors
:
true
register
:
rax_clb
-
name
:
Validate results of rax_clb with only creds
assert
:
that
:
-
rax_clb|failed
-
rax_clb.msg == 'No credentials supplied!'
# ============================================================
# ============================================================
-
name
:
Test rax_clb with name and credentials
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
name
:
fail
ignore_errors
:
true
register
:
rax_clb
-
name
:
Validate results of rax_clb with only creds
assert
:
that
:
-
rax_clb|failed
-
rax_clb.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
-
name
:
Test rax_clb with creds and region
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
ignore_errors
:
true
register
:
rax_clb
-
name
:
Validate rax_clb creds and region
assert
:
that
:
-
rax_clb|failed
-
rax_clb.msg == 'missing required arguments
:
name'
# ============================================================
# ============================================================
-
name
:
Test rax_clb with creds, region and name
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-1"
wait
:
true
register
:
rax_clb
-
name
:
Validate rax_clb with creds, region and name
assert
:
that
:
-
rax_clb|success
-
rax_clb.balancer.port == 80
-
rax_clb.balancer.protocol == 'HTTP'
-
rax_clb.balancer.timeout == 30
-
rax_clb.balancer.virtual_ips.0.type == 'PUBLIC'
-
rax_clb.balancer.metadata is not defined
-
rax_clb.balancer.status == 'ACTIVE'
-
rax_clb.balancer.algorithm == 'LEAST_CONNECTIONS'
-
name
:
"
Delete
integration
1"
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-1"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
1"
assert
:
that
:
-
rax_clb|changed
-
rax_clb.balancer.name == "{{ resource_prefix }}-1"
# ============================================================
# ============================================================
-
name
:
Test rax_clb with creds, region, name and protocol
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-2"
protocol
:
TCP
wait
:
true
register
:
rax_clb
-
name
:
Validate rax_clb with creds, region, name and protocol
assert
:
that
:
-
rax_clb|success
-
rax_clb.balancer.port == 80
-
rax_clb.balancer.protocol == 'TCP'
-
rax_clb.balancer.timeout == 30
-
rax_clb.balancer.virtual_ips.0.type == 'PUBLIC'
-
rax_clb.balancer.metadata is not defined
-
rax_clb.balancer.status == 'ACTIVE'
-
name
:
"
Delete
integration
2"
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-2"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
2"
assert
:
that
:
-
rax_clb|changed
-
rax_clb.balancer.name == "{{ resource_prefix }}-2"
# ============================================================
# ============================================================
-
name
:
Test rax_clb with creds, region, name, protocol and port
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-3"
protocol
:
TCP
port
:
8080
wait
:
true
register
:
rax_clb
-
name
:
Validate rax_clb with creds, region, name, protocol and port
assert
:
that
:
-
rax_clb|success
-
rax_clb.balancer.port == 8080
-
rax_clb.balancer.protocol == 'TCP'
-
rax_clb.balancer.timeout == 30
-
rax_clb.balancer.virtual_ips.0.type == 'PUBLIC'
-
rax_clb.balancer.metadata is not defined
-
rax_clb.balancer.status == 'ACTIVE'
-
name
:
"
Delete
integration
3"
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-3"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
3"
assert
:
that
:
-
rax_clb|changed
-
rax_clb.balancer.name == "{{ resource_prefix }}-3"
# ============================================================
# ============================================================
-
name
:
Test rax_clb with creds, region, name, protocol, port and type
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-4"
protocol
:
TCP
port
:
8080
type
:
SERVICENET
wait
:
true
register
:
rax_clb
-
name
:
Validate rax_clb with creds, region, name, protocol and type
assert
:
that
:
-
rax_clb|success
-
rax_clb.balancer.port == 8080
-
rax_clb.balancer.protocol == 'TCP'
-
rax_clb.balancer.timeout == 30
-
rax_clb.balancer.virtual_ips.0.type == 'SERVICENET'
-
rax_clb.balancer.metadata is not defined
-
rax_clb.balancer.status == 'ACTIVE'
-
name
:
"
Delete
integration
4"
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-4"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
4"
assert
:
that
:
-
rax_clb|changed
-
rax_clb.balancer.name == "{{ resource_prefix }}-4"
# ============================================================
# ============================================================
-
name
:
Test rax_clb with invalid timeout
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-fail"
protocol
:
TCP
port
:
8080
type
:
SERVICENET
timeout
:
1
wait
:
true
ignore_errors
:
true
register
:
rax_clb
-
name
:
Validate rax_clb with invalid timeout
assert
:
that
:
-
rax_clb|failed
-
rax_clb.msg == '"timeout" must be greater than or equal to 30'
# ============================================================
# ============================================================
-
name
:
Test rax_clb with creds, region, name, protocol, port, type and timeout
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-5"
protocol
:
TCP
port
:
8080
type
:
SERVICENET
timeout
:
60
wait
:
true
register
:
rax_clb
-
name
:
Validate rax_clb with creds, region, name, protocol, type and timeout
assert
:
that
:
-
rax_clb|success
-
rax_clb.balancer.port == 8080
-
rax_clb.balancer.protocol == 'TCP'
-
rax_clb.balancer.timeout == 60
-
rax_clb.balancer.virtual_ips.0.type == 'SERVICENET'
-
rax_clb.balancer.metadata is not defined
-
rax_clb.balancer.status == 'ACTIVE'
-
name
:
"
Delete
integration
5"
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-5"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
5"
assert
:
that
:
-
rax_clb|changed
-
rax_clb.balancer.name == "{{ resource_prefix }}-5"
# ============================================================
# ============================================================
-
name
:
Test rax_clb with creds, region, name, protocol, port, type, timeout and algorithm
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-6"
protocol
:
TCP
port
:
8080
type
:
SERVICENET
timeout
:
60
algorithm
:
RANDOM
wait
:
true
register
:
rax_clb
-
name
:
Validate rax_clb with creds, region, name, protocol, type, timeout and algorithm
assert
:
that
:
-
rax_clb|success
-
rax_clb.balancer.port == 8080
-
rax_clb.balancer.protocol == 'TCP'
-
rax_clb.balancer.timeout == 60
-
rax_clb.balancer.virtual_ips.0.type == 'SERVICENET'
-
rax_clb.balancer.metadata is not defined
-
rax_clb.balancer.status == 'ACTIVE'
-
rax_clb.balancer.algorithm == 'RANDOM'
-
name
:
"
Delete
integration
6"
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-6"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
6"
assert
:
that
:
-
rax_clb|changed
-
rax_clb.balancer.name == "{{ resource_prefix }}-6"
# ============================================================
# ============================================================
-
name
:
Test rax_clb with invalid type
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-fail"
type
:
BAD
timeout
:
1
wait
:
true
ignore_errors
:
true
register
:
rax_clb
-
name
:
Validate rax_clb with invalid timeout
assert
:
that
:
-
rax_clb|failed
-
"
rax_clb.msg
==
'value
of
type
must
be
one
of:
PUBLIC,SERVICENET,
got:
BAD'"
# ============================================================
# ============================================================
-
name
:
Test rax_clb with invalid protocol
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-fail"
protocol
:
BAD
timeout
:
1
wait
:
true
ignore_errors
:
true
register
:
rax_clb
-
name
:
Validate rax_clb with invalid timeout
assert
:
that
:
-
rax_clb|failed
-
"
rax_clb.msg
==
'value
of
protocol
must
be
one
of:
DNS_TCP,DNS_UDP,FTP,HTTP,HTTPS,IMAPS,IMAPv4,LDAP,LDAPS,MYSQL,POP3,POP3S,SMTP,TCP,TCP_CLIENT_FIRST,UDP,UDP_STREAM,SFTP,
got:
BAD'"
# ============================================================
# ============================================================
-
name
:
Test rax_clb with invalid algorithm
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-fail"
algorithm
:
BAD
timeout
:
1
wait
:
true
ignore_errors
:
true
register
:
rax_clb
-
name
:
Validate rax_clb with invalid timeout
assert
:
that
:
-
rax_clb|failed
-
"
rax_clb.msg
==
'value
of
algorithm
must
be
one
of:
RANDOM,LEAST_CONNECTIONS,ROUND_ROBIN,WEIGHTED_LEAST_CONNECTIONS,WEIGHTED_ROUND_ROBIN,
got:
BAD'"
# ============================================================
# ============================================================
-
name
:
Test rax_clb with creds, region, name, protocol, port, type, timeout, algorithm and metadata
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-7"
protocol
:
TCP
port
:
8080
type
:
SERVICENET
timeout
:
60
algorithm
:
RANDOM
meta
:
foo
:
bar
wait
:
true
register
:
rax_clb
-
name
:
Validate rax_clb with creds, region, name, protocol, type, timeout, algorithm and metadata
assert
:
that
:
-
rax_clb|success
-
rax_clb.balancer.port == 8080
-
rax_clb.balancer.protocol == 'TCP'
-
rax_clb.balancer.timeout == 60
-
rax_clb.balancer.virtual_ips.0.type == 'SERVICENET'
-
rax_clb.balancer.status == 'ACTIVE'
-
rax_clb.balancer.algorithm == 'RANDOM'
-
rax_clb.balancer.metadata.0.key == 'foo'
-
rax_clb.balancer.metadata.0.value == 'bar'
-
name
:
"
Delete
integration
7"
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-7"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
7"
assert
:
that
:
-
rax_clb|changed
-
rax_clb.balancer.name == "{{ resource_prefix }}-7"
# ============================================================
# ============================================================
-
name
:
Test rax_clb with shared VIP HTTP
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-8-HTTP"
wait
:
true
register
:
rax_clb_http
-
name
:
Validate rax_clb with shared VIP HTTP
assert
:
that
:
-
rax_clb_http|success
-
rax_clb_http.balancer.protocol == 'HTTP'
-
rax_clb_http.balancer.virtual_ips.0.type == 'PUBLIC'
-
rax_clb_http.balancer.status == 'ACTIVE'
-
name
:
Test rax_clb with shared VIP HTTPS
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-8-HTTPS"
protocol
:
HTTPS
port
:
443
wait
:
true
vip_id
:
"
{{
(rax_clb_http.balancer.virtual_ips|first).id
}}"
register
:
rax_clb_https
-
name
:
Validate Test rax_clb with shared VIP
assert
:
that
:
-
rax_clb_https|success
-
rax_clb_https.balancer.protocol == 'HTTPS'
-
rax_clb_https.balancer.status == 'ACTIVE'
-
rax_clb_http.balancer.virtual_ips == rax_clb_https.balancer.virtual_ips
-
name
:
"
Delete
integration
8
HTTP"
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-8-HTTP"
state
:
absent
wait
:
true
register
:
rax_clb_http
-
name
:
"
Delete
integration
8
HTTPS"
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-8-HTTPS"
state
:
absent
wait
:
true
register
:
rax_clb_http
-
name
:
"
Validate
delete
integration
8"
assert
:
that
:
-
rax_clb_http|changed
-
rax_clb_https|changed
# ============================================================
# ============================================================
-
name
:
Test rax_clb with updated protocol 1
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-9"
wait
:
true
register
:
rax_clb_p1
-
name
:
Validate rax_clb with updated protocol 1
assert
:
that
:
-
rax_clb_p1|success
-
rax_clb_p1.balancer.protocol == 'HTTP'
-
rax_clb_p1.balancer.virtual_ips.0.type == 'PUBLIC'
-
rax_clb_p1.balancer.status == 'ACTIVE'
-
name
:
Test rax_clb with updated protocol 2
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-9"
protocol
:
TCP
wait
:
true
register
:
rax_clb_p2
-
name
:
Validate rax_clb with updated protocol 2
assert
:
that
:
-
rax_clb_p1.balancer.id == rax_clb_p2.balancer.id
-
rax_clb_p2|success
-
rax_clb_p2|changed
-
rax_clb_p2.balancer.protocol == 'TCP'
-
rax_clb_p2.balancer.status == 'ACTIVE'
-
name
:
Delete integration 9
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-9"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
9"
assert
:
that
:
-
rax_clb|changed
# ============================================================
# ============================================================
-
name
:
Test rax_clb with updated algorithm 1
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-10"
wait
:
true
register
:
rax_clb_a1
-
name
:
Validate rax_clb with updated algorithm 1
assert
:
that
:
-
rax_clb_a1|success
-
rax_clb_a1.balancer.algorithm == 'LEAST_CONNECTIONS'
-
rax_clb_a1.balancer.status == 'ACTIVE'
-
name
:
Test rax_clb with updated algoritm 2
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-10"
algorithm
:
RANDOM
wait
:
true
register
:
rax_clb_a2
-
name
:
Validate rax_clb with updated algorithm 2
assert
:
that
:
-
rax_clb_a1.balancer.id == rax_clb_a2.balancer.id
-
rax_clb_a2|success
-
rax_clb_a2|changed
-
rax_clb_a2.balancer.algorithm == 'RANDOM'
-
rax_clb_a2.balancer.status == 'ACTIVE'
-
name
:
Delete integration 10
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-10"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
10"
assert
:
that
:
-
rax_clb|changed
-
rax_clb_a1.balancer.id == rax_clb.balancer.id
# ============================================================
# ============================================================
-
name
:
Test rax_clb with updated port 1
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-11"
wait
:
true
register
:
rax_clb_1
-
name
:
Validate rax_clb with updated port 1
assert
:
that
:
-
rax_clb_1|success
-
rax_clb_1.balancer.port == 80
-
rax_clb_1.balancer.status == 'ACTIVE'
-
name
:
Test rax_clb with updated port 2
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-11"
port
:
8080
wait
:
true
register
:
rax_clb_2
-
name
:
Validate rax_clb with updated port 2
assert
:
that
:
-
rax_clb_1.balancer.id == rax_clb_2.balancer.id
-
rax_clb_2|success
-
rax_clb_2|changed
-
rax_clb_2.balancer.port == 8080
-
rax_clb_2.balancer.status == 'ACTIVE'
-
name
:
Delete integration 11
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-11"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
11"
assert
:
that
:
-
rax_clb|changed
-
rax_clb_1.balancer.id == rax_clb.balancer.id
# ============================================================
# ============================================================
-
name
:
Test rax_clb with updated timeout 1
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-12"
wait
:
true
register
:
rax_clb_1
-
name
:
Validate rax_clb with updated timeout 1
assert
:
that
:
-
rax_clb_1|success
-
rax_clb_1.balancer.timeout == 30
-
rax_clb_1.balancer.status == 'ACTIVE'
-
name
:
Test rax_clb with updated timeout 2
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-12"
timeout
:
60
wait
:
true
register
:
rax_clb_2
-
name
:
Validate rax_clb with updated timeout 2
assert
:
that
:
-
rax_clb_1.balancer.id == rax_clb_2.balancer.id
-
rax_clb_2|success
-
rax_clb_2|changed
-
rax_clb_2.balancer.timeout == 60
-
rax_clb_2.balancer.status == 'ACTIVE'
-
name
:
Delete integration 12
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-12"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
12"
assert
:
that
:
-
rax_clb|changed
-
rax_clb_1.balancer.id == rax_clb.balancer.id
# ============================================================
# ============================================================
-
name
:
Test rax_clb with invalid updated type 1
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-13"
wait
:
true
register
:
rax_clb_1
-
name
:
Validate rax_clb with invalid updated type 1
assert
:
that
:
-
rax_clb_1|success
-
rax_clb_1.balancer.status == 'ACTIVE'
-
name
:
Test rax_clb with invalid updated type 2
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-13"
type
:
SERVICENET
wait
:
true
register
:
rax_clb_2
ignore_errors
:
true
-
name
:
Validate rax_clb with updated timeout 2
assert
:
that
:
-
rax_clb_2|failed
-
rax_clb_2.msg == 'Load balancer Virtual IP type cannot be changed'
-
name
:
Delete integration 13
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-13"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
13"
assert
:
that
:
-
rax_clb|changed
-
rax_clb_1.balancer.id == rax_clb.balancer.id
# ============================================================
# ============================================================
-
name
:
Test rax_clb with updated meta 1
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-14"
wait
:
true
register
:
rax_clb_1
-
name
:
Validate rax_clb with updated meta 1
assert
:
that
:
-
rax_clb_1|success
-
rax_clb_1.balancer.status == 'ACTIVE'
-
rax_clb_1.balancer.metadata is not defined
-
name
:
Test rax_clb with updated meta 2
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-14"
meta
:
foo
:
bar
wait
:
true
register
:
rax_clb_2
-
name
:
Validate rax_clb with updated meta 2
assert
:
that
:
-
rax_clb_1.balancer.id == rax_clb_2.balancer.id
-
rax_clb_2|success
-
rax_clb_2|changed
-
rax_clb_2.balancer.metadata.0.key == 'foo'
-
rax_clb_2.balancer.metadata.0.value == 'bar'
-
rax_clb_2.balancer.status == 'ACTIVE'
-
name
:
Delete integration 14
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-14"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
14"
assert
:
that
:
-
rax_clb|changed
-
rax_clb_1.balancer.id == rax_clb.balancer.id
# ============================================================
test/integration/roles/test_rax_clb_nodes/meta/main.yml
0 → 100644
View file @
9fe0b883
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_clb_nodes/tasks/main.yml
0 → 100644
View file @
9fe0b883
# ============================================================
-
name
:
Test rax_clb_nodes with no args
rax_clb_nodes
:
ignore_errors
:
true
register
:
rax_clb_nodes
-
name
:
Validate results of rax_clb_nodes with no args
assert
:
that
:
-
rax_clb_nodes|failed
-
rax_clb_nodes.msg == 'missing required arguments
:
load_balancer_id'
# ============================================================
# ============================================================
-
name
:
Test rax_clb_nodes with load_balancer_Id
rax_clb_nodes
:
load_balancer_id
:
1234
ignore_errors
:
true
register
:
rax_clb_nodes
-
name
:
Validate results of rax_clb_nodes with load_balancer_id
assert
:
that
:
-
rax_clb_nodes|failed
-
rax_clb_nodes.msg == 'No credentials supplied!'
# ============================================================
# ============================================================
-
name
:
Test rax_clb_nodes with credentials and load_balancer_id
rax_clb_nodes
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
load_balancer_id
:
1234
ignore_errors
:
true
register
:
rax_clb_nodes
-
name
:
Validate results of rax_clb_nodes with credentials and load_balancer_id
assert
:
that
:
-
rax_clb_nodes|failed
-
rax_clb_nodes.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
-
name
:
Test rax_clb_nodes with creds, region and load_balancer_id
rax_clb_nodes
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
load_balancer_id
:
1234
ignore_errors
:
true
register
:
rax_clb_nodes
-
name
:
Validate rax_clb_nodes creds, region and load_balancer_id
assert
:
that
:
-
rax_clb_nodes|failed
-
rax_clb_nodes.msg == 'Load balancer not found'
# ============================================================
# ============================================================
-
name
:
Build a CLB to test rax_clb_nodes with
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-clb"
wait
:
true
register
:
rax_clb
-
name
:
Validate rax_clb creation
assert
:
that
:
-
rax_clb|success
-
name
:
Set variable for CLB ID
set_fact
:
rax_clb_id
:
"
{{
rax_clb.balancer.id
}}"
# ============================================================
# ============================================================
-
name
:
Test rax_clb_nodes with creds, region and valid load_balancer_id
rax_clb_nodes
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
load_balancer_id
:
"
{{
rax_clb_id
}}"
ignore_errors
:
true
register
:
rax_clb_nodes
-
name
:
Validate rax_clb_nodes creds, region and valid load_balancer_id
assert
:
that
:
-
rax_clb_nodes|failed
-
rax_clb_nodes.msg == 'You must include an address and a port when creating a node.'
# ============================================================
# ============================================================
-
name
:
Test rax_clb_nodes with creds, region, load_balancer_id and address
rax_clb_nodes
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
load_balancer_id
:
"
{{
rax_clb_id
}}"
address
:
'
10.10.10.10'
ignore_errors
:
true
register
:
rax_clb_nodes
-
name
:
Validate rax_clb_nodes creds, region, load_balancer_id and address
assert
:
that
:
-
rax_clb_nodes|failed
-
rax_clb_nodes.msg == 'You must include an address and a port when creating a node.'
# ============================================================
# ============================================================
-
name
:
Test rax_clb_nodes with creds, region, load_balancer_id, invalid address and port
rax_clb_nodes
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
load_balancer_id
:
"
{{
rax_clb_id
}}"
address
:
'
10.10.10.10'
port
:
80
ignore_errors
:
true
register
:
rax_clb_nodes
-
name
:
Validate rax_clb_nodes creds, region, load_balancer_id, invalid address and port
assert
:
that
:
-
rax_clb_nodes|failed
-
rax_clb_nodes.msg == "Invalid node address. The address '10.10.10.10' is currently not accepted for this request."
# ============================================================
# ============================================================
-
name
:
Test rax_clb_nodes with creds, region, load_balancer_id, address and port
rax_clb_nodes
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
load_balancer_id
:
"
{{
rax_clb_id
}}"
address
:
'
172.16.0.1'
port
:
80
wait
:
true
register
:
rax_clb_nodes
-
name
:
Validate rax_clb_nodes creds, region, load_balancer_id, address and port
assert
:
that
:
-
rax_clb_nodes|success
-
rax_clb_nodes.node.address == '172.16.0.1'
-
rax_clb_nodes.node.condition == 'ENABLED'
-
rax_clb_nodes.node.port == 80
-
rax_clb_nodes.node.status == 'ONLINE'
-
rax_clb_nodes.node.type == 'PRIMARY'
-
rax_clb_nodes.node.weight == 1
-
name
:
Delete integration 1
rax_clb_nodes
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
load_balancer_id
:
"
{{
rax_clb_id
}}"
node_id
:
"
{{
rax_clb_nodes.node.id
}}"
state
:
absent
wait
:
true
register
:
rax_clb_nodes
-
name
:
Validate delete integration 1
assert
:
that
:
-
rax_clb_nodes|success
# ============================================================
# ============================================================
-
name
:
Test rax_clb_nodes with creds, region, load_balancer_id, address, port and type
rax_clb_nodes
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
load_balancer_id
:
"
{{
rax_clb_id
}}"
address
:
'
172.16.0.1'
port
:
80
type
:
secondary
wait
:
true
ignore_errors
:
true
register
:
rax_clb_nodes
-
name
:
Validate rax_clb_nodes creds, region, load_balancer_id, address, port and type
assert
:
that
:
-
rax_clb_nodes|failed
-
rax_clb_nodes.msg == 'you must enable health monitoring to use secondary nodes'
# ============================================================
# ============================================================
-
name
:
Delete CLB
rax_clb
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
rax_clb.balancer.name
}}"
state
:
absent
wait
:
true
register
:
rax_clb
-
name
:
"
Validate
delete
integration
3"
assert
:
that
:
-
rax_clb|changed
-
rax_clb.balancer.id == rax_clb_id|int
# ============================================================
test/integration/roles/test_rax_facts/meta/main.yml
0 → 100644
View file @
9fe0b883
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_facts/tasks/main.yml
0 → 100644
View file @
9fe0b883
# ============================================================
-
name
:
Test rax_facts with no args
rax_facts
:
ignore_errors
:
true
register
:
rax_facts
-
name
:
Validate results of rax_facts with no args
assert
:
that
:
-
rax_facts|failed
-
rax_facts.msg == 'one of the following is required
:
address,id,name'
# ============================================================
# ============================================================
-
name
:
Test rax_facts with credentials and address
rax_facts
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
address
:
'
1.2.3.4'
ignore_errors
:
true
register
:
rax_facts
-
name
:
Validate results of rax_facts with only creds
assert
:
that
:
-
rax_facts|failed
-
rax_facts.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
-
name
:
Test rax_facts with creds, region and address
rax_facts
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
address
:
'
1.2.3.4'
ignore_errors
:
true
register
:
rax_facts
-
name
:
Validate rax_facts creds, region and address
assert
:
that
:
-
rax_facts|success
-
rax_facts.ansible_facts == {}
-
not rax_facts|changed
# ============================================================
# ============================================================
-
name
:
Test rax_facts with creds, region and id
rax_facts
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
id
:
'
1234'
ignore_errors
:
true
register
:
rax_facts
-
name
:
Validate rax_facts creds, region and id
assert
:
that
:
-
rax_facts|success
-
rax_facts.ansible_facts == {}
-
not rax_facts|changed
# ============================================================
# ============================================================
-
name
:
Test rax_facts with creds, region and name
rax_facts
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
'
bad'
ignore_errors
:
true
register
:
rax_facts
-
name
:
Validate rax_facts creds, region and name
assert
:
that
:
-
rax_facts|success
-
rax_facts.ansible_facts == {}
-
not rax_facts|changed
# ============================================================
# ============================================================
-
name
:
Test rax_facts with creds, region, address, id and name
rax_facts
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
address
:
'
1.2.3.4'
id
:
'
1234'
name
:
'
bad'
ignore_errors
:
true
register
:
rax_facts
-
name
:
Validate rax_facts creds, region, address, id and name
assert
:
that
:
-
rax_facts|failed
-
"
rax_facts.msg
==
'parameters
are
mutually
exclusive:
[
\\
'address
\\
',
\\
'id
\\
',
\\
'name
\\
']'"
# ============================================================
# ============================================================
-
name
:
Build CloudServer for rax_facts tests
rax
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-rax_facts"
wait
:
true
register
:
rax
-
name
:
Validate build
assert
:
that
:
-
rax|success
-
rax|changed
-
rax.action == 'create'
-
rax.instances|length == 1
-
rax.instances[0].name == "{{ resource_prefix }}-rax_facts"
# ============================================================
# ============================================================
-
name
:
Test rax_facts with creds, region, and valid public IPv4 address
rax_facts
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
address
:
"
{{
rax.success.0.rax_accessipv4
}}"
register
:
rax_facts
-
name
:
Validate rax_facts creds, region, and valid public IPv4 address
assert
:
that
:
-
rax_facts|success
-
rax_facts.ansible_facts.rax_flavor == rax.success.0.rax_flavor
-
rax_facts.ansible_facts.rax_image == rax.success.0.rax_image
-
rax_facts.ansible_facts.rax_addresses == rax.success.0.rax_addresses
-
rax_facts.ansible_facts.rax_id == rax.success.0.rax_id
-
rax_facts.ansible_facts.rax_name == rax.success.0.rax_name
-
rax_facts.ansible_facts.rax_hostid == rax.success.0.rax_hostid
# ============================================================
# ============================================================
-
name
:
Test rax_facts with creds, region, and valid public IPv6 address
rax_facts
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
address
:
"
{{
rax.success.0.rax_accessipv6
}}"
register
:
rax_facts
-
name
:
Validate rax_facts creds, region, and valid public IPv6 address
assert
:
that
:
-
rax_facts|success
-
rax_facts.ansible_facts.rax_flavor == rax.success.0.rax_flavor
-
rax_facts.ansible_facts.rax_image == rax.success.0.rax_image
-
rax_facts.ansible_facts.rax_addresses == rax.success.0.rax_addresses
-
rax_facts.ansible_facts.rax_id == rax.success.0.rax_id
-
rax_facts.ansible_facts.rax_name == rax.success.0.rax_name
-
rax_facts.ansible_facts.rax_hostid == rax.success.0.rax_hostid
# ============================================================
# ============================================================
-
name
:
Test rax_facts with creds, region, and valid private IPv4 address
rax_facts
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
address
:
"
{{
rax.success.0.rax_networks.private|first
}}"
register
:
rax_facts
-
name
:
Validate rax_facts creds, region, and valid private IPv4 address
assert
:
that
:
-
rax_facts|success
-
rax_facts.ansible_facts.rax_flavor == rax.success.0.rax_flavor
-
rax_facts.ansible_facts.rax_image == rax.success.0.rax_image
-
rax_facts.ansible_facts.rax_addresses == rax.success.0.rax_addresses
-
rax_facts.ansible_facts.rax_id == rax.success.0.rax_id
-
rax_facts.ansible_facts.rax_name == rax.success.0.rax_name
-
rax_facts.ansible_facts.rax_hostid == rax.success.0.rax_hostid
# ============================================================
# ============================================================
-
name
:
Test rax_facts with creds, region, and valid ID
rax_facts
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
id
:
"
{{
rax.success.0.rax_id
}}"
register
:
rax_facts
-
name
:
Validate rax_facts creds, region, and valid ID
assert
:
that
:
-
rax_facts|success
-
rax_facts.ansible_facts.rax_flavor == rax.success.0.rax_flavor
-
rax_facts.ansible_facts.rax_image == rax.success.0.rax_image
-
rax_facts.ansible_facts.rax_addresses == rax.success.0.rax_addresses
-
rax_facts.ansible_facts.rax_id == rax.success.0.rax_id
-
rax_facts.ansible_facts.rax_name == rax.success.0.rax_name
-
rax_facts.ansible_facts.rax_hostid == rax.success.0.rax_hostid
# ============================================================
# ============================================================
-
name
:
Test rax_facts with creds, region, and valid name
rax_facts
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
rax.success.0.rax_name
}}"
register
:
rax_facts
-
name
:
Validate rax_facts creds, region, and valid name
assert
:
that
:
-
rax_facts|success
-
rax_facts.ansible_facts.rax_flavor == rax.success.0.rax_flavor
-
rax_facts.ansible_facts.rax_image == rax.success.0.rax_image
-
rax_facts.ansible_facts.rax_addresses == rax.success.0.rax_addresses
-
rax_facts.ansible_facts.rax_id == rax.success.0.rax_id
-
rax_facts.ansible_facts.rax_name == rax.success.0.rax_name
-
rax_facts.ansible_facts.rax_hostid == rax.success.0.rax_hostid
# ============================================================
# ============================================================
-
name
:
"
Delete
CloudServer"
rax
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-rax_facts"
state
:
absent
wait
:
true
register
:
rax
-
name
:
"
Validate
delete"
assert
:
that
:
-
rax|changed
-
rax|success
-
rax.action == 'delete'
-
rax.success[0].name == "{{ resource_prefix }}-rax_facts"
# ============================================================
test/integration/roles/test_rax_identity/meta/main.yml
0 → 100644
View file @
9fe0b883
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_identity/tasks/main.yml
0 → 100644
View file @
9fe0b883
# ============================================================
-
name
:
Test rax_identity with no args
rax_identity
:
ignore_errors
:
true
register
:
rax_identity
-
name
:
Validate results of rax_identity with no args
assert
:
that
:
-
rax_identity|failed
-
rax_identity.msg == 'No credentials supplied!'
# ============================================================
# ============================================================
-
name
:
Test rax_identity with name and credentials
rax_identity
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
ignore_errors
:
true
register
:
rax_identity
-
name
:
Validate results of rax_identity with name and credentials
assert
:
that
:
-
rax_identity|failed
-
rax_identity.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
-
name
:
Test rax_identity with name and credentials and region
rax_identity
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
register
:
rax_identity
-
name
:
Validate results of rax_identity with name and credentials
assert
:
that
:
-
rax_identity|success
-
not rax_identity|changed
-
rax_identity.identity.region == "{{ rackspace_region }}"
-
rax_identity.identity.username == "{{ rackspace_username }}"
-
rax_identity.identity.authenticated
-
rax_identity.identity.services
-
rax_identity.identity.auth_token
# ============================================================
test/integration/roles/test_rax_keypair/meta/main.yml
0 → 100644
View file @
9fe0b883
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_keypair/tasks/main.yml
0 → 100644
View file @
9fe0b883
# ============================================================
-
name
:
Test rax_keypair with no args
rax_keypair
:
ignore_errors
:
true
register
:
rax_keypair
-
name
:
Validate results of rax_keypair with no args
assert
:
that
:
-
rax_keypair|failed
-
rax_keypair.msg == 'missing required arguments
:
name'
# ============================================================
# ============================================================
-
name
:
Test rax_keypair with name
rax_keypair
:
name
:
fail
ignore_errors
:
true
register
:
rax_keypair
-
name
:
Validate results of rax_keypair with no args
assert
:
that
:
-
rax_keypair|failed
-
rax_keypair.msg == 'No credentials supplied!'
# ============================================================
# ============================================================
-
name
:
Test rax_keypair with name and credentials
rax_keypair
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
name
:
fail
ignore_errors
:
true
register
:
rax_keypair
-
name
:
Validate results of rax_keypair with name and credentials
assert
:
that
:
-
rax_keypair|failed
-
rax_keypair.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
-
name
:
Create public key file for tests
copy
:
content
:
"
{{
rackspace_keypair_pub
}}"
dest
:
"
{{
output_dir|expanduser
}}/{{
resource_prefix
}}.pub"
-
name
:
Set variable for public key path
set_fact
:
rackspace_keypair_pub_path
:
"
{{
output_dir|expanduser
}}/{{
resource_prefix
}}.pub"
# ============================================================
# ============================================================
-
name
:
Test rax_keypair with creds, region, name and public_key string
rax_keypair
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-1"
public_key
:
"
{{
rackspace_keypair_pub
}}"
register
:
rax_keypair
-
name
:
Validate rax_keypair creds, region, name and public_key string
assert
:
that
:
-
rax_keypair|success
-
rax_keypair|changed
-
rax_keypair.keypair.name == "{{ resource_prefix }}-1"
-
rax_keypair.keypair.public_key == "{{ rackspace_keypair_pub }}"
-
name
:
Delete integration 1
rax_keypair
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-1"
public_key
:
"
{{
rackspace_keypair_pub
}}"
state
:
absent
register
:
rax_keypair
-
name
:
Validate delete integration 1
assert
:
that
:
-
rax_keypair|success
-
rax_keypair|changed
-
rax_keypair.keypair.name == "{{ resource_prefix }}-1"
# ============================================================
# ============================================================
-
name
:
Test rax_keypair with creds, region, name and public_key path
rax_keypair
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-2"
public_key
:
"
{{
rackspace_keypair_pub_path
}}"
register
:
rax_keypair
-
name
:
Validate rax_keypair creds, region, name and public_key path
assert
:
that
:
-
rax_keypair|success
-
rax_keypair|changed
-
rax_keypair.keypair.name == "{{ resource_prefix }}-2"
-
rax_keypair.keypair.public_key == "{{ rackspace_keypair_pub }}"
-
name
:
Delete integration 2
rax_keypair
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-2"
public_key
:
"
{{
rackspace_keypair_pub
}}"
state
:
absent
register
:
rax_keypair
-
name
:
Validate delete integration 2
assert
:
that
:
-
rax_keypair|success
-
rax_keypair|changed
-
rax_keypair.keypair.name == "{{ resource_prefix }}-2"
# ============================================================
# ============================================================
-
name
:
Test rax_keypair with idempotency 1
rax_keypair
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-3"
public_key
:
"
{{
rackspace_keypair_pub
}}"
register
:
rax_keypair
-
name
:
Validate rax_keypair with idempotency 1
assert
:
that
:
-
rax_keypair|success
-
rax_keypair|changed
-
rax_keypair.keypair.name == "{{ resource_prefix }}-3"
-
rax_keypair.keypair.public_key == "{{ rackspace_keypair_pub }}"
-
name
:
Test rax_keypair with idempotency 2
rax_keypair
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-3"
public_key
:
"
{{
rackspace_keypair_pub
}}"
register
:
rax_keypair
-
name
:
Validate rax_keypair with idempotency 1
assert
:
that
:
-
rax_keypair|success
-
not rax_keypair|changed
-
rax_keypair.keypair.name == "{{ resource_prefix }}-3"
-
rax_keypair.keypair.public_key == "{{ rackspace_keypair_pub }}"
-
name
:
Delete integration 3
rax_keypair
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-3"
public_key
:
"
{{
rackspace_keypair_pub
}}"
state
:
absent
register
:
rax_keypair
-
name
:
Validate delete integration 3
assert
:
that
:
-
rax_keypair|success
-
rax_keypair|changed
-
rax_keypair.keypair.name == "{{ resource_prefix }}-3"
# ============================================================
# ============================================================
-
name
:
Test rax_keypair with creds, region and name
rax_keypair
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-4"
register
:
rax_keypair
-
name
:
Validate rax_keypair creds, region and name
assert
:
that
:
-
rax_keypair|success
-
rax_keypair|changed
-
rax_keypair.keypair.name == "{{ resource_prefix }}-4"
-
rax_keypair.keypair.private_key is defined
-
rax_keypair.keypair.public_key is defined
-
name
:
Test rax_keypair with creds, region and name idempotency
rax_keypair
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-4"
register
:
rax_keypair
-
name
:
Validate rax_keypair creds, region and name
assert
:
that
:
-
rax_keypair|success
-
not rax_keypair|changed
-
rax_keypair.keypair.name == "{{ resource_prefix }}-4"
-
rax_keypair.keypair.private_key is not defined
-
rax_keypair.keypair.public_key is defined
-
name
:
Delete integration 4
rax_keypair
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
resource_prefix
}}-4"
public_key
:
"
{{
rackspace_keypair_pub
}}"
state
:
absent
register
:
rax_keypair
-
name
:
Validate delete integration 4
assert
:
that
:
-
rax_keypair|success
-
rax_keypair|changed
-
rax_keypair.keypair.name == "{{ resource_prefix }}-4"
# ============================================================
test/integration/roles/test_rax_meta/meta/main.yml
0 → 100644
View file @
9fe0b883
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_meta/tasks/main.yml
0 → 100644
View file @
9fe0b883
# ============================================================
-
name
:
Test rax_meta with no args
rax_meta
:
ignore_errors
:
true
register
:
rax_meta
-
name
:
Validate results of rax_meta with no args
assert
:
that
:
-
rax_meta|failed
-
rax_meta.msg == 'one of the following is required
:
address,id,name'
# ============================================================
# ============================================================
-
name
:
Test rax_meta with credentials and address
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
address
:
'
1.2.3.4'
ignore_errors
:
true
register
:
rax_meta
-
name
:
Validate results of rax_meta with only creds
assert
:
that
:
-
rax_meta|failed
-
rax_meta.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region and address
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
address
:
'
1.2.3.4'
ignore_errors
:
true
register
:
rax_meta
-
name
:
Validate rax_meta creds, region and address
assert
:
that
:
-
rax_meta|failed
-
rax_meta.msg == 'Failed to find a server matching provided search parameters'
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region and id
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
id
:
'
1234'
ignore_errors
:
true
register
:
rax_meta
-
name
:
Validate rax_meta creds, region and id
assert
:
that
:
-
rax_meta|failed
-
rax_meta.msg == 'Failed to find a server matching provided search parameters'
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region and name
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
'
bad'
ignore_errors
:
true
register
:
rax_meta
-
name
:
Validate rax_meta creds, region and name
assert
:
that
:
-
rax_meta|failed
-
rax_meta.msg == 'Failed to find a server matching provided search parameters'
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region, address, id and name
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
address
:
'
1.2.3.4'
id
:
'
1234'
name
:
'
bad'
ignore_errors
:
true
register
:
rax_meta
-
name
:
Validate rax_meta creds, region, address, id and name
assert
:
that
:
-
rax_meta|failed
-
"
rax_meta.msg
==
'parameters
are
mutually
exclusive:
[
\\
'address
\\
',
\\
'id
\\
',
\\
'name
\\
']'"
# ============================================================
# ============================================================
-
name
:
Build CloudServer for rax_meta tests
rax
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
image
:
"
{{
rackspace_image_id
}}"
flavor
:
"
{{
rackspace_flavor
}}"
name
:
"
{{
resource_prefix
}}-rax_meta"
meta
:
foo
:
bar
wait
:
true
register
:
rax
-
name
:
Validate build
assert
:
that
:
-
rax|success
-
rax|changed
-
rax.action == 'create'
-
rax.instances|length == 1
-
rax.instances[0].name == "{{ resource_prefix }}-rax_meta"
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region, and valid public IPv4 address
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
address
:
"
{{
rax.success.0.rax_accessipv4
}}"
register
:
rax_meta
-
name
:
Validate rax_meta creds, region, and valid public IPv4 address
assert
:
that
:
-
rax_meta|success
-
rax_meta.meta == {}
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region, and valid public IPv6 address
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
address
:
"
{{
rax.success.0.rax_accessipv6
}}"
register
:
rax_meta
-
name
:
Validate rax_meta creds, region, and valid public IPv6 address
assert
:
that
:
-
rax_meta|success
-
rax_meta.meta == {}
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region, and valid private IPv4 address
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
address
:
"
{{
rax.success.0.rax_networks.private|first
}}"
register
:
rax_meta
-
name
:
Validate rax_meta creds, region, and valid private IPv4 address
assert
:
that
:
-
rax_meta|success
-
rax_meta.meta == {}
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region, and valid ID
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
id
:
"
{{
rax.success.0.rax_id
}}"
register
:
rax_meta
-
name
:
Validate rax_meta creds, region, and valid ID
assert
:
that
:
-
rax_meta|success
-
rax_meta.meta == {}
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region, and valid name
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
name
:
"
{{
rax.success.0.rax_name
}}"
register
:
rax_meta
-
name
:
Validate rax_meta creds, region, and valid name
assert
:
that
:
-
rax_meta|success
-
rax_meta.meta == {}
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region, and valid ID set foo=bar
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
id
:
"
{{
rax.success.0.rax_id
}}"
meta
:
foo
:
bar
register
:
rax_meta
-
name
:
Validate rax_meta creds, region, and valid ID set foo=bar
assert
:
that
:
-
rax_meta|success
-
rax_meta|changed
-
"
rax_meta.meta
==
{'foo':
'bar'}"
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region, and valid ID set bar=baz
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
id
:
"
{{
rax.success.0.rax_id
}}"
meta
:
bar
:
baz
register
:
rax_meta
-
name
:
Validate rax_meta creds, region, and valid ID set bar=baz
assert
:
that
:
-
rax_meta|success
-
"
rax_meta.meta
==
{'bar':
'baz'}"
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region, and valid ID set bar=baz (idempotent)
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
id
:
"
{{
rax.success.0.rax_id
}}"
meta
:
bar
:
baz
register
:
rax_meta
-
name
:
Validate rax_meta creds, region, and valid ID set bar=baz
assert
:
that
:
-
rax_meta|success
-
not rax_meta|changed
-
"
rax_meta.meta
==
{'bar':
'baz'}"
# ============================================================
# ============================================================
-
name
:
Test rax_meta with creds, region, and valid ID delete meta
rax_meta
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
id
:
"
{{
rax.success.0.rax_id
}}"
register
:
rax_meta
-
name
:
Validate rax_meta creds, region, and valid ID delete meta
assert
:
that
:
-
rax_meta|success
-
rax_meta|changed
-
rax_meta.meta == {}
# ============================================================
# ============================================================
-
name
:
"
Delete
CloudServer"
rax
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
instance_ids
:
-
"
{{
rax.success.0.rax_id
}}"
state
:
absent
wait
:
true
register
:
rax
-
name
:
"
Validate
delete"
assert
:
that
:
-
rax|changed
-
rax|success
-
rax.action == 'delete'
-
rax.success[0].name == "{{ resource_prefix }}-rax_meta"
# ============================================================
test/integration/roles/test_rax_network/meta/main.yml
0 → 100644
View file @
9fe0b883
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_network/tasks/main.yml
0 → 100644
View file @
9fe0b883
# ============================================================
-
name
:
Test rax_network with no args
rax_network
:
ignore_errors
:
true
register
:
rax_network
-
name
:
Validate results of rax_network with no args
assert
:
that
:
-
rax_network|failed
-
rax_network.msg == 'missing required arguments
:
label'
# ============================================================
# ============================================================
-
name
:
Test rax_network with label
rax_network
:
label
:
fail
ignore_errors
:
true
register
:
rax_network
-
name
:
Validate results of rax_network with no args
assert
:
that
:
-
rax_network|failed
-
rax_network.msg == 'No credentials supplied!'
# ============================================================
# ============================================================
-
name
:
Test rax_network with creds
rax_network
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
label
:
fail
ignore_errors
:
true
register
:
rax_network
-
name
:
Validate results of rax_network with creds
assert
:
that
:
-
rax_network|failed
-
rax_network.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
-
name
:
Test rax_network with creds and region
rax_network
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
label
:
fail
ignore_errors
:
true
register
:
rax_network
-
name
:
Validate results of rax_network with creds and region
assert
:
that
:
-
rax_network|failed
-
rax_network.msg == 'missing required arguments
:
cidr'
# ============================================================
# ============================================================
-
name
:
Test rax_network with creds, region and cidr
rax_network
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
cidr
:
"
172.17.141.0/24"
label
:
"
{{
resource_prefix
}}-1"
register
:
rax_network
-
name
:
Validate results of rax_network with creds, region and cidr
assert
:
that
:
-
rax_network|success
-
rax_network|changed
-
rax_network.networks.0.cidr == "172.17.141.0/24"
-
rax_network.networks.0.label == "{{ resource_prefix }}-1"
-
name
:
Delete Integration 1
rax_network
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
label
:
"
{{
resource_prefix
}}-1"
state
:
absent
register
:
rax_network
-
name
:
Validate delete integration 1
assert
:
that
:
-
rax_network|changed
-
rax_network|success
-
rax_network.networks.0.label == "{{ resource_prefix }}-1"
-
rax_network.networks.0.cidr == "172.17.141.0/24"
# ============================================================
# ============================================================
-
name
:
Test rax_network idempotency 1
rax_network
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
cidr
:
"
172.17.142.0/24"
label
:
"
{{
resource_prefix
}}-2"
register
:
rax_network
-
name
:
Validate rax_network idempotency 1
assert
:
that
:
-
rax_network|success
-
rax_network|changed
-
rax_network.networks.0.cidr == "172.17.142.0/24"
-
rax_network.networks.0.label == "{{ resource_prefix }}-2"
-
name
:
Test rax_network idempotency 2
rax_network
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
cidr
:
"
172.17.142.0/24"
label
:
"
{{
resource_prefix
}}-2"
register
:
rax_network
-
name
:
Validate rax_network idempotency 2
assert
:
that
:
-
rax_network|success
-
not rax_network|changed
-
rax_network.networks.0.cidr == "172.17.142.0/24"
-
rax_network.networks.0.label == "{{ resource_prefix }}-2"
-
name
:
Delete Integration 2
rax_network
:
username
:
"
{{
rackspace_username
}}"
api_key
:
"
{{
rackspace_api_key
}}"
region
:
"
{{
rackspace_region
}}"
label
:
"
{{
resource_prefix
}}-2"
state
:
absent
register
:
rax_network
-
name
:
Validate delete integration 2
assert
:
that
:
-
rax_network|changed
-
rax_network|success
-
rax_network.networks.0.label == "{{ resource_prefix }}-2"
-
rax_network.networks.0.cidr == "172.17.142.0/24"
# ============================================================
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