Namechange events_processed -> event_processing_finished

from PR review, also adding tests to assert that the
value is passed from the stdout_handle to the UnifiedJob
object on finalization of job run in tasks.py
This commit is contained in:
AlanCoding
2018-03-13 15:46:35 -04:00
parent b803a6e557
commit 04a27d5b4d
4 changed files with 17 additions and 8 deletions

View File

@@ -35,7 +35,7 @@ from awx.main.models import (
from awx.main import tasks
from awx.main.queue import CallbackQueueDispatcher
from awx.main.utils import encrypt_field, encrypt_value
from awx.main.utils import encrypt_field, encrypt_value, OutputEventFilter
@@ -305,6 +305,15 @@ class TestGenericRun(TestJobExecution):
]:
assert c in self.task.update_model.call_args_list
def test_event_count(self):
with mock.patch.object(self.task, 'get_stdout_handle') as mock_stdout:
handle = OutputEventFilter(lambda event_data: None)
handle._event_ct = 334
mock_stdout.return_value = handle
self.task.run(self.pk)
assert self.task.update_model.call_args[-1]['emitted_events'] == 334
def test_artifact_cleanup(self):
path = tempfile.NamedTemporaryFile(delete=False).name
try: