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
993ce592
Commit
993ce592
authored
Jul 22, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update unit tests for flush_handlers fix
parent
4b6525fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
9 deletions
+29
-9
test/units/executor/test_play_iterator.py
+23
-5
test/units/playbook/test_play.py
+6
-4
No files found.
test/units/executor/test_play_iterator.py
View file @
993ce592
...
@@ -77,19 +77,37 @@ class TestPlayIterator(unittest.TestCase):
...
@@ -77,19 +77,37 @@ class TestPlayIterator(unittest.TestCase):
all_vars
=
dict
(),
all_vars
=
dict
(),
)
)
# pre task
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
print
(
task
)
self
.
assertIsNotNone
(
task
)
self
.
assertIsNotNone
(
task
)
self
.
assertEqual
(
task
.
action
,
'debug'
)
# implicit meta: flush_handlers
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
print
(
task
)
self
.
assertIsNotNone
(
task
)
self
.
assertIsNotNone
(
task
)
self
.
assertEqual
(
task
.
action
,
'meta'
)
# role task
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
print
(
task
)
self
.
assertIsNotNone
(
task
)
self
.
assertIsNotNone
(
task
)
self
.
assertEqual
(
task
.
action
,
'debug'
)
self
.
assertIsNotNone
(
task
.
_role
)
# regular play task
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
print
(
task
)
self
.
assertIsNotNone
(
task
)
self
.
assertIsNotNone
(
task
)
self
.
assertEqual
(
task
.
action
,
'debug'
)
self
.
assertIsNone
(
task
.
_role
)
# implicit meta: flush_handlers
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
self
.
assertIsNotNone
(
task
)
self
.
assertEqual
(
task
.
action
,
'meta'
)
# post task
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
self
.
assertIsNotNone
(
task
)
self
.
assertEqual
(
task
.
action
,
'debug'
)
# implicit meta: flush_handlers
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
self
.
assertIsNotNone
(
task
)
self
.
assertEqual
(
task
.
action
,
'meta'
)
# end of iteration
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
(
host_state
,
task
)
=
itr
.
get_next_task_for_host
(
hosts
[
0
])
print
(
task
)
self
.
assertIsNone
(
task
)
self
.
assertIsNone
(
task
)
test/units/playbook/test_play.py
View file @
993ce592
...
@@ -117,7 +117,7 @@ class TestPlay(unittest.TestCase):
...
@@ -117,7 +117,7 @@ class TestPlay(unittest.TestCase):
roles
=
[
'foo'
],
roles
=
[
'foo'
],
),
loader
=
fake_loader
)
),
loader
=
fake_loader
)
tas
ks
=
p
.
compile
()
bloc
ks
=
p
.
compile
()
def
test_play_compile
(
self
):
def
test_play_compile
(
self
):
p
=
Play
.
load
(
dict
(
p
=
Play
.
load
(
dict
(
...
@@ -127,6 +127,8 @@ class TestPlay(unittest.TestCase):
...
@@ -127,6 +127,8 @@ class TestPlay(unittest.TestCase):
tasks
=
[
dict
(
action
=
'shell echo "hello world"'
)],
tasks
=
[
dict
(
action
=
'shell echo "hello world"'
)],
))
))
tasks
=
p
.
compile
()
blocks
=
p
.
compile
()
self
.
assertEqual
(
len
(
tasks
),
1
)
self
.
assertIsInstance
(
tasks
[
0
],
Block
)
# with a single block, there will still be three
# implicit meta flush_handler blocks inserted
self
.
assertEqual
(
len
(
blocks
),
4
)
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