mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-17 02:58:37 -05:00
fix task manager running task structures
- prevent dual-entry for first item in running jobs due to setdefault syntax - fix issue where queues (celery tasks) only returned the last item in the inspector output due to looping problem this caused reaper bugs in production
This commit is contained in:
@@ -50,3 +50,20 @@ class TestCleanupInconsistentCeleryTasks():
|
||||
tm.cleanup_inconsistent_celery_tasks()
|
||||
job.save.assert_called_once()
|
||||
logger_mock.error.assert_called_once_with("Task job 2 (failed) DB error in marking failed. Job possibly deleted.")
|
||||
|
||||
@mock.patch.object(InstanceGroup.objects, 'prefetch_related', return_value=[])
|
||||
@mock.patch('awx.main.scheduler.task_manager.inspect')
|
||||
def test_multiple_active_instances_sanity_check(self, inspect_mock, *args):
|
||||
class MockInspector:
|
||||
pass
|
||||
|
||||
mock_inspector = MockInspector()
|
||||
mock_inspector.active = lambda: {
|
||||
'celery@host1': [],
|
||||
'celery@host2': []
|
||||
}
|
||||
inspect_mock.return_value = mock_inspector
|
||||
tm = TaskManager()
|
||||
active_task_queues, queues = tm.get_active_tasks()
|
||||
assert 'host1' in queues
|
||||
assert 'host2' in queues
|
||||
|
||||
Reference in New Issue
Block a user