summaryrefslogtreecommitdiffstats
path: root/test/units/plugins/strategy
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2018-12-18 03:10:59 +0100
committerToshio Kuratomi <a.badger@gmail.com>2019-01-04 03:12:23 +0100
commitafdbb0d9d5bebb91f632f0d4a1364de5393ba17a (patch)
tree4f688eed3ef5ea1ccd3f80dc716dc62ba7958f3f /test/units/plugins/strategy
parentAdd a CLIArgs Singleton class that will hold the parse cli arguments (diff)
downloadansible-afdbb0d9d5bebb91f632f0d4a1364de5393ba17a.tar.xz
ansible-afdbb0d9d5bebb91f632f0d4a1364de5393ba17a.zip
Save the command line arguments into a global context
* Once cli args are parsed, they're constant. So, save the parsed args into the global context for everyone else to use them from now on. * Port cli scripts to use the CLIARGS in the context * Refactor call to parse cli args into the run() method * Fix unittests for changes to the internals of CLI arg parsing * Port callback plugins to use context.CLIARGS * Got rid of the private self._options attribute * Use context.CLIARGS in the individual callback plugins instead. * Also output positional arguments in default and unixy plugins * Code has been simplified since we're now dealing with a dict rather than Optparse.Value
Diffstat (limited to 'test/units/plugins/strategy')
-rw-r--r--test/units/plugins/strategy/test_strategy_base.py10
-rw-r--r--test/units/plugins/strategy/test_strategy_linear.py5
2 files changed, 3 insertions, 12 deletions
diff --git a/test/units/plugins/strategy/test_strategy_base.py b/test/units/plugins/strategy/test_strategy_base.py
index 85a5d24017..a15f3e7b26 100644
--- a/test/units/plugins/strategy/test_strategy_base.py
+++ b/test/units/plugins/strategy/test_strategy_base.py
@@ -66,7 +66,6 @@ class TestStrategyBase(unittest.TestCase):
mock_tqm = MagicMock(TaskQueueManager)
mock_tqm._final_q = mock_queue
- mock_tqm._options = MagicMock()
strategy_base = StrategyBase(tqm=mock_tqm)
strategy_base.cleanup()
@@ -106,7 +105,6 @@ class TestStrategyBase(unittest.TestCase):
mock_tqm._failed_hosts = dict()
mock_tqm._unreachable_hosts = dict()
- mock_tqm._options = MagicMock()
strategy_base = StrategyBase(tqm=mock_tqm)
mock_host = MagicMock()
@@ -187,15 +185,13 @@ class TestStrategyBase(unittest.TestCase):
mock_host.has_hostkey = True
mock_inventory = MagicMock()
mock_inventory.get.return_value = mock_host
- mock_options = MagicMock()
- mock_options.module_path = None
tqm = TaskQueueManager(
inventory=mock_inventory,
variable_manager=mock_var_manager,
loader=fake_loader,
- options=mock_options,
passwords=None,
+ forks=5,
)
tqm._initialize_processes(3)
tqm.hostvars = dict()
@@ -520,15 +516,13 @@ class TestStrategyBase(unittest.TestCase):
mock_iterator._play = mock_play
fake_loader = DictDataLoader()
- mock_options = MagicMock()
- mock_options.module_path = None
tqm = TaskQueueManager(
inventory=mock_inventory,
variable_manager=mock_var_mgr,
loader=fake_loader,
- options=mock_options,
passwords=None,
+ forks=5,
)
tqm._initialize_processes(3)
tqm._initialize_notified_handlers(mock_play)
diff --git a/test/units/plugins/strategy/test_strategy_linear.py b/test/units/plugins/strategy/test_strategy_linear.py
index a9fa5ae351..1c1624a663 100644
--- a/test/units/plugins/strategy/test_strategy_linear.py
+++ b/test/units/plugins/strategy/test_strategy_linear.py
@@ -80,15 +80,12 @@ class TestStrategyLinear(unittest.TestCase):
all_vars=dict(),
)
- mock_options = MagicMock()
- mock_options.module_path = None
-
tqm = TaskQueueManager(
inventory=inventory,
variable_manager=mock_var_manager,
loader=fake_loader,
- options=mock_options,
passwords=None,
+ forks=5,
)
tqm._initialize_processes(3)
strategy = StrategyModule(tqm)