diff options
author | Matt Martz <matt@sivel.net> | 2023-03-23 13:04:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-23 13:04:09 -0500 |
commit | 42355d181a11b51ebfc56f6f4b3d9c74e01cb13b (patch) | |
tree | e81d9e92c30e59ca3f8d87b5db31cdbf909c3433 /test/units | |
parent | fafb23094e77a619066a92a7fa99a7045292e473 (diff) | |
download | ansible-42355d181a11b51ebfc56f6f4b3d9c74e01cb13b.tar.gz |
Do not double calculate loops and `delegate_to` (#80171)
Diffstat (limited to 'test/units')
-rw-r--r-- | test/units/executor/test_task_executor.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/units/executor/test_task_executor.py b/test/units/executor/test_task_executor.py index 47e339939d..4be37de06f 100644 --- a/test/units/executor/test_task_executor.py +++ b/test/units/executor/test_task_executor.py @@ -57,6 +57,7 @@ class TestTaskExecutor(unittest.TestCase): loader=fake_loader, shared_loader_obj=mock_shared_loader, final_q=mock_queue, + variable_manager=MagicMock(), ) def test_task_executor_run(self): @@ -84,6 +85,7 @@ class TestTaskExecutor(unittest.TestCase): loader=fake_loader, shared_loader_obj=mock_shared_loader, final_q=mock_queue, + variable_manager=MagicMock(), ) te._get_loop_items = MagicMock(return_value=None) @@ -102,7 +104,7 @@ class TestTaskExecutor(unittest.TestCase): self.assertIn("failed", res) def test_task_executor_run_clean_res(self): - te = TaskExecutor(None, MagicMock(), None, None, None, None, None, None) + te = TaskExecutor(None, MagicMock(), None, None, None, None, None, None, None) te._get_loop_items = MagicMock(return_value=[1]) te._run_loop = MagicMock( return_value=[ @@ -150,6 +152,7 @@ class TestTaskExecutor(unittest.TestCase): loader=fake_loader, shared_loader_obj=mock_shared_loader, final_q=mock_queue, + variable_manager=MagicMock(), ) items = te._get_loop_items() @@ -186,6 +189,7 @@ class TestTaskExecutor(unittest.TestCase): loader=fake_loader, shared_loader_obj=mock_shared_loader, final_q=mock_queue, + variable_manager=MagicMock(), ) def _execute(variables): @@ -206,6 +210,7 @@ class TestTaskExecutor(unittest.TestCase): loader=DictDataLoader({}), shared_loader_obj=MagicMock(), final_q=MagicMock(), + variable_manager=MagicMock(), ) context = MagicMock(resolved=False) @@ -242,6 +247,7 @@ class TestTaskExecutor(unittest.TestCase): loader=DictDataLoader({}), shared_loader_obj=MagicMock(), final_q=MagicMock(), + variable_manager=MagicMock(), ) context = MagicMock(resolved=False) @@ -279,6 +285,7 @@ class TestTaskExecutor(unittest.TestCase): loader=DictDataLoader({}), shared_loader_obj=MagicMock(), final_q=MagicMock(), + variable_manager=MagicMock(), ) action_loader = te._shared_loader_obj.action_loader @@ -318,6 +325,7 @@ class TestTaskExecutor(unittest.TestCase): mock_task.become = False mock_task.retries = 0 mock_task.delay = -1 + mock_task.delegate_to = None mock_task.register = 'foo' mock_task.until = None mock_task.changed_when = None @@ -344,6 +352,9 @@ class TestTaskExecutor(unittest.TestCase): mock_action = MagicMock() mock_queue = MagicMock() + mock_vm = MagicMock() + mock_vm.get_delegated_vars_and_hostname.return_value = {}, None + shared_loader = MagicMock() new_stdin = None job_vars = dict(omit="XXXXXXXXXXXXXXXXXXX") @@ -357,6 +368,7 @@ class TestTaskExecutor(unittest.TestCase): loader=fake_loader, shared_loader_obj=shared_loader, final_q=mock_queue, + variable_manager=mock_vm, ) te._get_connection = MagicMock(return_value=mock_connection) @@ -413,6 +425,7 @@ class TestTaskExecutor(unittest.TestCase): loader=fake_loader, shared_loader_obj=shared_loader, final_q=mock_queue, + variable_manager=MagicMock(), ) te._connection = MagicMock() |