def test_workflow_does_not_reap(self): i = Instance(hostname='awx') i.save() j = WorkflowJob(status='running', execution_node='awx') j.save() reaper.reap(i) assert WorkflowJob.objects.first().status == 'running'
def mk_workflow_job(status='new', workflow_job_template=None, extra_vars={}, persisted=True): job = WorkflowJob(status=status, extra_vars=json.dumps(extra_vars)) job.workflow_job_template = workflow_job_template if persisted: job.save() return job
def test_unified_job_workflow_attributes(): with mock.patch('django.db.ConnectionRouter.db_for_write'): job = UnifiedJob(id=1, name="job-1", launch_type="workflow") job.unified_job_node = WorkflowJobNode(workflow_job=WorkflowJob(pk=1)) assert job.spawned_by_workflow is True assert job.workflow_job_id == 1
def workflow_job(self): return WorkflowJob(pk=1)