Commit graph

21 commits

Author SHA1 Message Date
Matt Clay
d913f69ba1 PEP 8 W291 whitespace cleanup. 2017-01-27 17:08:02 -08:00
James Cammarata
e244895174 Avoid copying task parents in TaskExecutor
As Block.copy() is potentially expensive, avoid copying the parent
structure of tasks in TaskExecutor.
2016-08-08 15:58:46 -05:00
James Cammarata
d2b3b2c03e Performance improvements 2016-08-08 15:58:46 -05:00
Matt Clay
292785ff2b Parse async response in async action. (#16534)
* Parse async response in async action.
* Add async test for non-JSON data before module output.
* Fix existing async unit test.

Resolves #16156
2016-07-01 14:52:45 -07:00
Toshio Kuratomi
f86df7c88b Test that task.args are also set properly (#15950) 2016-06-01 13:28:57 -07:00
Matt Davis
bc7405efc9 Merge pull request #15797 from robinro/patch-1
reduce async timeout in unittests
2016-05-12 17:19:10 -07:00
Toshio Kuratomi
292f0ed0d6 If we can't squash for any reason, then simply do not optimize the items loop.
Also add more squashing testcases

Fixes #15649
2016-05-12 10:06:18 -07:00
Robin Roth
254cf9ea68 reduce async timeout
reduce from 3 sec to 0.1 sec; the 3 sec sleep was about half of the total unittest time on my development machine...
2016-05-10 08:09:28 +02:00
Toshio Kuratomi
5c7ad654db Add some more tests for item squashing 2016-05-05 20:33:44 -07:00
James Cammarata
6eefc11c39 Make the loop variable (item by default) settable per task
Required for include+with* tasks which may include files that also
have tasks containing a with* loop.

Fixes #12736
2016-04-19 01:42:40 -04:00
James Cammarata
e02b98274b issue callbacks per item and retry fails
- now workers passes queue to task_executor so it can send back events per item and on retry attempt
- updated result class to pass along events to strategy
- base strategy updated to forward new events to callback
- callbacks now remove 'items' on final result but process them directly when invoked per item
- new callback method to deal with retry attempt messages (also now obeys nolog)
- updated tests to match new signature of task_executor

fixes #14558
fixes #14072
2016-02-23 15:07:06 -05:00
Toshio Kuratomi
0e410bbc8a Squashing was occuring even though pkgs didn't have a template that would be affected by squash
This broke other uses of looping (looping for delegate_to in the
reported bug)

Fixes #13980
2016-01-27 21:55:00 -08:00
Toshio Kuratomi
aa034f4fcf Add unit tests for issue #12976 2015-11-05 10:52:37 -08:00
Toshio Kuratomi
37052a983a Fix unittest dailure with the new squash items code 2015-11-05 10:45:54 -08:00
Marius Gedminas
c22f4ee697 Add a comment explaining why async = 1 in the test 2015-09-07 19:46:05 +03:00
Marius Gedminas
1a1c9203e2 Python 3: fix TypeError: unorderable types in test
The full error was

======================================================================
ERROR: test_task_executor_execute (units.executor.test_task_executor.TestTaskExecutor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mg/src/ansible/test/units/executor/test_task_executor.py", line 252, in test_task_executor_execute
    mock_action.run.return_value = dict(ansible_facts=dict())
  File "/home/mg/src/ansible/lib/ansible/executor/task_executor.py", line 317, in _execute
    if self._task.async > 0:
TypeError: unorderable types: MagicMock() > int()

----------------------------------------------------------------------

Experiments show that Python 2 MagicMock() > 0 is true, so I'm setting
the async property on mock_task to 1.  (If I set it to 0, the test fails
anyway.)
2015-09-07 09:49:28 +03:00
James Cammarata
ccaf47bd97 Fix unit tests broken by 057712c1 2015-08-28 16:44:04 -04:00
James Cammarata
9891bcbcae Fix unit tests broken by previous commit 2015-08-04 12:40:13 -04:00
James Cammarata
e64989beb4 Moving ConnectionInformation -> PlayContext
Also making PlayContext a child class of the Playbook Base class,
which gives it access to all of the FieldAttribute code to ensure
field values are correctly typed after post_validation

Fixes #11381
2015-07-21 12:13:50 -04:00
Brian Coca
323362e23a added stdout to test result 2015-07-14 15:59:18 -04:00
James Cammarata
d4a31e8d26 Adding unit tests for TaskExecutor (v2) 2015-05-24 07:47:06 -05:00