add more assertions to try to pin down what is different on windows

This commit is contained in:
burnettk 2023-04-25 21:53:08 -04:00
parent 04864692b6
commit 956ba2955b
1 changed files with 21 additions and 4 deletions

View File

@ -341,18 +341,26 @@ class TestProcessInstanceProcessor(BaseTest):
processor = ProcessInstanceProcessor(process_instance)
processor.do_engine_steps(save=True)
assert len(process_instance.active_human_tasks) == 1
initial_human_task_id = process_instance.active_human_tasks[0].id
human_task_one = process_instance.active_human_tasks[0]
initial_human_task_id = human_task_one.id
assert len(process_instance.active_human_tasks) == 1
assert initial_human_task_id == process_instance.active_human_tasks[0].id
assert len(process_instance.human_tasks) == 1
spiff_manual_task = processor.bpmn_process_instance.get_task_from_id(UUID(human_task_one.task_id))
ProcessInstanceService.complete_form_task(processor, spiff_manual_task, {}, initiator_user, human_task_one)
assert len(process_instance.human_tasks) == 2, "expected 2 human tasks after first one is completed"
# unnecessary lookup just in case on windows
process_instance = ProcessInstanceModel.query.filter_by(id=process_instance.id).first()
human_task_one = process_instance.active_human_tasks[0]
spiff_manual_task = processor.bpmn_process_instance.get_task_from_id(UUID(human_task_one.task_id))
ProcessInstanceService.complete_form_task(processor, spiff_manual_task, {}, initiator_user, human_task_one)
human_task_one = process_instance.active_human_tasks[0]
spiff_manual_task = processor.bpmn_process_instance.get_task_from_id(UUID(human_task_one.task_id))
ProcessInstanceService.complete_form_task(processor, spiff_manual_task, {}, initiator_user, human_task_one)
assert len(process_instance.active_human_tasks) == 0, "expected 0 active human tasks after 2nd one is completed"
processor.suspend()
all_task_models_matching_top_level_subprocess_script = (
TaskModel.query.join(TaskDefinitionModel)
.filter(TaskDefinitionModel.bpmn_identifier == "top_level_subprocess_script")
@ -362,10 +370,14 @@ class TestProcessInstanceProcessor(BaseTest):
assert len(all_task_models_matching_top_level_subprocess_script) == 1
task_model_to_reset_to = all_task_models_matching_top_level_subprocess_script[0]
assert task_model_to_reset_to is not None
assert len(process_instance.human_tasks) == 2, "expected 2 human tasks before reset"
ProcessInstanceProcessor.reset_process(process_instance, task_model_to_reset_to.guid)
assert len(process_instance.human_tasks) == 2, "still expected 2 human tasks after reset"
# make sure sqlalchemy session matches current db state
db.session.expire_all()
assert len(process_instance.human_tasks) == 2, "still expected 2 human tasks after reset and session expire_all"
process_instance = ProcessInstanceModel.query.filter_by(id=process_instance.id).first()
processor = ProcessInstanceProcessor(process_instance)
@ -377,6 +389,11 @@ class TestProcessInstanceProcessor(BaseTest):
assert top_level_subprocess_script_spiff_task is not None
processor.resume()
processor.do_engine_steps(save=True, execution_strategy_name="greedy")
assert len(process_instance.human_tasks) == 3, "expected 3 human tasks after reset and do_engine_steps"
spiff_task_guid_strings = [ht.task_id for ht in process_instance.human_tasks]
unique_task_guids = set(spiff_task_guid_strings)
assert len(unique_task_guids) == 3, "expected 3 unique task guids after reset and do_engine_steps"
# reload again, just in case, since the assertion where it says there should be 1 active_human_task
# is failing intermittently on windows, so just debugging.