@ -85,16 +85,6 @@ class TestStrategyLinear(unittest.TestCase):
strategy . _hosts_cache = [ h . name for h in hosts ]
strategy . _hosts_cache = [ h . name for h in hosts ]
strategy . _hosts_cache_all = [ h . name for h in hosts ]
strategy . _hosts_cache_all = [ h . name for h in hosts ]
# implicit meta: flush_handlers
hosts_left = strategy . get_hosts_left ( itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
host1_task = hosts_tasks [ 0 ] [ 1 ]
host2_task = hosts_tasks [ 1 ] [ 1 ]
self . assertIsNotNone ( host1_task )
self . assertIsNotNone ( host2_task )
self . assertEqual ( host1_task . action , ' meta ' )
self . assertEqual ( host2_task . action , ' meta ' )
# debug: task1, debug: task1
# debug: task1, debug: task1
hosts_left = strategy . get_hosts_left ( itr )
hosts_left = strategy . get_hosts_left ( itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
@ -110,69 +100,35 @@ class TestStrategyLinear(unittest.TestCase):
# mark the second host failed
# mark the second host failed
itr . mark_host_failed ( hosts [ 1 ] )
itr . mark_host_failed ( hosts [ 1 ] )
# debug: task2, meta: noop
# debug: task2, noop
hosts_left = strategy . get_hosts_left ( itr )
hosts_left = strategy . get_hosts_left ( itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
host1_task = hosts_tasks [ 0 ] [ 1 ]
self . assertEqual ( len ( hosts_tasks ) , 1 )
host2_task = hosts_tasks [ 1 ] [ 1 ]
host , task = hosts_tasks [ 0 ]
self . assertIsNotNone ( host1_task )
self . assertEqual ( host . name , ' host00 ' )
self . assertIsNotNone ( host2_task )
self . assertEqual ( task . action , ' debug ' )
self . assertEqual ( host1_task . action , ' debug ' )
self . assertEqual ( task . name , ' task2 ' )
self . assertEqual ( host2_task . action , ' meta ' )
self . assertEqual ( host1_task . name , ' task2 ' )
self . assertEqual ( host2_task . name , ' ' )
# meta: noop, debug: rescue1
# noop, debug: rescue1
hosts_left = strategy . get_hosts_left ( itr )
hosts_left = strategy . get_hosts_left ( itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
host1_task = hosts_tasks [ 0 ] [ 1 ]
self . assertEqual ( len ( hosts_tasks ) , 1 )
host2_task = hosts_tasks [ 1 ] [ 1 ]
host , task = hosts_tasks [ 0 ]
self . assertIsNotNone ( host1_task )
self . assertEqual ( host . name , ' host01 ' )
self . assertIsNotNone ( host2_task )
self . assertEqual ( task . action , ' debug ' )
self . assertEqual ( host1_task . action , ' meta ' )
self . assertEqual ( task . name , ' rescue1 ' )
self . assertEqual ( host2_task . action , ' debug ' )
self . assertEqual ( host1_task . name , ' ' )
self . assertEqual ( host2_task . name , ' rescue1 ' )
# meta: noop, debug: rescue2
# noop, debug: rescue2
hosts_left = strategy . get_hosts_left ( itr )
hosts_left = strategy . get_hosts_left ( itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
host1_task = hosts_tasks [ 0 ] [ 1 ]
self . assertEqual ( len ( hosts_tasks ) , 1 )
host2_task = hosts_tasks [ 1 ] [ 1 ]
host , task = hosts_tasks [ 0 ]
self . assertIsNotNone ( host1_task )
self . assertEqual ( host . name , ' host01 ' )
self . assertIsNotNone ( host2_task )
self . assertEqual ( task . action , ' debug ' )
self . assertEqual ( host1_task . action , ' meta ' )
self . assertEqual ( task . name , ' rescue2 ' )
self . assertEqual ( host2_task . action , ' debug ' )
self . assertEqual ( host1_task . name , ' ' )
self . assertEqual ( host2_task . name , ' rescue2 ' )
# implicit meta: flush_handlers
hosts_left = strategy . get_hosts_left ( itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
host1_task = hosts_tasks [ 0 ] [ 1 ]
host2_task = hosts_tasks [ 1 ] [ 1 ]
self . assertIsNotNone ( host1_task )
self . assertIsNotNone ( host2_task )
self . assertEqual ( host1_task . action , ' meta ' )
self . assertEqual ( host2_task . action , ' meta ' )
# implicit meta: flush_handlers
hosts_left = strategy . get_hosts_left ( itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
host1_task = hosts_tasks [ 0 ] [ 1 ]
host2_task = hosts_tasks [ 1 ] [ 1 ]
self . assertIsNotNone ( host1_task )
self . assertIsNotNone ( host2_task )
self . assertEqual ( host1_task . action , ' meta ' )
self . assertEqual ( host2_task . action , ' meta ' )
# end of iteration
# end of iteration
hosts_left = strategy . get_hosts_left ( itr )
assert not strategy . _get_next_task_lockstep ( strategy . get_hosts_left ( itr ) , itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
host1_task = hosts_tasks [ 0 ] [ 1 ]
host2_task = hosts_tasks [ 1 ] [ 1 ]
self . assertIsNone ( host1_task )
self . assertIsNone ( host2_task )
def test_noop_64999 ( self ) :
def test_noop_64999 ( self ) :
fake_loader = DictDataLoader ( {
fake_loader = DictDataLoader ( {
@ -240,16 +196,6 @@ class TestStrategyLinear(unittest.TestCase):
strategy . _hosts_cache = [ h . name for h in hosts ]
strategy . _hosts_cache = [ h . name for h in hosts ]
strategy . _hosts_cache_all = [ h . name for h in hosts ]
strategy . _hosts_cache_all = [ h . name for h in hosts ]
# implicit meta: flush_handlers
hosts_left = strategy . get_hosts_left ( itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
host1_task = hosts_tasks [ 0 ] [ 1 ]
host2_task = hosts_tasks [ 1 ] [ 1 ]
self . assertIsNotNone ( host1_task )
self . assertIsNotNone ( host2_task )
self . assertEqual ( host1_task . action , ' meta ' )
self . assertEqual ( host2_task . action , ' meta ' )
# debug: task1, debug: task1
# debug: task1, debug: task1
hosts_left = strategy . get_hosts_left ( itr )
hosts_left = strategy . get_hosts_left ( itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
@ -265,17 +211,14 @@ class TestStrategyLinear(unittest.TestCase):
# mark the second host failed
# mark the second host failed
itr . mark_host_failed ( hosts [ 1 ] )
itr . mark_host_failed ( hosts [ 1 ] )
# meta: noop, debug: rescue1
# noop, debug: rescue1
hosts_left = strategy . get_hosts_left ( itr )
hosts_left = strategy . get_hosts_left ( itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
host1_task = hosts_tasks [ 0 ] [ 1 ]
self . assertEqual ( len ( hosts_tasks ) , 1 )
host2_task = hosts_tasks [ 1 ] [ 1 ]
host , task = hosts_tasks [ 0 ]
self . assertIsNotNone ( host1_task )
self . assertEqual ( host . name , ' host01 ' )
self . assertIsNotNone ( host2_task )
self . assertEqual ( task . action , ' debug ' )
self . assertEqual ( host1_task . action , ' meta ' )
self . assertEqual ( task . name , ' rescue1 ' )
self . assertEqual ( host2_task . action , ' debug ' )
self . assertEqual ( host1_task . name , ' ' )
self . assertEqual ( host2_task . name , ' rescue1 ' )
# debug: after_rescue1, debug: after_rescue1
# debug: after_rescue1, debug: after_rescue1
hosts_left = strategy . get_hosts_left ( itr )
hosts_left = strategy . get_hosts_left ( itr )
@ -289,30 +232,5 @@ class TestStrategyLinear(unittest.TestCase):
self . assertEqual ( host1_task . name , ' after_rescue1 ' )
self . assertEqual ( host1_task . name , ' after_rescue1 ' )
self . assertEqual ( host2_task . name , ' after_rescue1 ' )
self . assertEqual ( host2_task . name , ' after_rescue1 ' )
# implicit meta: flush_handlers
hosts_left = strategy . get_hosts_left ( itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
host1_task = hosts_tasks [ 0 ] [ 1 ]
host2_task = hosts_tasks [ 1 ] [ 1 ]
self . assertIsNotNone ( host1_task )
self . assertIsNotNone ( host2_task )
self . assertEqual ( host1_task . action , ' meta ' )
self . assertEqual ( host2_task . action , ' meta ' )
# implicit meta: flush_handlers
hosts_left = strategy . get_hosts_left ( itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
host1_task = hosts_tasks [ 0 ] [ 1 ]
host2_task = hosts_tasks [ 1 ] [ 1 ]
self . assertIsNotNone ( host1_task )
self . assertIsNotNone ( host2_task )
self . assertEqual ( host1_task . action , ' meta ' )
self . assertEqual ( host2_task . action , ' meta ' )
# end of iteration
# end of iteration
hosts_left = strategy . get_hosts_left ( itr )
assert not strategy . _get_next_task_lockstep ( strategy . get_hosts_left ( itr ) , itr )
hosts_tasks = strategy . _get_next_task_lockstep ( hosts_left , itr )
host1_task = hosts_tasks [ 0 ] [ 1 ]
host2_task = hosts_tasks [ 1 ] [ 1 ]
self . assertIsNone ( host1_task )
self . assertIsNone ( host2_task )