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
340b845c
Commit
340b845c
authored
Jan 16, 2015
by
Matt Martz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test_rax_facts
parent
dab9c305
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
285 additions
and
0 deletions
+285
-0
test/integration/rackspace.yml
+3
-0
test/integration/roles/test_rax_facts/meta/main.yml
+3
-0
test/integration/roles/test_rax_facts/tasks/main.yml
+279
-0
No files found.
test/integration/rackspace.yml
View file @
340b845c
...
...
@@ -13,6 +13,9 @@
-
role
:
test_rax
tags
:
test_rax
-
role
:
test_rax_facts
tags
:
test_rax_facts
-
role
:
test_rax_clb
tags
:
test_rax_clb
...
...
test/integration/roles/test_rax_facts/meta/main.yml
0 → 100644
View file @
340b845c
dependencies
:
-
prepare_tests
-
prepare_rax_tests
test/integration/roles/test_rax_facts/tasks/main.yml
0 → 100644
View file @
340b845c
# ============================================================
-
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"
# ============================================================
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