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
1408a014
Commit
1408a014
authored
Dec 11, 2014
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9764 from bcoca/moar_tests
Moar tests
parents
d36d76c7
0ce5d2c8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
8 deletions
+31
-8
test/integration/roles/test_conditionals/tasks/main.yml
+4
-0
test/integration/roles/test_lookups/tasks/main.yml
+20
-8
test/integration/vars_file.yml
+7
-0
No files found.
test/integration/roles/test_conditionals/tasks/main.yml
View file @
1408a014
...
...
@@ -293,3 +293,7 @@
that
:
-
result.results|length == 3
-
result.results[1].skipped
-
name
:
test complex templated condition
debug
:
msg="it works"
when
:
vars_file_var in things1|union([vars_file_var])
test/integration/roles/test_lookups/tasks/main.yml
View file @
1408a014
...
...
@@ -81,7 +81,7 @@
-
"
wc_result.stdout
==
'9'"
-
"
cat_result.stdout
==
newpass"
# ENV LOOKUP
# ENV LOOKUP
-
name
:
get first environment var name
shell
:
env | head -n1 | cut -d\= -f1
...
...
@@ -92,16 +92,16 @@
register
:
known_var_value
-
name
:
use env lookup to get known var
set_fact
:
set_fact
:
test_val
:
"
{{
lookup('env',
known_var_name.stdout)
}}"
-
debug
:
var=known_var_name.stdout
-
debug
:
var=known_var_value.stdout
-
debug
:
var=test_val
-
debug
:
var=test_val
-
name
:
compare values
assert
:
that
:
that
:
-
"
test_val
==
known_var_value.stdout"
...
...
@@ -109,11 +109,23 @@
# https://github.com/ansible/ansible/issues/6550
-
name
:
confirm pipe lookup works with a single positional arg
debug
:
msg="{{ lookup('pipe', 'ls') }}"
debug
:
msg="{{ lookup('pipe', 'ls') }}"
# https://github.com/ansible/ansible/issues/6550
-
name
:
confirm pipe lookup works with multiple positional args
debug
:
msg="{{ lookup('pipe', 'ls -l /tmp') }}"
# LOOKUP TEMPLATING
-
name
:
use bare interpolation
debug
:
msg="got {{item}}"
with_items
:
things1
register
:
bare_var
-
name
:
verify that list was interpolated
assert
:
that
:
-
"
bare_var.results[0].item
==
1"
-
"
bare_var.results[1].item
==
2"
-
name
:
use list with undefined var in it
debug
:
msg={{item}}
with_items
:
things2
test/integration/vars_file.yml
View file @
1408a014
...
...
@@ -2,4 +2,11 @@
# in general define test data in the individual role:
# roles/role_name/vars/main.yml
foo
:
"
Hello"
things1
:
-
1
-
2
things2
:
-
"
{{
foo
}}"
-
"
{{
foob
}}"
vars_file_var
:
321
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