We now check for an infinite loop during validation.

This happened when testing for a Department Chair in a workflow.
Our mocked data for study_info script did not have a Department Chair
This commit is contained in:
mike cullerton 2021-03-16 13:35:51 -04:00
parent 14386b8ba9
commit 529bfc34b3
1 changed files with 30 additions and 24 deletions

View File

@ -95,7 +95,9 @@ class WorkflowService(object):
WorkflowService.delete_test_data()
raise ApiError.from_workflow_exception("workflow_validation_exception", str(we), we)
count = 0
while not processor.bpmn_workflow.is_completed():
if count < 1000:
try:
processor.bpmn_workflow.get_deep_nav_list() # Assure no errors with navigation.
processor.bpmn_workflow.do_engine_steps()
@ -117,9 +119,13 @@ class WorkflowService(object):
task_name=task.get_name())
WorkflowService.populate_form_with_random_data(task, task_api, required_only)
processor.complete_task(task)
count += 1
except WorkflowException as we:
WorkflowService.delete_test_data()
raise ApiError.from_workflow_exception("workflow_validation_exception", str(we), we)
else:
raise ApiError.from_workflow_exception(code='validation_loop',
message=f'There appears to be an infinite loop in the validation. spec_id: {spec_id}')
WorkflowService.delete_test_data()
WorkflowService._process_documentation(processor.bpmn_workflow.last_task.parent.parent)