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
5a862328
Commit
5a862328
authored
Jan 15, 2015
by
Matt Martz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test_rax_clb_nodes
parent
b151c7ff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
247 additions
and
0 deletions
+247
-0
test/integration/rackspace.yml
+3
-0
test/integration/roles/test_rax_clb_nodes/defaults/main.yml
+3
-0
test/integration/roles/test_rax_clb_nodes/tasks/main.yml
+241
-0
No files found.
test/integration/rackspace.yml
View file @
5a862328
...
...
@@ -10,3 +10,6 @@
-
role
:
test_rax_clb
tags
:
test_rax_clb
-
role
:
test_rax_clb_nodes
tags
:
test_rax_clb_nodes
test/integration/roles/test_rax_clb_nodes/defaults/main.yml
0 → 100644
View file @
5a862328
---
rackspace_region
:
IAD
resource_prefix
:
ansible-testing
test/integration/roles/test_rax_clb_nodes/tasks/main.yml
0 → 100644
View file @
5a862328
---
-
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_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
# ============================================================
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