Update unit tests for flush_handlers fix

pull/11699/head
James Cammarata 9 years ago
parent 4b6525fb58
commit 993ce592b1

@ -77,19 +77,37 @@ class TestPlayIterator(unittest.TestCase):
all_vars=dict(),
)
# pre task
(host_state, task) = itr.get_next_task_for_host(hosts[0])
print(task)
self.assertIsNotNone(task)
self.assertEqual(task.action, 'debug')
# implicit meta: flush_handlers
(host_state, task) = itr.get_next_task_for_host(hosts[0])
print(task)
self.assertIsNotNone(task)
self.assertEqual(task.action, 'meta')
# role task
(host_state, task) = itr.get_next_task_for_host(hosts[0])
print(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])
print(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])
print(task)
self.assertIsNone(task)

@ -117,7 +117,7 @@ class TestPlay(unittest.TestCase):
roles=['foo'],
), loader=fake_loader)
tasks = p.compile()
blocks = p.compile()
def test_play_compile(self):
p = Play.load(dict(
@ -127,6 +127,8 @@ class TestPlay(unittest.TestCase):
tasks=[dict(action='shell echo "hello world"')],
))
tasks = p.compile()
self.assertEqual(len(tasks), 1)
self.assertIsInstance(tasks[0], Block)
blocks = p.compile()
# with a single block, there will still be three
# implicit meta flush_handler blocks inserted
self.assertEqual(len(blocks), 4)

Loading…
Cancel
Save